Inverse functions

A function takes an input and gives an output. An inverse function goes backward: it takes the output and gives back the input. For example, the function "multiply by ${3}$" is undone by "divide by ${3}$". This page shows when a function has an inverse, and how to find it.

One-to-one functions

To go backward, each output must come from only one input. Look at ${g(x)=x^2}$. Both ${g(2)}$ and ${g(-2)}$ are ${4}$. So from the output ${4}$, we cannot tell if the input was ${2}$ or ${-2}$.

A function ${f}$ is one-to-one if different inputs always give different outputs: if ${x_1\ne x_2}$, then ${f(x_1)\ne f(x_2)}$.

On a graph, two inputs with the same output are two points at the same height. A horizontal line through them meets the graph twice. This gives a quick test:

Horizontal line test: A function is one-to-one if and only if no horizontal line meets its graph more than once.

xy
(a) ${y=x^2-1}$: the line ${y=1}$ meets it twice. Not one-to-one.
xy
(b) ${y=\frac{1}{2}x^3}$: every horizontal line meets it once. One-to-one.

Example 1: Is each function one-to-one?

(a) ${f(x)=2x+3}$

(b) ${g(x)=x^2}$

(c) ${h(x)=x^3}$

Solution:

(a) Yes. Suppose ${f(x_1)=f(x_2)}$. Then ${2x_1+3=2x_2+3}$, so ${x_1=x_2}$. Different inputs cannot give the same output. (The graph is a rising line, so it passes the horizontal line test.)

(b) No. ${g(2)=4}$ and ${g(-2)=4}$.

(c) Yes. The graph of ${y=x^3}$ always rises, so every horizontal line meets it exactly once.

The inverse of a function

Let ${f}$ be one-to-one, with domain ${A}$ and range ${B}$. Its inverse function ${f^{-1}}$ has domain ${B}$ and range ${A}$, and

${f^{-1}(y)=x\quad}$ exactly when ${\quad f(x)=y}$.

So ${f^{-1}}$ sends each output of ${f}$ back to its input. The domain and the range trade places.

Watch out: The ${-1}$ in ${f^{-1}}$ is not an exponent. ${f^{-1}(x)}$ does not mean ${\dfrac{1}{f(x)}}$.

If we apply ${f}$ and then ${f^{-1}}$, we get back where we started. The same is true in the other order:

${f^{-1}\big(f(x)\big)=x}$ for every ${x}$ in the domain of ${f}$

${f\big(f^{-1}(x)\big)=x}$ for every ${x}$ in the domain of ${f^{-1}}$

These two equations are called the inverse function property. We can use them to check that two functions are inverses.

Example 2: Show that ${f(x)=2x+3}$ and ${g(x)=\dfrac{x-3}{2}}$ are inverses of each other.

Solution:

Compose them in both orders (see combining functions):

$\begin{align*}&g\big(f(x)\big)\\&=\dfrac{(2x+3)-3}{2}\\&=\dfrac{2x}{2}=x\end{align*}$

$\begin{align*}&f\big(g(x)\big)\\&=2\cdot\dfrac{x-3}{2}+3\\&=x-3+3=x\end{align*}$

Both give ${x}$, so ${g=f^{-1}}$. In words: ${f}$ doubles and then adds ${3}$. The inverse undoes these steps in reverse order: it subtracts ${3}$ and then halves.

Finding the inverse of a function

To find the inverse of a one-to-one function ${f}$:

  1. Write ${y=f(x)}$.
  2. Solve this equation for ${x}$ in terms of ${y}$.
  3. Swap ${x}$ and ${y}$. The result is ${y=f^{-1}(x)}$.

We swap in step 3 because we usually call the input of any function ${x}$.

Example 3: Find the inverse of ${f(x)=3x-5}$.

Solution:

Write ${y=3x-5}$, and solve for ${x}$:

