Inverse functions¶
Algebra · level 7, lesson 6 of 7
A question to start¶
I think of a number, multiply it by 3 and add 4. I get 31. What was my number? You probably undid the steps: \(31 - 4 = 27\), then \(27 \div 3 = 9\). You built, in your head, a machine that runs the first one backwards.
Now a different game. I think of a number and square it. I get 9. What was my number? This time you cannot be sure: 3 and \(-3\) both work. Some machines can be run backwards and some cannot. This lesson finds out which, and what to do about the ones that cannot.
The idea¶
Undoing a function¶
The inverse of a function \(f\) is the function that undoes it. It is written \(f^{-1}\) (read "\(f\) inverse"). If \(f\) sends \(a\) to \(b\), then \(f^{-1}\) sends \(b\) back to \(a\):
So doing one and then the other gets you back where you started: \(f^{-1}(f(x)) = x\) and \(f(f^{-1}(x)) = x\).
The \(-1\) here is not an exponent. \(f^{-1}(x)\) does not mean \(\dfrac{1}{f(x)}\). It is just a name for the undo function. (This is an unlucky choice of notation, but everyone uses it.)
Undo the steps in reverse order¶
\(f(x) = 3x + 4\) does "multiply by 3, then add 4". To undo it, do the opposite steps in the opposite order, like taking off shoes and socks: "subtract 4, then divide by 3". So
The algebra method: swap and solve¶
For more complicated functions, use this method:
- Write \(y = f(x)\).
- Swap \(x\) and \(y\) (because the inverse swaps inputs and outputs).
- Solve for \(y\). That \(y\) is \(f^{-1}(x)\).
For \(f(x) = 3x + 4\): \(y = 3x + 4\); swap to \(x = 3y + 4\); solve: \(y = \dfrac{x - 4}{3}\). The same answer.
The graph: a reflection in \(y = x\)¶
If \((a, b)\) is on the graph of \(f\), then \((b, a)\) is on the graph of \(f^{-1}\). Swapping the coordinates of a point reflects it in the line \(y = x\). Why? The segment from \((a, b)\) to \((b, a)\) has slope \(\dfrac{a - b}{b - a} = -1\), so it is perpendicular to \(y = x\) (slope 1), and its midpoint \(\left(\dfrac{a + b}{2}, \dfrac{a + b}{2}\right)\) lies on \(y = x\). A line that crosses the mirror at right angles and is cut in half by it: that is exactly a reflection.
The picture shows \(y = x^2\) for \(x \ge 0\) and its inverse \(y = \sqrt{x}\). The point \((2, 4)\) on one matches \((4, 2)\) on the other.
Because inputs and outputs swap, the domain of \(f^{-1}\) is the range of \(f\), and the range of \(f^{-1}\) is the domain of \(f\).
When is there an inverse?¶
Reflect the whole parabola \(y = x^2\) in \(y = x\) and you get the sideways parabola \(x = y^2\). That fails the vertical line test (lesson 4), so it is not a function. The trouble is that \(f(3) = f(-3) = 9\): the inverse would have to send 9 back to two places.
A function has an inverse function exactly when no two inputs share an output. Such a function is called one-to-one. On a graph, this is the horizontal line test: if some horizontal line meets the graph twice, the function has no inverse. (A horizontal line on \(f\) becomes a vertical line on the reflected graph, which is why this test matches the vertical line test.)
Restricting the domain¶
We can rescue \(x^2\) by throwing half of it away. Keep only \(x \ge 0\). Now no two inputs share an output, and the inverse is \(\sqrt{x}\), which (lesson 4) gives only the non-negative root. That is exactly why \(\sqrt{\phantom{x}}\) gives one answer: it is the inverse of the right half of the parabola.
For any parabola, cut it at the vertex and keep one side. For \(y = (x - 2)^2 + 1\), keep \(x \ge 2\) (or \(x \le 2\)).
Worked examples¶
1. A straight line. \(f(x) = 3x + 4\). Find \(f^{-1}\) and check it.
- \(f^{-1}(x) = \dfrac{x - 4}{3}\) (from above).
- Check: \(f(5) = 19\), and \(f^{-1}(19) = \dfrac{15}{3} = 5\). ✓
2. Temperature. \(F = \dfrac95C + 32\) changes Celsius into Fahrenheit. Find the rule back.
- Subtract 32: \(F - 32 = \dfrac95C\). Multiply by \(\dfrac59\): \(C = \dfrac59(F - 32)\).
- Check: water boils at 100 °C, and \(\dfrac95(100) + 32 = 212\) °F; then \(\dfrac59(212 - 32) = \dfrac59(180) = 100\). ✓
3. Half a parabola. \(f(x) = (x - 2)^2 + 1\) for \(x \ge 2\). Find \(f^{-1}\), with its domain and range.
- \(y = (x - 2)^2 + 1\). Swap: \(x = (y - 2)^2 + 1\).
- \((y - 2)^2 = x - 1\), so \(y - 2 = \pm\sqrt{x - 1}\).
- The inverse's range is \(f\)'s domain, \(y \ge 2\), so \(y - 2 \ge 0\): take the \(+\) root. \(f^{-1}(x) = 2 + \sqrt{x - 1}\).
- Domain of \(f^{-1}\): \(x \ge 1\) (the range of \(f\)). Range: \(y \ge 2\).
- Check: \(f(5) = 9 + 1 = 10\), and \(f^{-1}(10) = 2 + \sqrt9 = 5\). ✓
4. A fraction. \(f(x) = \dfrac{2x + 1}{x - 3}\). Find \(f^{-1}\).
- Swap: \(x = \dfrac{2y + 1}{y - 3}\). Multiply by \(y - 3\): \(xy - 3x = 2y + 1\).
- Collect the \(y\) terms on one side: \(xy - 2y = 3x + 1\), so \(y(x - 2) = 3x + 1\).
- \(f^{-1}(x) = \dfrac{3x + 1}{x - 2}\).
- Check: \(f(4) = \dfrac{9}{1} = 9\), and \(f^{-1}(9) = \dfrac{28}{7} = 4\). ✓
5. Functions that are their own inverse. \(f(x) = 6 - x\): swap, \(x = 6 - y\), so \(y = 6 - x\). The same function! Its graph is a line of slope \(-1\), which is perpendicular to \(y = x\), so reflecting it in \(y = x\) leaves it where it is. \(f(x) = \dfrac1x\) is another: its graph is symmetric about \(y = x\).
Try it¶
- Find the inverse of \(f(x) = 5x - 2\).
- Find the inverse of \(f(x) = \dfrac{x}{4} + 1\).
- Find the inverse of (a) \(f(x) = x^3\) (b) \(g(x) = x^3 + 1\).
- \(g(x) = \sqrt{x + 3}\). Give its domain and range, and find \(g^{-1}\) with its domain.
- Which of these have an inverse function without restricting the domain? (a) \(y = x^2 + 1\) (b) \(y = \lvert x \rvert\) (c) \(y = -x + 7\) (d) \(y = x^3\)
- Show that \(f(x) = \dfrac{x + 1}{x - 1}\) is its own inverse.
- \(f(2) = 7\) and \(f(5) = 3\). Find \(f^{-1}(3)\) and \(f\!\left(f^{-1}(7)\right)\).
- Restrict the domain of \(y = x^2 - 4x\) so that it has an inverse, and find that inverse.
Answers
- Swap: \(x = 5y - 2\), so \(y = \dfrac{x + 2}{5}\).
- Swap: \(x = \dfrac{y}{4} + 1\), so \(y = 4(x - 1)\).
- (a) \(x = y^3\), so \(y = \sqrt[3]{x}\). (b) \(x = y^3 + 1\), so \(y = \sqrt[3]{x - 1}\). (Cube roots of negatives exist, so no restriction is needed: \(x^3\) is one-to-one.)
- Domain \(x \ge -3\), range \(y \ge 0\). Swap: \(x = \sqrt{y + 3}\), so \(x^2 = y + 3\), so \(g^{-1}(x) = x^2 - 3\), with domain \(x \ge 0\) (the range of \(g\)). Without that restriction you would get the whole parabola, which is too much.
- (a) No: \(x = 1\) and \(x = -1\) both give 2. (b) No: 1 and \(-1\) both give 1. (c) Yes: its inverse is itself. (d) Yes: \(\sqrt[3]{x}\).
- Swap: \(x = \dfrac{y + 1}{y - 1}\). Then \(xy - x = y + 1\), so \(xy - y = x + 1\), so \(y(x - 1) = x + 1\), so \(y = \dfrac{x + 1}{x - 1}\). The same rule, so \(f^{-1} = f\).
- \(f^{-1}(3) = 5\) (because \(f(5) = 3\)). \(f(f^{-1}(7)) = 7\): doing a function and then its inverse (either order) gives back what you started with. Here \(f^{-1}(7) = 2\) and \(f(2) = 7\).
- Complete the square: \(y = (x - 2)^2 - 4\), vertex \((2, -4)\). Keep \(x \ge 2\). Swap: \(x = (y - 2)^2 - 4\), so \(y - 2 = \sqrt{x + 4}\) (positive, since \(y \ge 2\)), so \(f^{-1}(x) = 2 + \sqrt{x + 4}\) for \(x \ge -4\). (Keeping \(x \le 2\) instead gives \(2 - \sqrt{x + 4}\).)
Common mistake¶
Writing \(f^{-1}(x) = \dfrac{1}{f(x)}\). For \(f(x) = 3x + 4\), \(\dfrac{1}{3x + 4}\) is not the inverse: test it, \(f(5) = 19\), and \(\dfrac{1}{19}\) is not 5. The \(-1\) in \(f^{-1}\) is a label, not a power.
Forgetting the domain. Swapping and solving with a square can give \(\pm\). The range of the original function decides which sign to keep, and the inverse's domain is the original's range.
Where it leads¶
- Back: Transformations of functions · Next: Exponential functions, whose inverse is the logarithm.
- Level 7 page · Algebra topic page
- Logarithms as the inverse of \(10^x\): Logarithms. Undoing a composition of two functions: Combining functions.
- Square roots and cube roots as undo operations: Square roots and cube roots. Reflections in a line: Transformations on a grid.
- At university, inverse functions and how their slopes are related: MAT137 Unit 5 (the MVT and inverse functions) and MAT158 Unit 8 (inverse functions).