Mathematics/Lessons/Functions and Graphs/Sketching y = |f(x)| and y = f(|x|)
Pure · Functions and Graphs · Year 2

Sketching y = |f(x)| and y = f(|x|)

Two different ways to fold a graph around an axis — reflect the dips upward, or throw away one half and mirror the other.

10 min read 3 worked examples

The modulus function lesson looked only at linear graphs $y=|ax+b|$, which always fold into a V-shape. The same "reflect what's negative" idea works for any function $f(x)$ — and there's a second, quite different way to fold a graph using $|x|$ that's worth knowing separately.

Sketching y = |f(x)|

For $y=|f(x)|$: wherever $f(x)\ge0$, the graph of $y=|f(x)|$ is identical to $y=f(x)$. Wherever $f(x)<0$, that portion is reflected in the x-axis (flipped upward), since the modulus can never output a negative value. The result never dips below the x-axis.

A quick method

Sketch $y=f(x)$ first. Identify any parts of the curve that lie below the x-axis, and reflect only those parts upward, leaving everything already on or above the axis untouched.

Graph of y equals the modulus of x squared minus 4. The original curve y = x squared minus 4 is shown dashed where it dips below the x-axis between x = -2 and x = 2. The final solid curve follows the outer arms of the parabola unchanged, but between x = -2 and x = 2 it is the reflected arc 4 minus x squared, forming a smooth hump that touches the x-axis at (-2, 0) and (2, 0) and reaches a local maximum of (0, 4).
$y=|x^2-4|$: the outer arms of $y=x^2-4$ are unchanged, but the dip between $x=-2$ and $x=2$ (dashed) is reflected upward into a hump touching the axis at $(-2,0)$ and $(2,0)$, peaking at $(0,4)$.

Notice that the points where $y=f(x)$ touches or crosses the x-axis are unaffected by the reflection, since $|0|=0$ — every root of $f$ is a root of $|f(x)|$ too. A root where $f$ crosses the axis becomes a point where $|f(x)|$ only touches it, since the graph can't carry on below.

Sketching y = f(|x|)

For $y=f(|x|)$: for $x\ge0$, $|x|=x$, so the graph is identical to $y=f(x)$ — completely unchanged. For $x<0$, $|x|=-x$, so $y=f(|x|)=f(-x)$: the graph for negative $x$ is the reflection, in the y-axis, of the graph for positive $x$. Whatever $y=f(x)$ originally did for $x<0$ is discarded entirely and replaced by this mirror image.

A quick method

Sketch $y=f(x)$, but keep only the part for $x\ge0$ and delete everything to the left of the y-axis. Then reflect the kept part in the y-axis to create the new left-hand half. The result is always symmetric about the y-axis — an even function — no matter what the original graph looked like for $x<0$.

Graph of y equals f of the modulus of x, for f(x) = x squared minus 4x plus 3. The original curve y = f(x) is shown dashed for x less than 0. The final solid curve keeps the original branch for x greater than or equal to 0, passing through (1,0), (2,-1) and (3,0), and mirrors it in the y-axis to form a matching left-hand branch through (-1,0), (-2,-1) and (-3,0), meeting at (0,3).
$y=f(|x|)$ for $f(x)=x^2-4x+3$: the branch for $x\ge0$ (through $(1,0)$, $(2,-1)$, $(3,0)$) is kept unchanged; the original branch for $x<0$ (dashed) is discarded and replaced with its mirror image, meeting at $(0,3)$.

Because $y=|f(x)|$ and $y=f(|x|)$ transform a graph in genuinely different ways, they generally give different results for the same $f$ — the only exception is when $f$ is already an even function and already non-negative everywhere, in which case both transformations leave it unchanged.

Worked example 1

Sketching y = |f(x)| for a quadratic
$f(x)=x^2-4x+3$. Describe the graph of $y=|f(x)|$, stating the coordinates of any points where it meets the x-axis and any local maximum.
MethodFind where f(x) is negative, then reflect only that portion
1
$f(x)=x^2-4x+3=(x-1)(x-3)$ has roots at $x=1$ and $x=3$, and vertex $(2,-1)$ (a minimum, since the parabola opens upward).
Factorise to find the roots; complete the square, or use symmetry, for the vertex.
2
$f(x)<0$ only between the roots, for $1<x<3$ (where the parabola dips below the axis).
A upward parabola is negative strictly between its two roots.
3
For $x\le1$ or $x\ge3$, $y=|f(x)|=f(x)$, unchanged. For $1<x<3$, reflect: $y=-(x^2-4x+3)=-x^2+4x-3$.
Apply the reflection rule only where f(x) is negative.
4
The reflected arc still touches zero at $x=1$ and $x=3$, and its maximum sits directly above the original vertex: at $x=2$, $|f(2)|=|-1|=1$.
Reflecting (2,-1) in the x-axis gives (2,1).
5
So $y=|f(x)|$ touches the x-axis at $(1,0)$ and $(3,0)$, with a local maximum at $(2,1)$ between them.
Combine the unchanged outer arms with the reflected middle hump.
▪ solved
Compare and contrast

