M5.1.2 Chapter 2

The modulus function

How far is a number from zero, when I do not care which way I walk?

Your guess

Pick one before you read on. It is fine to be wrong.

Your guess
  • You picked A. Read on. At the end, the chapter comes back to your guess.

  • You picked B. Read on. At the end, the chapter comes back to your guess.

  • You picked C. Read on. At the end, the chapter comes back to your guess.

By the end you can

  • Sketch y = |2x − 3|
  • Solve |x − 2| < 5

The modulus of a number is its distance from 0 on the number line. It is written with two bars: |x|. Some books call it the absolute value.

A number line from −5 to 5. A hop of 5 runs from 0 to −5 and another hop of 5 runs from 0 to 5. Dots mark −5 and 5.−5−4−3−2−101234555−55
Both −5 and 5 are 5 steps from 0. So |−5| = 5 and |5| = 5.

A distance is never negative, so |x| ≥ 0 for every x, and |x| = 0 only when x = 0. We define the modulus in two pieces.

|x| = x when x ≥ 0. |x| = −x when x < 0. When x is negative, −x is positive, so |−5| = −(−5) = 5.

More generally, |a − b| is the distance between the numbers a and b. It is the same as |b − a|, because the distance does not depend on the direction.

So |x − 2| < 5 says: the distance from x to 2 is less than 5. On the number line that is every number within 5 steps of 2, on either side.

A number line named x from −5 to 9. Open circles at −3 and 7 with a bar between them. A dot at 2, the middle of the bar.−5−3−113579x
The numbers within 5 steps of 2: from 5 below 2 to 5 above 2. The ends −3 and 7 are not included, so their circles are open.

This gives a rule. For b > 0: |x − a| < b means a − b < x < a + b. And |x − a| > b means x < a − b or x > a + b. If b is negative, |x − a| < b has no solution, because a modulus is never negative.

Worked example

Solve |x − 2| < 5.

  1. The distance from x to 2 must be less than 5.
  2. So x − 2 lies between −5 and 5: −5 < x − 2 < 5.
  3. Add 2 to every part. The left end becomes −5 + 2 = −3.
  4. The right end becomes 5 + 2 = 7. So −3 < x < 7.

Answer: −3 < x < 7

Now the graph. Take y = 2x − 3. For x ≥ 1.5 the value 2x − 3 is 0 or more, so |2x − 3| = 2x − 3. For x < 1.5 it is negative, so |2x − 3| = −(2x − 3) = 3 − 2x.

So the graph of y = |2x − 3| is the line y = 2x − 3 where it is on or above the x axis. Where the line is below the axis, the graph is its reflection in the x axis. The graph has a corner on the axis.

A graph with x from −2 to 5 and y from −4 to 8. A dashed line named y = 2x − 3 runs below the x axis, from the left edge to the point where it meets the axis at 1.5. A solid V shaped graph named y = |2x − 3| has its corner at the point (1.5, 0) and meets the y axis at the point (0, 3).(1.5, 0)(0, 3)y = 2x − 3y = |2x − 3|−2−12345−22680xy
Only the part of y = 2x − 3 that lies below the x axis is dashed. It is folded up into the left arm of the solid V.

Worked example

Sketch y = |2x − 3|. Mark where it meets the axes.

  1. Find where 2x − 3 = 0: 2x = 3, so x = 1.5. The graph touches the x axis at (1.5, 0).
  2. Put x = 0: |2 × 0 − 3| = |−3| = 3. The graph meets the y axis at (0, 3).
  3. For x ≥ 1.5 the graph is the line y = 2x − 3, with gradient 2.
  4. For x < 1.5 the graph is the line y = 3 − 2x, with gradient −2.
  5. The two pieces meet in a V shape, with its corner at (1.5, 0). The graph is never below the x axis.

Answer: A V with its corner at (1.5, 0), meeting the y axis at (0, 3).

