The Graph of y = |x|

Two straight rays meeting in a V.

Plot the values

The absolute value |x|, also called the modulus of x, is the distance of x from zero. It is never negative: |3| = 3, and |−3| = 3 as well, because −3 is also 3 away from zero.

To draw y = |x|, work out a few values. At x = −3, −2, −1, 0, 1, 2 and 3, the values of y are 3, 2, 1, 0, 1, 2 and 3. Plot these points and join them, and they make a V: two straight rays that meet at the origin. The point where they meet is the corner of the V, and it is the lowest point on the graph, because |x| is never less than 0.

xy

y = |x| through the points from x = −3 to x = 3: two straight rays that meet at the origin.

Two straight rays

Each ray is part of a straight line. For x ≥ 0 the modulus changes nothing, so |x| = x, and the right-hand ray is part of the line y = x, with gradient 1.

For x < 0 the modulus removes the minus sign, and that is the same as multiplying x by −1. For example, |−3| = −(−3) = 3. So for negative x, |x| = −x, and the left-hand ray is part of the line y = −x, with gradient −1. Where the line y = x would have gone below the axis, on the left, the modulus sends it back up.

Since |−x| = |x|, the height of the graph at −3 is the same as at 3, so the V is symmetric in the y-axis.

xy

The gold V is y = |x|, and its right-hand ray lies on the line y = x. The white line is the rest of y = x, below the axis on the left. The modulus sends it back up, onto the left-hand ray, which lies on y = −x.

Moving the corner

Now draw y = |x − 2|. The bars are around x − 2, so work out x − 2 first and then take its size. At x = 0, y = |0 − 2| = |−2| = 2. At x = 1, y = 1. At x = 2, y = |0| = 0. At x = 3, y = 1, and at x = 4, y = 2.

This is the same V, moved 2 to the right. Its corner is at (2, 0), because x = 2 is where the inside, x − 2, is zero. The corner is at +2 even though a minus sign is written before the 2: |x − 2| is the distance between x and 2, and that distance is zero at x = 2.

In the same way, y = |x + 3| has its corner where x + 3 = 0, which is at x = −3, so its V is the graph of y = |x| moved 3 to the left.

xy(2, 0)

The gold V is y = |x − 2|, with its corner at (2, 0). The white V is y = |x|: the gold one is the same shape moved 2 to the right.

A steeper V

Take y = |2x − 4|. The inside, 2x − 4, is zero when x = 2, so this graph also has its corner at (2, 0).

To the right of the corner, 2x − 4 is positive, so the graph is the line y = 2x − 4, with gradient 2. To the left, 2x − 4 is negative, so the modulus changes its sign, and the graph is y = −(2x − 4) = 4 − 2x, with gradient −2. Each arm is twice as steep as an arm of y = |x − 2|.

Check with the values at x = 3. There y = |2 × 3 − 4| = 2, while |3 − 2| = 1. One step from the corner, the new graph has climbed 2 and the old one only 1. In fact |2x − 4| = |2(x − 2)| = 2|x − 2|, so every height is doubled.

xy

The gold V is y = |2x − 4| and the white V is y = |x − 2|. Both turn at (2, 0), and at x = 3 the gold one is at 2 while the white one is at 1.

Finding the corner

When the bars hold a linear expression, such as 2x − 4 or x + 3, the corner of the V is always where that expression is zero. So to find the corner, set the inside equal to zero and solve.

For y = |2x + 6|, solve 2x + 6 = 0: subtract 6 from both sides to get 2x = −6, then divide by 2 to get x = −3. The corner is at (−3, 0). To finish the sketch, find where the graph crosses the y-axis: at x = 0, y = |6| = 6. The arms have gradients 2 and −2.

xy

y = |2x + 6| turns at (−3, 0), where 2x + 6 = 0, and crosses the y-axis at (0, 6).

The usual mistakes

Putting the corner of y = |x − 3| at x = −3. There the inside is −3 − 3 = −6, so y = 6, not 0. The corner is at x = 3, where the inside is zero.

Taking the point where the graph crosses the y-axis for the corner. For y = |x − 3| that point is (0, 3). The corner is the lowest point, and it is on the x-axis, at (3, 0).

Forgetting the bars when working out a value. For y = |x − 7| at x = 3, the subtraction gives 3 − 7 = −4, and the bars make it 4. A modulus graph never goes below the x-axis.

Reading the number inside the bars as the corner. For y = |5x − 10|, the corner is not at 10: solve 5x − 10 = 0 to get x = 2.

Worked example: Places Within a Given Distance of a Depot on a Straight Road