This is the same $f(x)=x^2-4x+3$ used in the $y=f(|x|)$ diagram above — but the two transformations produce completely different graphs. $|f(x)|$ keeps the shape for $x<1$ and $x>3$ and only touches up the middle; $f(|x|)$ throws away everything for $x<0$ and mirrors the right-hand branch instead.

Worked example 2

Solving an equation using the y = f(|x|) sketch
Using the sketch of $y=f(|x|)$ above (for $f(x)=x^2-4x+3$), solve $f(|x|)=0$.
MethodRead the x-intercepts directly off the sketch, or substitute u = |x| and solve algebraically
1
From the sketch, $y=f(|x|)$ crosses the x-axis at $x=-3,-1,1,3$ — four intercepts, symmetric about the y-axis.
Read the roots directly from the graph.
2
Algebraically: let $u=|x|\ge0$, so the equation becomes $u^2-4u+3=0 \Rightarrow (u-1)(u-3)=0 \Rightarrow u=1$ or $u=3$.
Substituting u = |x| turns f(|x|) = 0 into an ordinary quadratic in u.
3
Since $u=|x|$, each positive value of $u$ gives two values of $x$: $u=1 \Rightarrow x=\pm1$; $u=3 \Rightarrow x=\pm3$.
|x| = k has solutions x = k and x = -k for any k > 0.
4
So $x=-3,-1,1,3$ — matching the sketch exactly.
Confirms the graphical and algebraic methods agree.
▪ solved

Worked example 3

Solving an equation using the y = |f(x)| sketch · Challenge
Using the sketch of $y=|f(x)|$ above (for $f(x)=x^2-4$), solve $|x^2-4|=2$.
MethodSplit into two cases, since removing a modulus from an equation gives two possibilities
1
$|x^2-4|=2$ means either $x^2-4=2$ or $x^2-4=-2$.
|A| = k (for k > 0) splits into A = k or A = -k.
2
Case 1: $x^2-4=2 \Rightarrow x^2=6 \Rightarrow x=\pm\sqrt6$.
These lie outside [-2, 2], where |f(x)| = f(x) unreflected — consistent, since f(±√6) = 2 > 0 there already.
3
Case 2: $x^2-4=-2 \Rightarrow x^2=2 \Rightarrow x=\pm\sqrt2$.
These lie inside (-2, 2), where the reflected branch 4 - x² is used; check: 4 - 2 = 2. ✓
4
So the full solution set is $x=\pm\sqrt6, \pm\sqrt2$ — four solutions, matching a horizontal line $y=2$ crossing the sketch four times.
Combine both cases; the sketch confirms the count before any algebra is needed.
▪ solved
Look deeper

Sketching $y=|f(x)|$ first — even roughly — tells you how many solutions to expect and which case each one belongs to, exactly as with the linear modulus equations from the previous lesson. The technique doesn't change for a quadratic (or any) $f$; only the algebra inside each case gets a little more involved.

Common mistake

Sketching $y=f(|x|)$ by reflecting the entire original graph in the y-axis, rather than first discarding everything for $x<0$ and mirroring only the $x\ge0$ branch. If $f$ isn't already symmetric, reflecting the whole thing keeps the wrong left-hand half instead of replacing it.

Check yourself

$f(x)=x^2-9$. State the coordinates of the two points where $y=|f(x)|$ touches the x-axis, and the coordinates of its local maximum.
(Hint: find the roots of f(x) first, then reflect the dip between them.)

Method
1
$f(x)=x^2-9=(x-3)(x+3)$ has roots at $x=-3$ and $x=3$, and vertex $(0,-9)$.
Factorise to find the roots.
2
$y=|f(x)|$ touches the x-axis at $(-3,0)$ and $(3,0)$ — the roots are unaffected by the reflection.
|0| = 0, so roots are always preserved.
3
Local maximum at $x=0$: $|f(0)|=|-9|=9$, so the local maximum is $(0,9)$.
Reflect the vertex (0,-9) in the x-axis.
▪ solved