Finding an inverse involves several algebra steps, and any one can slip. Composition gives a clean test: if two functions undo each other, then doing one after the other changes nothing.
Key idea
$f$ and $g$ are inverses exactly when $f(g(x)) = x$ for every $x$ in the domain of $g$ and $g(f(x)) = x$ for every $x$ in the domain of $f$. Check both orders.
Why it works
$f(g(x)) = x$ says that whatever $g$ does, $f$ undoes. $g(f(x)) = x$ says the reverse. You need both, because one order can work while the other fails. For $f(x) = x^2$ and $g(x) = \sqrt{x}$: $f(g(x)) = (\sqrt{x})^2 = x$ for $x \ge 0$, but $g(f(x)) = \sqrt{x^2} = |x|$, which is wrong for negative $x$. So they are not inverses unless you restrict the domain.
Worked examples
Worked example: A pair that works
Are $f(x) = 3x - 6$ and $g(x) = \frac{x}{3} + 2$ inverses?
- $f(g(x)) = 3\left(\frac{x}{3} + 2\right) - 6 = x + 6 - 6$ $= x$.
- $g(f(x)) = \frac{3x - 6}{3} + 2 = x - 2 + 2 = x$.
Answer: Yes. Both compositions give $x$.
Worked example: A pair that fails
Are $f(x) = 2x + 4$ and $g(x) = \frac{x}{2} - 4$ inverses?
- $f(g(x)) = 2\left(\frac{x}{2} - 4\right) + 4 = x - 8 + 4$ $= x - 4$.
- That is not $x$. The steps were undone in the wrong order: $f$ doubles and then adds 4, so the inverse must subtract 4 first and then halve, which gives $\frac{x - 4}{2}$.
Answer: No. $f(g(x)) = x - 4$.
Worked example: Cubes and cube roots
Are $f(x) = x^3 + 1$ and $g(x) = \sqrt[3]{x - 1}$ inverses?
- $f(g(x)) = \left(\sqrt[3]{x - 1}\right)^3 + 1 = x - 1 + 1$ $= x$.
- $g(f(x)) = \sqrt[3]{x^3 + 1 - 1} = \sqrt[3]{x^3} = x$, for every real $x$, negatives included.
Answer: Yes.
Common mistake
Testing a single number and stopping. $f(g(0)) = 0$ can happen by luck even when the functions are not inverses. A single failure does prove they are not inverses, but to prove they are, simplify $f(g(x))$ and $g(f(x))$ with $x$ left as a letter.