Question Markers along a straight road show the distance in km from the start of the road. A delivery depot stands at the 12 km marker. For a place at the x km marker, y is its distance from the depot in km. (a) Write y in terms of x, and find the markers that are exactly 5 km from the depot. (b) The depot delivers free of charge to any place within 5 km. Four shops stand at the 4 km, 9 km, 15 km and 18 km markers. Which of them have free delivery?

  1. 1.The distance between marker x and the depot at marker 12 is the difference between the two numbers, taken as positive: y = |x − 12|. The graph is a V with its lowest point at (12, 0).

    02468101204812162024marker on the road (km), xdistance from the depot (km), ydepotdistance between marker x and marker 12:y = |x − 12|, a V with its point at (12, 0)
    02468101204812162024marker on the road (km), xdistance from the depot (km), ydepotdistance between marker x and marker 12:y = |x − 12|, a V with its point at (12, 0)
    The distance between marker x and the depot at marker 12 is the difference taken as positive, y = |x − 12|. Its graph is a V with its point at (12, 0).
  2. 2.To the left of the depot, where x < 12, the graph is the line y = 12 − x. To the right, where x > 12, it is the line y = x − 12. A place exactly 5 km away is a point where the V meets the horizontal line y = 5.

    02468101204812162024marker on the road (km), xdistance from the depot (km), ydepoty = 5y = 12 − xy = x − 12left of the depot: y = 12 − xright of the depot: y = x − 12exactly 5 km away: where the V meets y = 5
    02468101204812162024marker on the road (km), xdistance from the depot (km), ydepoty = 5y = 12 − xy = x − 12left of the depot: y = 12 − xright of the depot: y = x − 12exactly 5 km away: where the V meets y = 5
    To the left of the depot the graph is y = 12 − x, and to the right it is y = x − 12. A place exactly 5 km away is where the V meets the line y = 5.
  3. 3.On the left, 12 − x = 5 gives x = 7. On the right, x − 12 = 5 gives x = 17. (a) y = |x − 12|, and the 7 km and 17 km markers are exactly 5 km from the depot.

    02468101204812162024marker on the road (km), xdistance from the depot (km), ydepoty = 5(7, 5)(17, 5)12 − x = 5, so x = 7x − 12 = 5, so x = 17
    02468101204812162024marker on the road (km), xdistance from the depot (km), ydepoty = 5(7, 5)(17, 5)12 − x = 5, so x = 7x − 12 = 5, so x = 17
    (a) 12 − x = 5 gives x = 7, and x − 12 = 5 gives x = 17: the 7 km and 17 km markers.
  4. 4.A place is within 5 km of the depot where the V is on or below the line y = 5. That is the part of the road with 7 ≤ x ≤ 17.

    02468101204812162024marker on the road (km), xdistance from the depot (km), yy = 5(7, 5)(17, 5)7 ≤ x ≤ 17within 5 km: where the V is on or below y = 57 ≤ x ≤ 17
    02468101204812162024marker on the road (km), xdistance from the depot (km), yy = 5(7, 5)(17, 5)7 ≤ x ≤ 17within 5 km: where the V is on or below y = 57 ≤ x ≤ 17
    A place is within 5 km where the V is on or below the line y = 5, which is 7 ≤ x ≤ 17.
  5. 5.The heights of the V at the four shops are |4 − 12| = 8, |9 − 12| = 3, |15 − 12| = 3 and |18 − 12| = 6. (b) Only the shops at the 9 km and 15 km markers are within 5 km, so these two have free delivery.

    02468101204812162024marker on the road (km), xdistance from the depot (km), yy = 58336|4 − 12| = 8, |9 − 12| = 3, |15 − 12| = 3, |18 − 12| = 6the shops at markers 9 and 15 are within 5 km
    02468101204812162024marker on the road (km), xdistance from the depot (km), yy = 58336|4 − 12| = 8, |9 − 12| = 3, |15 − 12| = 3, |18 − 12| = 6the shops at markers 9 and 15 are within 5 km
    (b) The heights of the V at 4, 9, 15 and 18 are 8, 3, 3 and 6. Only the shops at the 9 km and 15 km markers are within 5 km.

Answer: (a) y = |x − 12|, and the 7 km and 17 km markers; (b) the shops at the 9 km and 15 km markers

Common mistakes

  • Solving only x − 12 = 5 and giving the 17 km marker alone. The V has two arms, because a place can be 5 km from the depot on either side of it. The left arm, 12 − x = 5, gives the 7 km marker.
  • Writing the distance as x − 12 without the modulus. For the shop at the 4 km marker this gives −8, and a distance cannot be negative. The modulus makes the distance 8 km.

More graphs of equations problems, worked step by step →

Practice The Graph of y = |x| in the app