The graph also solves inequalities. To solve |2x − 3| < 5, draw the line y = 5 and find where the V is below it.

A graph with x from −3 to 6 and y from −1 to 7. A V shaped graph has its corner at 1.5 on the x axis. A dashed horizontal line stands at height 5. It meets the V at two dots, one at x = −1 and one at x = 4, with dashed guides to the x axis.−3−2−1123456260xy
The V is below the dashed line y = 5 between x = −1 and x = 4.

Worked example

Solve |2x − 3| < 5.

  1. The inside 2x − 3 must lie between −5 and 5: −5 < 2x − 3 < 5.
  2. Add 3 to every part: −2 < 2x < 8.
  3. Divide every part by 2: −1 < x < 4.
  4. Check with the graph: the V is below y = 5 between x = −1 and x = 4.
  5. Check one number inside, x = 0: |2 × 0 − 3| = 3, and 3 < 5. Check one outside, x = 5: |2 × 5 − 3| = 7, and 7 is not less than 5.

Answer: −1 < x < 4

When the right side of an equation is not a plain number, a modulus equation needs more care. We split into two cases, from the two pieces of the definition. Then we must check every answer in the original equation.

A graph with x from −3 to 3 and y from −4 to 5. A V shaped graph named g, which is y = |x − 1|, has its corner at 1 on the x axis. A straight line named f, which is y = 2x + 1, rises steeply. The two meet at one dot, the point (0, 1). A second dot, with dashed guides to the axes, marks the point (−2, −3) on the line, where the V is not.(0, 1)fg−3−2123−4−240xy
g(x) = |x − 1| and f(x) = 2x + 1 meet once, at (0, 1). The other answer from the algebra, x = −2, has the line at height −3, where the V can never be.

Worked example

Solve |x − 1| = 2x + 1.

  1. Case 1: x ≥ 1. Then |x − 1| = x − 1, so x − 1 = 2x + 1.
  2. Take x from both sides: −1 = x + 1, so x = −2.
  3. But −2 is not ≥ 1, so case 1 gives no answer.
  4. Case 2: x < 1. Then |x − 1| = −(x − 1) = 1 − x, so 1 − x = 2x + 1.
  5. Add x to both sides and take 1 away: 0 = 3x, so x = 0.
  6. And 0 < 1, so case 2 gives x = 0.
  7. Check in the original: |0 − 1| = 1 and 2 × 0 + 1 = 1. They agree.
  8. Check the rejected number too: |−2 − 1| = 3, but 2 × (−2) + 1 = −3. A modulus is never −3, so −2 fails.

Answer: x = 0 only.

The same fold works for a curve. For y = |x² − 4|, draw y = x² − 4, which dips below the x axis between −2 and 2. Fold that dip up. The result has a corner at each of x = −2 and x = 2, where the curve meets the axis.

A graph with x from −3 to 3 and y from −5 to 6. A dashed curve named g is the part of y = x² − 4 between x = −2 and x = 2, dipping to the point (0, −4). A solid curve named f is y = |x² − 4|. It meets the x axis at corners at −2 and 2, marked by dots with their numbers under them, and has a hump at the point (0, 4). A dot also marks the dip (0, −4).−4(0, 4)(0, −4)fg−3−2−1123−5−3−2−11234560xy
f(x) = |x² − 4| and the dashed part of g(x) = x² − 4 that is folded up.

A different change is y = f(|x|). Put |x| in place of x. For x ≥ 0 nothing changes. For x < 0, |x| = −x, so the graph copies the right half in a mirror image in the y axis. So y = |x| − 2 is a V with its corner at (0, −2).

Two moduli can be compared by squaring. For any real numbers a and b, |a| < |b| exactly when a² < b². This is true because |a|² = a², and squaring keeps the order of non-negative numbers.

Worked example

