12.4 Graphs of |f(x)| and f(|x|)
AHL 2.16
- how to sketch \(y = |f(x)|\) from the graph of \(y = f(x)\)
- how to sketch \(y = f(|x|)\) from the graph of \(y = f(x)\)
- how to tell these two graphs apart, and how to use them with points, intercepts and asymptotes
The graph of \(y = |f(x)|\)
Recall that the modulus of a number is its size without its sign: \(|5| = 5\) and \(|-5| = 5\). So
\[ |f(x)| = \begin{cases} f(x) & \text{if } f(x) \ge 0 \\ -f(x) & \text{if } f(x) < 0 . \end{cases} \]
Where the graph of \(y = f(x)\) is on or above the \(x\)-axis, nothing changes. Where it is below the \(x\)-axis, we use \(-f(x)\), which is a reflection in the \(x\)-axis.
To sketch \(y = |f(x)|\)
- Keep the parts of \(y = f(x)\) that are on or above the \(x\)-axis.
- Reflect the parts that are below the \(x\)-axis in the \(x\)-axis.
The graph of \(y = |f(x)|\) is never below the \(x\)-axis. The \(x\)-intercepts do not move. At an \(x\)-intercept where the graph crossed the axis, the new graph usually has a sharp point (a cusp).
Graph transformations are not in the formula booklet.
Example 1 The graph of \(y = f(x)\) has asymptotes \(x = 1\) and \(y = 1\). It crosses the axes at \((-2, 0)\) and \((0, -2)\). Sketch the graph of \(y = |f(x)|\).
Between \(x = -2\) and \(x = 1\) the graph is below the \(x\)-axis. Reflect this part.
- \((-2, 0)\) stays where it is, and the graph has a sharp point there.
- \((0, -2) \to (0, 2)\).
- On the left of \(x = 1\), the graph now goes up to \(+\infty\) (it went down to \(-\infty\) before). So \(x = 1\) is still an asymptote, approached from above on both sides.
- \(y = 1\) is above the \(x\)-axis, so it is still an asymptote.
Example 2 Sketch the graph of \(y = |x^2 - x - 6|\). Label the axis intercepts and the turning point.
First sketch \(y = x^2 - x - 6 = (x + 2)(x - 3)\).
- \(x\)-intercepts: \((-2, 0)\) and \((3, 0)\). \(y\)-intercept: \((0, -6)\).
- Vertex: \(x = \frac{1}{2}\), \(y = \frac{1}{4} - \frac{1}{2} - 6 = -\frac{25}{4}\). So the vertex is \(\left(\frac{1}{2}, -\frac{25}{4}\right)\).
The part between \(x = -2\) and \(x = 3\) is below the axis, so reflect it. The \(y\)-intercept becomes \((0, 6)\) and the vertex becomes a maximum point \(\left(\frac{1}{2}, \frac{25}{4}\right)\).
The graph of \(y = f(|x|)\)
Now the modulus is inside the function. Since \(|x| = x\) for \(x \ge 0\) and \(|x| = -x\) for \(x < 0\),
\[ f(|x|) = \begin{cases} f(x) & \text{if } x \ge 0 \\ f(-x) & \text{if } x < 0 . \end{cases} \]
For \(x \ge 0\) the graph is the same as \(y = f(x)\). For \(x < 0\) it is \(y = f(-x)\), the reflection in the \(y\)-axis of the right-hand part. Also \(f(|-x|) = f(|x|)\), so the graph of \(y = f(|x|)\) is always symmetric about the \(y\)-axis.
To sketch \(y = f(|x|)\)
- Delete the part of \(y = f(x)\) to the left of the \(y\)-axis.
- Keep the part on or to the right of the \(y\)-axis (\(x \ge 0\)).
- Reflect this right-hand part in the \(y\)-axis to make the new left-hand part.
Compare the two rules:
| \(y = \lvert f(x) \rvert\) | \(y = f(\lvert x \rvert)\) | |
|---|---|---|
| Modulus is | outside \(f\) (acts on \(y\)) | inside \(f\) (acts on \(x\)) |
| Keep | the part with \(y \ge 0\) | the part with \(x \ge 0\) |
| Reflect in | the \(x\)-axis | the \(y\)-axis |
| The new graph is | never below the \(x\)-axis | symmetric about the \(y\)-axis |
Example 3 The graph of \(y = f(x)\) has asymptotes \(x = 3\) and \(y = 0\), and crosses the \(y\)-axis at \((0, -2)\). Sketch the graph of \(y = f(|x|)\).
Delete the part with \(x < 0\). Keep the part with \(x \ge 0\): it starts at \((0, -2)\), goes down towards \(x = 3\), and on the right of \(x = 3\) comes down from \(+\infty\) towards \(y = 0\). Reflect this in the \(y\)-axis.
- Vertical asymptotes: \(x = 3\) and its mirror image \(x = -3\).
- Horizontal asymptote: \(y = 0\) on both sides.
- \((0, -2)\) is on the \(y\)-axis, so it stays. It is now a maximum point of the middle part.
Example 4 The graph of \(y = f(x)\) has the asymptotes \(x = -4\) and \(y = 0\). It touches the \(x\)-axis at \(A(-3, 0)\), crosses the \(y\)-axis at \(B(0, 1)\) and has a maximum point \(C(2, 3)\).
Sketch the graph of \(y = f(-|x|)\).
For \(x \le 0\), \(-|x| = x\), so \(f(-|x|) = f(x)\): the graph is the same as \(y = f(x)\) on the left of the \(y\)-axis.
For \(x > 0\), \(-|x| = -x\), so \(f(-|x|) = f(-x)\): the right half is the reflection of the left half in the \(y\)-axis.
So this time we keep the left part and reflect it. The point \(C\) is on the right, so it disappears.
- Asymptotes: \(x = -4\) and \(x = 4\). (The asymptote \(y = 0\) is no longer reached, because the graph only exists for \(-4 < x < 4\).)
- \(A(-3, 0)\) and its mirror image \((3, 0)\): the graph touches the \(x\)-axis at both.
- \(B(0, 1)\) stays, and the graph has a sharp maximum point there.
On a Graphs page, type abs( for the modulus (or choose the \(|\square|\) template from the templates palette). Enter \(f_1(x) = x^2 - x - 6\), then \(f_2(x) = \text{abs}(f_1(x))\) and \(f_3(x) = f_1(\text{abs}(x))\). Compare the three graphs to check your sketches. Use Menu → Analyze Graph → Maximum to find turning points.
Common errors
| ✗ Wrong | ✓ Right | Why |
|---|---|---|
| Treating \(y = f(\lvert x \rvert)\) like \(y = \lvert f(x) \rvert\) | Inside: keep the right half and reflect it in the \(y\)-axis | The position of the modulus decides which axis is used. |
| Reflecting the left half of \(y = f(x)\) to make \(y = f(\lvert x \rvert)\) | Reflect the right half (\(x \ge 0\)) | For \(x \ge 0\), \(f(\lvert x \rvert) = f(x)\) exactly. |
| Drawing a smooth curve at an \(x\)-intercept of \(y = \lvert f(x) \rvert\) | A sharp point (cusp) where the graph crossed the axis | One side is reflected and the other is not. |
| Forgetting the new asymptote in \(y = f(\lvert x \rvert)\) | \(x = 3\) gives \(x = 3\) and \(x = -3\) | The right half is copied, with its asymptote. |
| Under \(y = \lvert f(x) \rvert\), the asymptote \(y = -2\) stays \(y = -2\) | It becomes \(y = 2\) | The part near \(y = -2\) is below the axis, so it is reflected. |
Exercises
1 Sketch the graph of \(y = |2x - 3|\). Give the coordinates of the vertex and the \(y\)-intercept.
\(y = 2x - 3\) is a line through \((0, -3)\) and \(\left(\frac{3}{2}, 0\right)\). Reflect the part with \(x < \frac{3}{2}\).
The graph is a V shape with vertex \(\left(\frac{3}{2}, 0\right)\) and \(y\)-intercept \((0, 3)\).
2 Sketch \(y = |x^2 - 4x|\). Give the axis intercepts and the coordinates of the maximum point between them.
\(x^2 - 4x = x(x - 4)\) has roots \(0\) and \(4\) and vertex \((2, -4)\). The part between \(0\) and \(4\) is reflected.
Intercepts \((0, 0)\) and \((4, 0)\); local maximum point \((2, 4)\).
3 Sketch \(y = |\ln x|\). State the asymptote and the \(x\)-intercept, and say which part of \(y = \ln x\) is reflected.
\(\ln x < 0\) for \(0 < x < 1\), so this part is reflected in the \(x\)-axis. The graph touches the \(x\)-axis at \((1, 0)\) with a sharp point, and has the asymptote \(x = 0\) (it goes up to \(+\infty\) as \(x \to 0^+\)).
4 Let \(f(x) = x^2 - 4x\). Sketch \(y = f(|x|)\). Give the axis intercepts and the minimum points.
For \(x \ge 0\): \(y = x^2 - 4x\) with roots \(0\), \(4\) and minimum \((2, -4)\). Reflect this in the \(y\)-axis.
Intercepts \((-4, 0)\), \((0, 0)\), \((4, 0)\). Minimum points \((-2, -4)\) and \((2, -4)\). (There is a local maximum at \((0, 0)\).)
5 Let \(f(x) = 2x - 1\). Sketch \(y = f(|x|)\) and find its axis intercepts.
\(f(|x|) = 2|x| - 1\). For \(x \ge 0\) it is the line \(y = 2x - 1\); the left half is its mirror image.
V shape with vertex \((0, -1)\), \(x\)-intercepts \(\left(\pm \frac{1}{2}, 0\right)\).
6 The graph of \(y = f(x)\) crosses the \(x\)-axis at \((-3, 0)\) and \((1, 0)\), crosses the \(y\)-axis at \((0, -1)\), has a minimum point \((-1, -2)\) and a maximum point \((2, 3)\). Write down the axis intercepts and the turning points of
(a) \(y = |f(x)|\) \(\qquad\) (b) \(y = f(|x|)\)
(a) Intercepts \((-3, 0)\), \((1, 0)\) and \((0, 1)\). The minimum \((-1, -2)\) becomes a maximum \((-1, 2)\); the maximum \((2, 3)\) stays.
(b) Keep \(x \ge 0\) and reflect: intercepts \((-1, 0)\), \((1, 0)\) and \((0, -1)\); maximum points \((-2, 3)\) and \((2, 3)\). The points \((-3, 0)\) and \((-1, -2)\) are deleted.
7 Use the graph in Example 2 to explain why the equation \(|x^2 - x - 6| = 6\) has four solutions. Find them.
The maximum of the middle part is \(\frac{25}{4} > 6\), so the line \(y = 6\) meets the graph four times.
\(x^2 - x - 6 = 6 \Rightarrow x^2 - x - 12 = 0 \Rightarrow (x - 4)(x + 3) = 0 \Rightarrow x = 4\) or \(x = -3\).
\(x^2 - x - 6 = -6 \Rightarrow x^2 - x = 0 \Rightarrow x = 0\) or \(x = 1\).
Solutions: \(x = -3, 0, 1, 4\).
8 Sketch \(y = \left|\dfrac{1}{x + 2} - 1\right|\). State the asymptotes and the axis intercepts.
First \(y = \frac{1}{x + 2} - 1\): asymptotes \(x = -2\), \(y = -1\). \(x\)-intercept: \(\frac{1}{x + 2} = 1 \Rightarrow x = -1\). \(y\)-intercept: \(\frac{1}{2} - 1 = -\frac{1}{2}\).
After reflecting the negative parts: asymptotes \(x = -2\) and \(y = 1\), intercepts \((-1, 0)\) and \(\left(0, \frac{1}{2}\right)\).
9 Using the graph of \(y = |x^2 - x - 6|\), find the values of \(k\) for which the equation \(|x^2 - x - 6| = k\) has
(a) exactly three solutions, \(\qquad\) (b) exactly four solutions.
(a) The line \(y = k\) must pass through the maximum point \(\left(\frac{1}{2}, \frac{25}{4}\right)\): \(k = \dfrac{25}{4}\).
(b) The line must cut the middle hump twice and each outer branch once: \(0 < k < \dfrac{25}{4}\).
10 Let \(f(x) = x^3 - 3x\). The graph of \(y = f(x)\) has a maximum point \((-1, 2)\) and a minimum point \((1, -2)\). Sketch \(y = f(|x|)\), and find its axis intercepts and minimum points.
For \(x \ge 0\): \(f(x) = x(x^2 - 3)\) has roots \(0\) and \(\sqrt{3}\), and the minimum point \((1, -2)\). The maximum \((-1, 2)\) is deleted.
Reflect in the \(y\)-axis: intercepts \((-\sqrt{3}, 0)\), \((0, 0)\), \((\sqrt{3}, 0)\); minimum points \((-1, -2)\) and \((1, -2)\).