The same function and the same modulus give two different graphs, because the order matters. In \(|f(x)|\) the modulus is outside: it acts on the output \(y\), so every part of the graph below the \(x\)-axis turns over it. In \(f(|x|)\) the modulus is inside: it acts on the input \(x\), so the left half is thrown away and the right half is mirrored in the \(y\)-axis.
Modulus outside
\(|f(x)|\): first find \(f(x)\), then take its modulus.
A height \(y \ge 0\) stays; a height \(y < 0\) becomes \(-y\). The graph never goes below the \(x\)-axis.
Modulus inside
\(f(|x|)\): first take \(|x|\), then put it into \(f\).
For \(x \ge 0\) nothing changes. At \(x = -a\) the graph takes the height of \(f\) at \(+a\), so it is symmetric about the \(y\)-axis.
Modulus outside: \(|f(x)|\) turns over the \(x\)-axis
Take \(f(x) = x^2 - 2x - 3 = (x + 1)(x - 3)\). Its graph cuts the \(x\)-axis at \(-1\) and \(3\), lies below the \(x\)-axis between them, and its lowest point is \((1, -4)\).
At \(x = 1\), \(|f(1)| = |-4| = 4\), so the point \((1, -4)\) goes to \((1, 4)\). The same happens to every point below the \(x\)-axis: the whole part from \(-1\) to \(3\) turns over the \(x\)-axis, like a page. The parts already above the \(x\)-axis do not change.

Modulus inside: \(f(|x|)\) mirrors the right half
For \(x \ge 0\), \(|x| = x\), so \(f(|x|) = f(x)\): the right half stays.
For a negative \(x\), say \(x = -2\): \(f(|-2|) = f(2) = -3\). The point at \(x = -2\) takes the height of \(f\) at \(x = 2\), so \((2, -3)\) is copied to \((-2, -3)\). The old value \(f(-2) = 5\) is never used. The whole right half is mirrored in the \(y\)-axis, and the old left half is thrown away.

Careful
Never keep the old left part of \(f\) when you draw \(f(|x|)\). Here \(f\) has a root at \(-1\), but \(f(|-1|) = f(1) = -4\), not \(0\): that root is lost. The roots of \(f(|x|)\) are \(\pm a\) for each root \(a \ge 0\) of \(f\); here only \(3\), so the roots are \(-3\) and \(3\).
Solved example
Find the number of real solutions of \(|x^2 - 4|x| + 3| = 1\).
Write it with \(g\). \(x^2 = |x|^2\), so \(x^2 - 4|x| + 3 = g(|x|)\) with \(g(x) = x^2 - 4x + 3 = (x - 1)(x - 3)\).
Inside first, then outside. Keep the right half of \(g\) (roots \(1\) and \(3\), lowest point \((2, -1)\)) and mirror it in the \(y\)-axis. Then turn every part below the \(x\)-axis upwards: the two dips become humps of height \(1\), with tops at \(x = -2\) and \(x = 2\).

Count. The line \(y = 1\) touches the two tops and cuts the graph at four more points. By algebra: \(g(|x|) = 1\) gives \(|x| = 2 \pm \sqrt{2}\) (four values of \(x\)), and \(g(|x|) = -1\) gives \(|x| = 2\) (two values).
six real solutions
Key formulas
\[ |f(x)| = \begin{cases} f(x), & f(x) \ge 0\\[0pt] -f(x), & f(x) < 0 \end{cases} \qquad\qquad f(|x|) = \begin{cases} f(x), & x \ge 0\\[0pt] f(-x), & x < 0 \end{cases} \]
\(|f(x)| \ge 0\) for every \(x\). \(f(|x|)\) is symmetric about the \(y\)-axis: \(f(|-x|) = f(|x|)\).
Practice set
Easy to hard. For each, ask first: is the modulus outside or inside? Try each one before you open its answer.
Quiz from the Short. \(f(x) = (x + 2)(x - 4)\). What are the roots of \(f(|x|)\)?
(A) \(-2\) and \(4\) (B) \(-4\) and \(4\) (C) \(-4, -2, 2, 4\).Show answer
(B) \(-4\) and \(4\). \(f(|x|) = 0\) means \(|x| = -2\) or \(|x| = 4\). \(|x| = -2\) has no solution, so \(x = -4\) or \(4\). (A) keeps the roots of \(f\) itself: \(-2\) belongs to the old left part, which is thrown away. (C) mirrors both roots, but \(|x|\) is never \(-2\).
For \(f(x) = x^2 - 2x - 3\), find \(|f(1)|\) and \(f(|-1|)\).
Show answer
\(|f(1)| = 4\), \(f(|-1|) = -4\). \(f(1) = 1 - 2 - 3 = -4\), so \(|f(1)| = 4\). \(|-1| = 1\), so \(f(|-1|) = f(1) = -4\): outside the modulus acts on the value, inside it acts on \(x\).
How many times does the graph of \(y = |x^2 - 2x - 3|\) meet the line \(y = 2\)?
Show answer
\(4\) times. \(|f(x)| = 2\) means \(f(x) = 2\) or \(f(x) = -2\). \(x^2 - 2x - 5 = 0\) gives \(x = 1 \pm \sqrt{6}\); \(x^2 - 2x - 1 = 0\) gives \(x = 1 \pm \sqrt{2}\), both between \(-1\) and \(3\), on the turned hump.
How many real roots does \(x^2 - 2|x| - 3 = 0\) have?
Show answer
\(2\) roots. \(x^2 - 2|x| - 3 = f(|x|)\) with \(f(x) = x^2 - 2x - 3 = (x + 1)(x - 3)\). So \(|x| = 3\) or \(|x| = -1\); only \(|x| = 3\) works: \(x = -3\) and \(x = 3\).
For \(f(x) = x^2 - 2x - 3\), find every \(x\) for which \(|f(x)| = f(|x|)\).
Show answer
every \(x \ge 3\). For \(x \ge 0\), \(f(|x|) = f(x)\), and \(|f(x)| = f(x)\) only where \(f(x) \ge 0\): \(x \ge 3\). For \(x < -1\), \(|f(x)| = x^2 - 2x - 3\) but \(f(|x|) = x^2 + 2x - 3\); they differ by \(4x \ne 0\). For \(-1 \le x < 0\), \(|f(x)| \ge 0 > f(|x|)\), since \(f(|x|) = f(-x)\) and \(0 < -x \le 1\) is inside the dip.
How many real solutions does \(|x^2 - 4|x| + 3| = \dfrac{1}{2}\) have?
Show answer
\(8\) solutions. \(g(|x|) = \dfrac{1}{2}\) gives \(|x| = 2 \pm \sqrt{\dfrac{3}{2}}\) and \(g(|x|) = -\dfrac{1}{2}\) gives \(|x| = 2 \pm \sqrt{\dfrac{1}{2}}\), where \(g(x) = x^2 - 4x + 3\). All four values are positive, and each gives two values of \(x\).