Solve |2x − 1| < |x + 3|.

  1. Square both sides. This is allowed because both sides are moduli, which are 0 or more: (2x − 1)² < (x + 3)².
  2. Expand: 4x² − 4x + 1 < x² + 6x + 9.
  3. Collect everything on the left: 3x² − 10x − 8 < 0.
  4. Factorise: (3x + 2)(x − 4) < 0.
  5. The product is negative between the two roots. The roots come from 3x + 2 = 0 and x − 4 = 0, which give x = −2/3 and x = 4.
  6. So −2/3 < x < 4.
  7. Check with x = 0: |−1| = 1 and |3| = 3, and 1 < 3. Check with x = 5: |9| = 9 and |8| = 8, and 9 is not less than 8.

Answer: −2/3 < x < 4

Try it

Fold up the part below the axis

You need: squared paper, a pencil.

  1. Make a table of x and 2x − 3 for x from −1 to 4.
  2. Add a third row for |2x − 3|. Drop every minus sign, because a modulus is never negative.
  3. Plot both rows as two graphs on one grid. The first is a straight line, the second is a V.
  4. Fold the paper along the x axis. The part of the line below the axis lands on the V.

What you will see: Where 2x − 3 is already 0 or more, the two rows agree. Where it is negative, the modulus row shows the same number without its sign.

If you cannot try it, this is what happens.
A table with the heads x, 2x − 3 and |2x − 3|. The rows go x = −1, 0, 1, 2, 3, 4. The second column reads −5, −3, −1, 1, 3, 5 and the third column reads 5, 3, 1, 1, 3, 5.x2x − 3|2x − 3|−1−550−331−11211333455

A wrong idea many people have

The solution of |x − 2| < 5 is x < 7.

Why it feels right: Taking the bars away gives x − 2 < 5, and that gives x < 7. It seems that only the right end matters.

The test that breaks it: Try x = −10. Then |−10 − 2| = 12, which is not less than 5. But −10 is less than 7, so x < 7 lets in numbers that fail.

What is true: The bars mean two limits. Write −5 < x − 2 < 5, which gives −3 < x < 7. A modulus below a number is between two numbers.

A wrong idea many people have

|a + b| = |a| + |b|.

Why it feels right: A modulus looks like a sign you can remove from each piece, like opening a bracket.

The test that breaks it: Take a = 3 and b = −5. Then |a + b| = |−2| = 2. But |a| + |b| = 3 + 5 = 8.

What is true: In general |a + b| ≤ |a| + |b|. Equality holds only when a and b have the same sign, or one is 0. A modulus does not split over addition.

A wrong idea many people have

Solving |x − 1| = 2x + 1 gives two answers, x = −2 and x = 0, and both are right.

Why it feels right: A modulus equation often has two answers, so two answers from the algebra look right.

The test that breaks it: Put x = −2 back: |−2 − 1| = 3, but 2 × (−2) + 1 = −3. The two sides are not equal.

What is true: When the right side has x in it, check every answer in the original equation. The right side must not be negative, because a modulus never is.

Key words

modulus
the distance of a number from 0, written |x|. It is x when x ≥ 0 and −x when x < 0. Also called the absolute value.
modulus function
the function f(x) = |x|, or a function with a modulus in its rule, such as |2x − 3|.

Back to your guess

The answer is B: The distance from −5 to 0 is 5.

A distance is never negative. From −5 to 0 is 5 steps, and from 5 to 0 is also 5 steps. The modulus of a number is this distance from 0, so |−5| = 5 and |5| = 5.

Check yourself