$\begin{align*}y+5&=3x\\x&=\dfrac{y+5}{3}\end{align*}$

Swap ${x}$ and ${y}$:

${f^{-1}(x)=\dfrac{x+5}{3}}$

Check: ${f(2)=1}$, and ${f^{-1}(1)=\dfrac{1+5}{3}=2}$.

Example 4: Find the inverse of ${f(x)=\dfrac{2x+1}{x-3}}$.

Solution:

Write ${y=\dfrac{2x+1}{x-3}}$. Multiply both sides by ${x-3}$:

${y(x-3)=2x+1}$

Collect the terms with ${x}$ on the left. Then factor out ${x}$:

$\begin{align*}xy-3y&=2x+1\\xy-2x&=3y+1\\x(y-2)&=3y+1\\x&=\dfrac{3y+1}{y-2}\end{align*}$

Swap ${x}$ and ${y}$:

${f^{-1}(x)=\dfrac{3x+1}{x-2}}$

The domain of ${f}$ is ${x\ne 3}$. The domain of ${f^{-1}}$ is ${x\ne 2}$, so the range of ${f}$ is all numbers except ${2}$. (This matches the horizontal asymptote ${y=2}$ of ${f}$.)

Check: ${f(0)=\dfrac{1}{-3}=-\dfrac{1}{3}}$. Then

$\begin{align*}&f^{-1}\left(-\dfrac{1}{3}\right)\\&=\dfrac{-1+1}{-\frac{1}{3}-2}=0\end{align*}$

The graph of an inverse function

If ${(a,b)}$ is a point on the graph of ${f}$, then ${f(a)=b}$. So ${f^{-1}(b)=a}$, and ${(b,a)}$ is on the graph of ${f^{-1}}$. Swapping the coordinates reflects a point across the line ${y=x}$. So:

The graph of ${f^{-1}}$ is the reflection of the graph of ${f}$ across the line ${y=x}$.

A function that is not one-to-one has no inverse. But we can often restrict its domain: use only a part of the graph that passes the horizontal line test.

Example 5: The function ${f(x)=x^2+1}$ is not one-to-one. Restrict it to ${x\ge 0}$. Then find ${f^{-1}}$, and sketch both graphs.

Solution:

For ${x\ge 0}$, the graph is the right half of a parabola. It always rises, so it is one-to-one. Its domain is ${[0,\infty)}$ and its range is ${[1,\infty)}$.

Write ${y=x^2+1}$, and solve for ${x}$:

$\begin{align*}x^2&=y-1\\x&=\sqrt{y-1}\end{align*}$

We take the positive root, because ${x\ge 0}$. Swap ${x}$ and ${y}$:

${f^{-1}(x)=\sqrt{x-1}}$, with domain ${[1,\infty)}$.

For example, ${(2,5)}$ is on the graph of ${f}$, so ${(5,2)}$ is on the graph of ${f^{-1}}$.

(2, 5)(5, 2)y = xxy
The graph of ${f(x)=x^2+1}$, ${x\ge 0}$ (blue) and of ${f^{-1}(x)=\sqrt{x-1}}$ (teal) are mirror images across the line ${y=x}$ (dashed).

An application

Example 6: The formula ${F=\dfrac{9}{5}C+32}$ changes a temperature from degrees Celsius to degrees Fahrenheit. Find the inverse formula, and change ${68}$°F to Celsius.

Solution:

Solve for ${C}$. Subtract ${32}$, then multiply by ${\dfrac{5}{9}}$:

$\begin{align*}F-32&=\dfrac{9}{5}C\\C&=\dfrac{5}{9}(F-32)\end{align*}$

Here we do not swap the letters, because ${C}$ and ${F}$ have a meaning. The inverse formula changes Fahrenheit back to Celsius. For ${68}$°F:

$C=\dfrac{5}{9}(68-32)=\dfrac{5}{9}\cdot 36=20$

So ${68}$°F is ${20}$°C.

Summary