Replacing x with a Modulus

The right-hand half is copied across.

Start with the right-hand half

Take the curve y = x² − 4x and draw only the part where x is 0 or more. At x = 0, 1, 2, 3 and 4 the values of y are 0, −3, −4, −3 and 0. The curve starts at the origin, dips to its lowest point at (2, −4), and comes back up to the x-axis at x = 4. After that it keeps climbing: at x = 5, y = 25 − 20 = 5.

xy

y = x² − 4x for x ≥ 0: from the origin down to (2, −4), back to the axis at x = 4, and up again.

Put |x| in place of x

Now replace x by |x| in the equation. The term x² needs no bars, because |x|² = x² for every x, so the new equation is y = x² − 4|x|. The bars act on x before anything else is worked out.

For x ≥ 0, |x| = x, so nothing changes on the right: y = x² − 4|x| gives exactly the same values as y = x² − 4x.

For a negative x the bars make a difference. At x = −3, |−3| = 3, so y = 9 − 4 × 3 = 9 − 12 = −3, which is exactly the value at x = 3. Every negative x is turned into its positive partner before the rest of the calculation, so it gives the same y. Without the bars, x² − 4x at x = −3 would be 9 + 12 = 21.

x² − 4xx² − 4|x|x = −321−3x = −212−4x = −15−3x = 000x = 1−3−3x = 2−4−4x = 3−3−3

For x ≥ 0 the two columns agree. For x < 0 the second column repeats the values at 1, 2 and 3.

Mirror the right half

So the graph of y = x² − 4|x| keeps the right-hand half of y = x² − 4x and throws the left-hand half away. In its place goes the mirror image of the right-hand half, reflected in the y-axis.

The result is symmetric in the y-axis, shaped like a W: it has two lowest points, at (−2, −4) and (2, −4), and it crosses the x-axis at x = −4, 0 and 4. Any graph made by replacing x with |x| is symmetric in the y-axis, because x and −x have the same modulus and so give the same y.

xy

The gold graph is y = x² − 4|x|. The white curve is the left-hand half of y = x² − 4x, which climbs away. The bars throw it away and put the mirror image of the right-hand half in its place.

Two kinds of bars, two pictures

Bars around the whole expression and bars around x alone do different things. y = |x² − 4x| reflects the part of the curve below the x-axis up above it, in the x-axis. y = x² − 4|x| keeps the right-hand half and mirrors it in the y-axis.

Compare the values. At x = 2, |x² − 4x| = |4 − 8| = 4, but x² − 4|x| = 4 − 8 = −4. At x = −1, |x² − 4x| = |1 + 4| = 5, but x² − 4|x| = 1 − 4 = −3.

xy

The gold graph is y = x² − 4|x|, made by mirroring in the y-axis. The white graph is y = |x² − 4x|, made by reflecting in the x-axis. Both start from y = x² − 4x, and for x ≥ 4 they are the same curve.

Where the bars sit

The two operations can both start from the straight line y = x − 2.

Replace x with |x| and you get y = |x| − 2. The right-hand half of the line is kept and mirrored in the y-axis, so the graph is a V with its corner on the y-axis, at (0, −2). At x = 0, |x| is 0, its smallest value, so y is −2.

Put the bars around the whole expression and you get y = |x − 2|. The part of the line below the x-axis is reflected up, so the graph is a V with its corner on the x-axis, at (2, 0), where x − 2 = 0.

For x ≥ 2 the line is to the right of the y-axis and on or above the x-axis, so neither operation changes it there, and the two graphs share the same ray. Everywhere to the left of 2 they are different.

xy

The gold V is y = |x| − 2, with its corner at (0, −2). The white V is y = |x − 2|, with its corner at (2, 0). From x = 2 onward the two are the same ray, drawn once.

The usual mistakes

Putting the negative number in without the bars. For y = x² − 4|x| at x = −3, (−3)² − 4 × (−3) = 9 + 12 = 21 is wrong. The bars make |−3| = 3 first, so y = 9 − 12 = −3.

Changing the sign of the whole answer. Only the x inside the bars loses its sign. At x = −3, y is −3, the same as at x = 3, and not 3.

Putting the corner of y = |x| − 2 at (2, 0). That is the corner of y = |x − 2|. In y = |x| − 2 the bars hold x alone, so the corner stays at x = 0, and subtracting 2 moves it down to (0, −2), not up to (0, 2).

Worked example: A Pavilion Roof Drawn from Its Right-Hand Slope, and a Collar Beam Across It