Try each one before you look. A wrong answer tells you where to go next.

  1. Which values of x satisfy |x − 4| < 3?

    Tap your answer.
    1. Not this one. You used only x − 4 < 3. Both limits count: x − 4 must also be more than −3. Go to M5.1.2. Try another.

    2. Not this one. That is the answer to |x − 4| > 3, the numbers far from 4. A modulus below a number means close to 4. Go to M5.1.2. Try another.

    3. Not this one. You changed the sign of 4. The centre is 4, so the numbers are within 3 of 4, not of −4. Go to M5.1.2. Try another.

    4. Yes, that is right. The distance from x to 4 is less than 3, so x lies between 4 − 3 = 1 and 4 + 3 = 7.

    See the answer

    1 < x < 7

    The distance from x to 4 is less than 3, so x lies between 4 − 3 = 1 and 4 + 3 = 7.

    • If you chose A: You used only x − 4 < 3. Both limits count: x − 4 must also be more than −3. Go to M5.1.2.
    • If you chose B: That is the answer to |x − 4| > 3, the numbers far from 4. A modulus below a number means close to 4. Go to M5.1.2.
    • If you chose C: You changed the sign of 4. The centre is 4, so the numbers are within 3 of 4, not of −4. Go to M5.1.2.
  2. The graph is a V shape with its corner on the x axis at x = −2. Which equation does it show?

    A graph with x from −5 to 3 and y from −1 to 5. A V shaped graph has its corner on the x axis at x = −2, shown by a dot with a dashed guide, and meets the y axis at height 2.−5−4−3−2−1123−113450xy
    Tap your answer.
    1. Not this one. The corner of y = |x − 2| is at x = 2, on the right of the axis. The picture has it on the left. Go to M5.1.2. Try another.

    2. Not this one. That moves the whole V down by 2, so its corner is at (0, −2), below the x axis. Go to M5.1.2. Try another.

    3. Yes, that is right. The inside x + 2 is 0 when x = −2, which puts the corner at x = −2. At x = 0 the graph is |0 + 2| = 2, which matches the point where it meets the y axis.

    4. Not this one. That is a narrower V with its corner at the origin, not at x = −2. Go to M5.1.2. Try another.

    See the answer

    y = |x + 2|

    The inside x + 2 is 0 when x = −2, which puts the corner at x = −2. At x = 0 the graph is |0 + 2| = 2, which matches the point where it meets the y axis.

    • If you chose A: The corner of y = |x − 2| is at x = 2, on the right of the axis. The picture has it on the left. Go to M5.1.2.
    • If you chose B: That moves the whole V down by 2, so its corner is at (0, −2), below the x axis. Go to M5.1.2.
    • If you chose D: That is a narrower V with its corner at the origin, not at x = −2. Go to M5.1.2.
  3. Take a = −4 and b = 9. Which statement is true?

    Tap your answer.
    1. Yes, that is right. a + b = 5, so |a + b| = 5. And |a| + |b| = 4 + 9 = 13. Opposite signs let the numbers partly cancel inside the bars, so the left side is smaller: 5 < 13.

    2. Not this one. These are equal only when a and b have the same sign, or one is 0. Here a is negative and b is positive, and 5 is not 13. Go to M5.1.2. Try another.

    3. Not this one. It is the other way round. The left side is |5| = 5 and the right side is 4 + 9 = 13, so the left side is smaller. Go to M5.1.2. Try another.

    See the answer

    |a + b| < |a| + |b|

    a + b = 5, so |a + b| = 5. And |a| + |b| = 4 + 9 = 13. Opposite signs let the numbers partly cancel inside the bars, so the left side is smaller: 5 < 13.

    • If you chose B: These are equal only when a and b have the same sign, or one is 0. Here a is negative and b is positive, and 5 is not 13. Go to M5.1.2.
    • If you chose C: It is the other way round. The left side is |5| = 5 and the right side is 4 + 9 = 13, so the left side is smaller. Go to M5.1.2.
  4. Tariq solves |x − 1| = 2x + 1 and finds x = −2 and x = 0. Which statement is right?

    Tap your answer.
    1. Not this one. Each answer must also fit the condition of its own case, and then be checked in the original equation. x = −2 does not fit its case, x ≥ 1. Go to M5.1.2. Try another.

    2. Yes, that is right. For x = 0 both sides are 1. For x = −2 the left side is 3 and the right side is −3. A modulus is never negative, so −2 is not a solution.

    3. Not this one. Put it back: |−2 − 1| = 3, but 2 × (−2) + 1 = −3. A modulus cannot equal −3. Go to M5.1.2. Try another.

    See the answer

    Only x = 0 works, because x = −2 makes the right side negative.

    For x = 0 both sides are 1. For x = −2 the left side is 3 and the right side is −3. A modulus is never negative, so −2 is not a solution.

    • If you chose A: Each answer must also fit the condition of its own case, and then be checked in the original equation. x = −2 does not fit its case, x ≥ 1. Go to M5.1.2.
    • If you chose C: Put it back: |−2 − 1| = 3, but 2 × (−2) + 1 = −3. A modulus cannot equal −3. Go to M5.1.2.
  5. Solve |2x − 6| < 10.

    See the answer

    −2 < x < 8

    The inside lies between −10 and 10: −10 < 2x − 6 < 10. Add 6: −4 < 2x < 16. Divide by 2: −2 < x < 8.

  6. A metal rod must be 12.5 cm long, with an error of at most 0.3 cm either way. Its length L cm satisfies |L − 12.5| ≤ 0.3. Write the lengths that are allowed.

    See the answer

    12.2 ≤ L ≤ 12.8

    The distance from L to 12.5 is at most 0.3, so −0.3 ≤ L − 12.5 ≤ 0.3. Add 12.5 to every part: 12.2 ≤ L ≤ 12.8. The ends are allowed, because the sign is ≤.

  7. Solve |2x − 1| = x + 4. Give the smaller answer first, and check each in the original equation.

    See the answer

    x = −1 or x = 5

    Case 2x − 1 ≥ 0, so x ≥ 0.5: 2x − 1 = x + 4 gives x = 5, and 5 ≥ 0.5. Case x < 0.5: 1 − 2x = x + 4 gives −3x = 3, so x = −1, and −1 < 0.5. Check: |−3| = 3 = −1 + 4, and |9| = 9 = 5 + 4. Both work.

  8. From an earlier chapter

    f(x) = |x − 4| + 3 for all real x. What is the range of f?

    Tap your answer.
    1. Not this one. You added 4 and 3. The 4 is inside the bars, so it moves the corner sideways. It does not change the lowest height. Go to M5.1.1. Try another.

    2. Not this one. The modulus is 0 or more, but 3 is added after it, so the lowest output is above 0. Go to M5.1.1. Try another.

    3. Not this one. The 3 is added, not taken away, so the lowest output is above 0, not below it. Go to M5.1.1. Try another.

    4. Yes, that is right. The modulus |x − 4| is 0 or more, and it is 0 when x = 4. Add 3: f(x) ≥ 3, and f(4) = 3 is reached. So the range is y ≥ 3.

    See the answer

    y ≥ 3

    The modulus |x − 4| is 0 or more, and it is 0 when x = 4. Add 3: f(x) ≥ 3, and f(4) = 3 is reached. So the range is y ≥ 3.

    • If you chose A: You added 4 and 3. The 4 is inside the bars, so it moves the corner sideways. It does not change the lowest height. Go to M5.1.1.
    • If you chose B: The modulus is 0 or more, but 3 is added after it, so the lowest output is above 0. Go to M5.1.1.
    • If you chose C: The 3 is added, not taken away, so the lowest output is above 0, not below it. Go to M5.1.1.
  9. Which values of x satisfy |x − 3| > 2?

    Tap your answer.
    1. Not this one. That is the answer to |x − 3| < 2, the numbers close to 3. A modulus above a number means far from 3, on either side. Go to M5.1.2. Try another.

    2. Not this one. That is only the right hand part. Numbers far to the left of 3, such as 0, also have a distance of more than 2 from 3. Go to M5.1.2. Try another.

    3. Not this one. You changed the sign of 2 on the left. The ends are 3 − 2 = 1 and 3 + 2 = 5. Go to M5.1.2. Try another.

    4. Yes, that is right. The distance from x to 3 is more than 2. So x is more than 2 below 3, or more than 2 above 3. That gives x < 3 − 2 = 1, or x > 3 + 2 = 5.

    See the answer

    x < 1 or x > 5

    The distance from x to 3 is more than 2. So x is more than 2 below 3, or more than 2 above 3. That gives x < 3 − 2 = 1, or x > 3 + 2 = 5.

    • If you chose A: That is the answer to |x − 3| < 2, the numbers close to 3. A modulus above a number means far from 3, on either side. Go to M5.1.2.
    • If you chose B: That is only the right hand part. Numbers far to the left of 3, such as 0, also have a distance of more than 2 from 3. Go to M5.1.2.
    • If you chose C: You changed the sign of 2 on the left. The ends are 3 − 2 = 1 and 3 + 2 = 5. Go to M5.1.2.
  10. Solve |3x − 6| = 12. Give the larger solution.

    See the answer

    6

    Either 3x − 6 = 12 or 3x − 6 = −12. The first gives 3x = 18, so x = 6. The second gives 3x = −6, so x = −2. The larger is 6.

  11. How many integers x satisfy |x − 3| < 4?

    See the answer

    7

    The condition means −1 < x < 7. The integers inside are 0, 1, 2, 3, 4, 5 and 6, which is 7 numbers. The ends −1 and 7 are not included.

  12. Solve |x − 1| < |x + 3|.

    Tap your answer.
    1. Yes, that is right. Both sides are moduli, so square them: (x − 1)² < (x + 3)². Expand: x² − 2x + 1 < x² + 6x + 9. The x² terms cancel: −8x < 8. Divide by −8 and turn the sign: x > −1. Check x = 0: |−1| = 1 and |3| = 3, and 1 < 3.

    2. Not this one. You turned the sign round. Square both sides: x² − 2x + 1 < x² + 6x + 9, which gives −8x < 8. Dividing by −8 turns the sign, so x > −1. Go to M5.1.2. Try another.

    3. Not this one. That is the set of x between the two points 1 and −3, which is not what the squares give. The x² terms cancel, leaving one limit, not two. Go to M5.1.2. Try another.

    4. Not this one. You may have dropped the sign of the 8 when moving terms. From −8x < 8, dividing by −8 gives x > −1, not x > 1. Go to M5.1.2. Try another.

    See the answer

    x > −1

    Both sides are moduli, so square them: (x − 1)² < (x + 3)². Expand: x² − 2x + 1 < x² + 6x + 9. The x² terms cancel: −8x < 8. Divide by −8 and turn the sign: x > −1. Check x = 0: |−1| = 1 and |3| = 3, and 1 < 3.

    • If you chose B: You turned the sign round. Square both sides: x² − 2x + 1 < x² + 6x + 9, which gives −8x < 8. Dividing by −8 turns the sign, so x > −1. Go to M5.1.2.
    • If you chose C: That is the set of x between the two points 1 and −3, which is not what the squares give. The x² terms cancel, leaving one limit, not two. Go to M5.1.2.
    • If you chose D: You may have dropped the sign of the 8 when moving terms. From −8x < 8, dividing by −8 gives x > −1, not x > 1. Go to M5.1.2.

Keep it

Copy this into your exercise book.

|x| is the distance from 0. |x − a| < b means a − b < x < a + b. y = |f(x)| folds the part below the x axis upwards. Check every answer to |…| = an expression in x.

Draw: A line crossing the x axis, with the part below it folded up into a V.

Reading with a child? A short page for the adult: what this chapter teaches and three questions to ask.

No internet tomorrow? Save the whole book as one file (881 KB). It opens on any phone.