Intermediate level

Absolute value

The absolute value of a number is its distance from zero — never negative, because a distance has no direction. Learn the case-by-case definition, the distance between two numbers written as |a − b|, the properties of the modulus and equations with absolute value.

Before you start

This topic builds on earlier ideas. Before you start, it's worth working through the lessons below — they'll make everything click:

Where this is used

Real situations where you count exactly the way this lesson teaches:

  • Shopping and complaints
    A bag of flour should hold 1000 g; the shop scale reads 977 g. The deviation is |977 − 1000| = 23 g — and that is what decides the complaint, because against an allowance of 15 g it makes no difference whether the bag is lighter or heavier.
  • Weather forecasting
    A forecast said 18 °C and the thermometer read 21 °C; the next day it said 15 °C and the reading was 12 °C. Both forecasts were equally wrong: |18 − 21| = 3 and |15 − 12| = 3. Without the modulus the first error would come out as −3 and cancel the second to zero on averaging.
  • Quality control and metrology
    A shaft must measure 25.00 mm within a tolerance of 0.05 mm. The caliper reads 24.97 mm, so |24.97 − 25.00| = 0.03 mm and the part passes. At a reading of 25.08 mm the modulus gives 0.08 mm and the part is scrapped.
  • Software development
    Floating-point numbers are never tested for equality with an equals sign, because 0.1 + 0.2 comes out as 0.30000000000000004. The test used instead is |a − b| < 0.000001 — one number rather than two separate comparisons.

All formulas

  • Definition

    a={afor a0afor a<0|a| = \begin{cases} a & \text{for } a \ge 0 \\ -a & \text{for } a < 0 \end{cases}

    a non-negative number is left alone, a negative one has its sign flipped

  • Non-negativity

    a0|a| \ge 0

    a distance is never negative

  • Symmetry

    a=a|-a| = |a|

    opposite numbers sit equally far from zero

  • Distance between two numbers

    ab=ba|a - b| = |b - a|

    the order of subtraction does not change the distance

  • Products and quotients

    ab=abab=ab|a \cdot b| = |a| \cdot |b| \qquad \left|\frac{a}{b}\right| = \frac{|a|}{|b|}

    the modulus distributes over multiplication and division

  • Root of a square

    a2=a\sqrt{a^2} = |a|

    not a, because a square root is always non-negative

  • Triangle inequality

    a+ba+b|a + b| \le |a| + |b|

    the modulus of a sum never exceeds the sum of the moduli

The lesson on negative numbers said that the distance between two numbers on the line is always positive — but we computed it in words back then: subtract the number further left from the one further right. Mathematics has one sign that replaces that instruction: the absolute value, also called the modulus.

Definition

The absolute value of a number aa is written with two vertical bars and defined case by case:

a={afor a0afor a<0|a| = \begin{cases} a & \text{for } a \ge 0 \\ -a & \text{for } a < 0 \end{cases}

In words: a non-negative number is left alone, and a negative one has its sign flipped. The minus in front of aa on the second line does not make the result negative — it flips the sign of a number that was already negative, so 7=(7)=7|-7| = -(-7) = 7.

Distance from zero

The same formula has a simpler description: a|a| is the distance of aa from zero on the number line.

−6−4−2024644
From zero to −4 and from zero to 4 is the same number of steps, so |−4| = |4| = 4.

Two properties follow, and neither has to be memorised separately — the picture shows both:

a0a=a|a| \ge 0 \qquad |-a| = |a|

A distance is never negative, and opposite numbers sit on either side of zero at the same distance from it. The only number whose modulus is zero is zero itself.

The distance between two numbers

If a|a| is the distance from zero, then the distance between any two numbers comes from subtracting them and taking the modulus:

ab=ba|a - b| = |b - a|

The order of subtraction makes no difference precisely because the modulus removes the sign — and the sign is the only thing that would have changed.

−6−4−202468
|−3 − 5| = |−8| = 8 — the same as |5 − (−3)| = |8| = 8.
What is the distance between −12 and −4?

Properties of the modulus

The modulus distributes over multiplication and division:

ab=abab=ab(b0)|a \cdot b| = |a| \cdot |b| \qquad \left|\frac{a}{b}\right| = \frac{|a|}{|b|} \quad (b \neq 0)

Over addition it does not — and that is the point of the triangle inequality:

a+ba+b|a + b| \le |a| + |b|

For a=3a = 3 and b=5b = -5 the left side gives 2=2|-2| = 2 while the right gives 3+5=83 + 5 = 8. Equality holds only when both numbers share a sign (or one of them is zero): going once left and once right takes you less far from zero than going twice the same way.

The most-used property ties the modulus to the square root:

a2=a\sqrt{a^2} = |a|

Not aa — because a square root is non-negative by definition. For a=5a = -5 we get (5)2=25=5\sqrt{(-5)^2} = \sqrt{25} = 5, which is 5|-5| and not 5-5.

Equations with absolute value

The equation x=r|x| = r reads as a question: which numbers lie at distance rr from zero? The answer depends on rr:

  • r>0r > 0 — two solutions: x=rx = r and x=rx = -r,
  • r=0r = 0 — one solution: x=0x = 0,
  • r<0r < 0 — no solutions, so the solution set is \varnothing, since a modulus is never negative.

The equation xa=r|x - a| = r reads the same way: the numbers at distance rr from aa, that is x=arx = a - r and x=a+rx = a + r.

Solve the equation |x − 3| = 4.

Practice

Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.

Exercise 1 of 8Score: 0
|−7| =

Common mistakes

  • Taking a=a|a| = a as a general rule — it holds only for a0a \ge 0. For a negative number the modulus flips the sign.
  • Reading a-a as a negative number — if a=7a = -7, then a=7-a = 7. A minus in front of a letter settles nothing about the sign.
  • Shortening a2\sqrt{a^2} to aa — the correct result is a|a|; for a=5a = -5 the two differ by a sign.
  • Distributing the modulus over additiona+b|a + b| generally does not equal a+b|a| + |b|; only an inequality holds here.
  • Forgetting the second solution — the equation x=6|x| = 6 has two solutions, 66 and 6-6, not one.

Formula card

Topic: Absolute value

  • Definition

    a={afor a0afor a<0|a| = \begin{cases} a & \text{for } a \ge 0 \\ -a & \text{for } a < 0 \end{cases}

    a non-negative number is left alone, a negative one has its sign flipped

  • Non-negativity

    a0|a| \ge 0

    a distance is never negative

  • Symmetry

    a=a|-a| = |a|

    opposite numbers sit equally far from zero

  • Distance between two numbers

    ab=ba|a - b| = |b - a|

    the order of subtraction does not change the distance

  • Products and quotients

    ab=abab=ab|a \cdot b| = |a| \cdot |b| \qquad \left|\frac{a}{b}\right| = \frac{|a|}{|b|}

    the modulus distributes over multiplication and division

  • Root of a square

    a2=a\sqrt{a^2} = |a|

    not a, because a square root is always non-negative

  • Triangle inequality

    a+ba+b|a + b| \le |a| + |b|

    the modulus of a sum never exceeds the sum of the moduli

−6−4−2024644
The numbers −4 and 4 lie on opposite sides of zero, both at a distance of 4 — which is why |−4| = |4| = 4.
−6−4−202468
From −3 to 5 is 8 steps — exactly what |−3 − 5| gives.

Frequently asked questions

Related articles