Question The cross-section of a pavilion roof is drawn with the x-axis along the level of the eaves and the y-axis through the ridge, with x and y in meters. The architect gives the right-hand slope of the roof as y = (x − 8)216 for 0 ≤ x ≤ 8, and the left-hand slope is its mirror image in the y-axis. (a) Write one equation for the whole roof line, and find the height of the roof above the eaves at x = −4. (b) A horizontal collar beam joins the two slopes at a height of 2.25 m above the eaves. How long is the beam?

  1. 1.The height at x = −4 must equal the height at x = 4, and replacing x by |x| does exactly this, since |−4| = |4| = 4. The whole roof line is y = (|x| − 8)216 for −8 ≤ x ≤ 8.

    012345−8−4048meters from the ridge, xheight above the eaves (m), ygivenmirrorgiven, right slope: y = (x − 8)2/16left slope: its mirror, y = (x + 8)2/16
    012345−8−4048meters from the ridge, xheight above the eaves (m), ygivenmirrorgiven, right slope: y = (x − 8)2/16left slope: its mirror, y = (x + 8)2/16
    The formula draws the right-hand slope. The left-hand slope is its mirror image, and replacing x by |x| gives both at once: y = (|x| − 8)216 for −8 ≤ x ≤ 8.
  2. 2.At the ridge x = 0, so y = (0 − 8)216 = 6416 = 4: the ridge is 4 m above the eaves. At each eave |x| = 8, so y = 0.

    012345−8−4048meters from the ridge, xheight above the eaves (m), yridge (0, 4)ridge, x = 0: y = 64/16 = 4 meaves, x = 8 and x = −8: y = 0
    012345−8−4048meters from the ridge, xheight above the eaves (m), yridge (0, 4)ridge, x = 0: y = 64/16 = 4 meaves, x = 8 and x = −8: y = 0
    At the ridge x = 0 and y = 6416 = 4, so the ridge is 4 m above the eaves. At each eave |x| = 8 and y = 0.
  3. 3.At x = −4, |x| = 4, so y = (4 − 8)216 = 1616 = 1. (a) The roof line is y = (|x| − 8)216 for −8 ≤ x ≤ 8, and the roof is 1 m above the eaves at x = −4.

    012345−8−4048meters from the ridge, xheight above the eaves (m), y1 m1 mx = −4 is 4 m from the ridge, like x = 4y = (4 − 8)2/16 = 16/16 = 1 m
    012345−8−4048meters from the ridge, xheight above the eaves (m), y1 m1 mx = −4 is 4 m from the ridge, like x = 4y = (4 − 8)2/16 = 16/16 = 1 m
    (a) At x = −4, |x| = 4 and y = (4 − 8)216 = 1: the roof is 1 m above the eaves, just as it is at x = 4.
  4. 4.The beam meets the right-hand slope where (x − 8)216 = 2.25. Multiply both sides by 16: (x − 8)2 = 36, so x − 8 = 6 or x − 8 = −6, which gives x = 14 or x = 2.

    012345−8−4048meters from the ridge, xheight above the eaves (m), yy = 2.25right slope: (x − 8)2/16 = 2.25, so (x − 8)2= 36x − 8 = 6 or −6: x = 14 or x = 2
    012345−8−4048meters from the ridge, xheight above the eaves (m), yy = 2.25right slope: (x − 8)2/16 = 2.25, so (x − 8)2= 36x − 8 = 6 or −6: x = 14 or x = 2
    The beam at y = 2.25 meets the right-hand slope where (x − 8)2 = 36, so x = 14 or x = 2.
  5. 5.The right-hand slope runs only from x = 0 to x = 8, so x = 14 is rejected: it lies beyond the eaves, where there is no roof. The beam meets the right-hand slope at x = 2, and its mirror image puts the other end on the left-hand slope at x = −2.

    012345−8−4048meters from the ridge, xheight above the eaves (m), yy = 2.25x = 2x = −2x = 14 is beyond the eaves at x = 8: rejectedx = 2, and its mirror x = −2
    012345−8−4048meters from the ridge, xheight above the eaves (m), yy = 2.25x = 2x = −2x = 14 is beyond the eaves at x = 8: rejectedx = 2, and its mirror x = −2
    The slope ends at the eaves, x = 8, so x = 14 is rejected. The mirror image of the end at x = 2 is the end at x = −2.
  6. 6.(b) The beam runs from x = −2 to x = 2, so it is 2 − (−2) = 4 m long. Check: at x = −2, y = (2 − 8)216 = 3616 = 2.25.

    012345−8−4048meters from the ridge, xheight above the eaves (m), y4 mthe beam: 2 − (−2) = 4 mcheck: (2 − 8)2/16 = 36/16 = 2.25
    012345−8−4048meters from the ridge, xheight above the eaves (m), y4 mthe beam: 2 − (−2) = 4 mcheck: (2 − 8)2/16 = 36/16 = 2.25
    (b) The beam runs from x = −2 to x = 2, so it is 4 m long.

Answer: (a) y = (|x| − 8)216 for −8 ≤ x ≤ 8, and 1 m; (b) 4 m

Common mistakes

  • Putting x = −4 straight into y = (x − 8)216, which gives 14416 = 9 m. That formula describes only the right-hand slope, and carried on to the left it keeps rising, far above the 4 m ridge. The left-hand slope uses the distance from the ridge, |x| = 4, which gives 1 m.
  • Giving the length of the beam as 2 m, from the one end found on the right-hand slope. The beam reaches from one slope to the other, and the mirror image puts its other end at x = −2, so it is 4 m long.

More graphs of equations problems, worked step by step →

Practice Replacing x with a Modulus in the app