This site is a work in progress. New lessons are added regularly. Contact us

Inverse Functions

Learning goals

  • Swap input and output to build the inverse
  • Read f1f^{-1} as the inverse, never the reciprocal
  • Find an inverse by swapping xx and yy, then solving
  • Apply the horizontal line test to spot a one-to-one rule
  • Trade domain for range between a function and its inverse
  • Verify a pair by composing both ways to xx

Undoing what a function does

Start with a rule simple enough to see straight through: f(x)=x+3f(x) = x + 3, the rule “add three.” Feed it 55 and it returns 88; feed it 1010 and it returns 1313. To send those outputs back where they came from, you do the obvious thing and subtract three: 88 goes back to 55, and 1313 goes back to 1010. The rule “subtract three,” written g(x)=x3g(x) = x - 3, reverses everything “add three” did. That reversing rule is the inverse of ff.

Look at what happens to a single input-output pair. The function ff ties the input 55 to the output 88, a pairing we can write as (5,8)(5, 8). Its inverse ties 88 back to 55, the pair (8,5)(8, 5). The inverse takes every pair of ff and swaps its two entries: whatever was the input becomes the output, and whatever was the output becomes the input. That one sentence, swap the input and the output, is the whole idea of an inverse, and everything else in this lesson follows from it.

The inverse of ff has its own symbol, f1f^{-1}, read aloud as ”ff inverse.” It is defined to undo ff, and “undo” can be stated precisely in two directions. If you run ff and then run f1f^{-1}, you return to the input you started with:

f1(f(x))=x.f^{-1}(f(x)) = x.

Reading from the inside out, ff turns xx into f(x)f(x), and f1f^{-1} turns that back into xx. The reverse order must work too. If you run f1f^{-1} first and then ff, you again come back to the start:

f(f1(x))=x.f(f^{-1}(x)) = x.

Both equations say the same thing from opposite ends: ff and f1f^{-1} cancel each other, whichever one you apply first. For f(x)=x+3f(x) = x + 3 and f1(x)=x3f^{-1}(x) = x - 3, check both directions:

f1(f(x))=(x+3)3=x,f(f1(x))=(x3)+3=x.f^{-1}(f(x)) = (x + 3) - 3 = x, \qquad f(f^{-1}(x)) = (x - 3) + 3 = x.

Adding three and then subtracting three lands you back where you began, and so does subtracting first and then adding.

A function and its inverse running in opposite directionsThe forward rule f sends the input 5 to the output 8 along the top arrow; the inverse sends 8 back to 5 along the bottom arrow.inputoutput58f: add 3f-1: subtract 3
An inverse runs a function backward. The forward rule f carries the input 5 to the output 8; the inverse f inverse carries 8 back to 5. Undoing a function means swapping the roles of input and output.

The superscript that is not a reciprocal

The symbol f1f^{-1} carries a trap, and it is worth defusing before you use it. The raised 1-1 everywhere else in algebra makes a reciprocal, so f1(x)f^{-1}(x) looks like it should mean 1f(x)\dfrac{1}{f(x)}. It does not. Here f1f^{-1} is the name of the inverse function, and it has nothing to do with dividing 11 by anything.

Why reuse a symbol that invites the confusion? The choice is a deliberate analogy, and understanding it keeps the two ideas apart for good. For a nonzero number, its multiplicative inverse (its reciprocal) is the number that multiplies with it to give 11: the reciprocal of 55 is 15\dfrac{1}{5}, and 515=15 \cdot \dfrac{1}{5} = 1. The number 11 is special for multiplication because multiplying by it changes nothing. Functions tell the same story with composition in place of multiplication. The inverse f1f^{-1} is the function that composes with ff to give the rule that changes nothing, the identity that returns its input unchanged. That requirement is exactly the statement f1(f(x))=xf^{-1}(f(x)) = x. So the raised 1-1 marks “the inverse under the operation in play,” multiplication for a number, composition for a function. Because the two operations are different, the two inverses are different objects.

Make the difference concrete. For f(x)=x+3f(x) = x + 3, the inverse function is f1(x)=x3f^{-1}(x) = x - 3, while the reciprocal is 1f(x)=1x+3\dfrac{1}{f(x)} = \dfrac{1}{x + 3}. These are not close. At x=5x = 5,

f1(5)=53=2,1f(5)=18.f^{-1}(5) = 5 - 3 = 2, \qquad \frac{1}{f(5)} = \frac{1}{8}.

One returns the input that produced the output 88; the other is a small fraction with nothing to do with undoing ff. Whenever you see f1f^{-1}, read “the function that reverses ff,” never “one over ff.”

Check your understanding

Let f(x)=x+6f(x) = x + 6, so that f1(x)=x6f^{-1}(x) = x - 6. What is 1f(x)\dfrac{1}{f(x)}?

Answer choices

Finding an inverse: swap, then solve

Guessing the inverse works for “add three,” but you need a method that works every time. The swap principle hands you one directly. The pairs of ff are (input, output), and the inverse’s pairs are (output, input). So to build the inverse you interchange the input and the output and then rearrange. In symbols, write y=f(x)y = f(x), swap xx and yy, and solve the new equation for yy. The recipe is not a ritual; each step is the input-output swap written in algebra.

Watch it work on f(x)=2x+3f(x) = 2x + 3. Write the output as yy:

y=2x+3.y = 2x + 3.

Here xx is the input and yy is the output. Swap them, so that the letter standing for the output now plays the role of the input we feed in. The letter standing for the input is then the value we want back:

x=2y+3.x = 2y + 3.

Solve this for yy by subtracting three and dividing by two:

x3=2yy=x32.x - 3 = 2y \quad\Longrightarrow\quad y = \frac{x - 3}{2}.

Rename the result, and the inverse is f1(x)=x32f^{-1}(x) = \dfrac{x - 3}{2}. The rule “double, then add three” is undone by “subtract three, then halve,” with the steps reversed and each one turned around, exactly as an undo should be.

Worked example 1 Find the inverse of f(x)=4x7f(x) = 4x - 7

The rule multiplies by four and then subtracts seven, so its inverse should add seven and then divide by four. Confirm it with the swap-and-solve steps. Write the output as yy:

y=4x7.y = 4x - 7.

Swap xx and yy, turning the input into the output and the output into the input:

x=4y7.x = 4y - 7.

Solve for yy by adding seven and dividing by four:

x+7=4yy=x+74.x + 7 = 4y \quad\Longrightarrow\quad y = \frac{x + 7}{4}.

So f1(x)=x+74f^{-1}(x) = \dfrac{x + 7}{4}. Check both directions with composition:

f1(f(x))=(4x7)+74=4x4=x,f^{-1}(f(x)) = \frac{(4x - 7) + 7}{4} = \frac{4x}{4} = x,f(f1(x))=4x+747=(x+7)7=x.f(f^{-1}(x)) = 4 \cdot \frac{x + 7}{4} - 7 = (x + 7) - 7 = x.

Both compositions collapse to xx, so the two functions undo each other.

Worked example 2 Inverting a simple rational, f(x)=1x3f(x) = \dfrac{1}{x - 3}

This rule subtracts three and then takes the reciprocal, and it accepts every input except x=3x = 3, where the denominator would be zero. Find its inverse the same way. Start from

y=1x3.y = \frac{1}{x - 3}.

Swap xx and yy:

x=1y3.x = \frac{1}{y - 3}.

Solve for yy. Taking the reciprocal of both sides clears the fraction, and then add three:

y3=1xy=1x+3.y - 3 = \frac{1}{x} \quad\Longrightarrow\quad y = \frac{1}{x} + 3.

So f1(x)=1x+3f^{-1}(x) = \dfrac{1}{x} + 3, defined for every input except x=0x = 0. The forbidden inputs have traded places: ff banned 33 and f1f^{-1} bans 00. The next section explains why that swap always happens. A quick check confirms the reversal:

f1(f(x))=11x3+3=(x3)+3=x.f^{-1}(f(x)) = \frac{1}{\frac{1}{x - 3}} + 3 = (x - 3) + 3 = x.

Check your understanding

What is the inverse of f(x)=5x2f(x) = 5x - 2?

Answer choices

Domain and range trade places

The forbidden-input swap you just saw is one instance of a rule that always holds: an inverse turns the domain and range of ff around. It follows straight from swapping input and output. Every pair of ff has the form (input from the domain, output from the range). The inverse swaps each pair into (output, input). So the numbers that were outputs are now the inputs of f1f^{-1}, and the numbers that were inputs are now its outputs. Therefore

Return to f(x)=1x3f(x) = \dfrac{1}{x - 3} from the last example. Its domain is every number except 33, and its range is every number except 00, because the reciprocal of a nonzero quantity is never 00. Its inverse f1(x)=1x+3f^{-1}(x) = \dfrac{1}{x} + 3 has domain every number except 00 and range every number except 33. Line them up and the trade is exact: the domain of one is the range of the other, both ways.

Worked example 3 The domain and range of an inverse

Find the inverse of f(x)=xf(x) = \sqrt{x}, and confirm that the domain and range swap.

The square root accepts only inputs that are zero or positive, so the domain of ff is all numbers x0x \ge 0. Its outputs are the nonnegative square roots, so the range of ff is all numbers 0\ge 0 as well. Find the inverse by swapping and solving:

y=xx=yy=x2.y = \sqrt{x} \quad\Longrightarrow\quad x = \sqrt{y} \quad\Longrightarrow\quad y = x^2.

Squaring both sides of x=yx = \sqrt{y} undoes the root and gives y=x2y = x^2. A restriction hides here: xx was the output of a square root, so x0x \ge 0, and the inverse is f1(x)=x2f^{-1}(x) = x^2 for x0x \ge 0 only. Now check the trade. The domain of f1f^{-1} is x0x \ge 0, which is exactly the range of ff, and the range of f1f^{-1} is x20x^2 \ge 0, which is exactly the domain of ff. The square root and squaring, kept to nonnegative numbers, are a matched inverse pair, a fact the next two sections put to work.

When a function has no inverse

Every example so far has had a clean inverse, but some functions have none, and it is important to see why. The trouble starts when two different inputs produce the same output. Consider the squaring rule on all numbers, f(x)=x2f(x) = x^2. It sends both 33 and 3-3 to 99:

32=9and(3)2=9.3^2 = 9 \qquad \text{and} \qquad (-3)^2 = 9.

Now ask the inverse to do its job. It must send the output 99 back to the input it came from, but here 99 came from two inputs. Should f1(9)f^{-1}(9) be 33 or 3-3? There is no honest answer. A function is allowed only one output per input, and this would force the single input 99 to have two outputs. So squaring on all numbers has no inverse function.

The property that avoids this trap has a name. A function is one-to-one when different inputs always give different outputs, that is, when no two inputs share an output. Squaring fails to be one-to-one because 33 and 3-3 collide. A line like f(x)=4x7f(x) = 4x - 7 is one-to-one, because two different inputs, stretched and shifted the same way, stay different.

Why an inverse needs a one-to-one function#

Suppose ff is not one-to-one, so two different inputs aa and bb, with aba \ne b, share an output: f(a)=f(b)=cf(a) = f(b) = c. Any inverse of ff has one required job, to send each output back to the input that produced it. Applied to cc, that job is contradictory, because cc was produced by aa and also by bb. The inverse would need f1(c)=af^{-1}(c) = a and f1(c)=bf^{-1}(c) = b at the same time, giving the single input cc two different outputs. That is precisely what the definition of a function forbids, so no function can undo ff.

Now suppose instead that ff is one-to-one. Then every output of ff comes from exactly one input, never two. Sending each output back to that one input is therefore an unambiguous rule, with a single result each time. Producing a single result for each input is exactly what it means to be a function. So the reversal is a genuine function, the inverse f1f^{-1}.

Putting the two halves together, ff has an inverse function if and only if ff is one-to-one. The condition is not an extra hoop to clear; it is the exact price of demanding that the reversal be single-valued.

The horizontal line test

One-to-one has a picture, and it is the mirror image of a test you already know. In the lesson on functions you met the vertical line test: a graph represents a function when no vertical line crosses it more than once. The reason is that a vertical line gathers all the points with a single input, and a function may not give that input two outputs. One-to-one asks the reverse question, so it uses the reverse line.

A horizontal line gathers all the points that share a single output, since every point on the line y=cy = c sits at the same height cc. If some horizontal line meets the graph in two points, those two points have the same output but different inputs, and the function is not one-to-one. So a graph belongs to a one-to-one function exactly when no horizontal line crosses it more than once. The vertical line test checks “one output per input,” which makes the graph a function. The horizontal line test checks “one input per output,” which makes that function invertible.

The horizontal line test: one crossing is one-to-one, two is notA rising line crossed once by a horizontal line versus an upward parabola crossed twice by a horizontal line.one-to-onenot one-to-one
The horizontal line test. On the left every horizontal line meets the rising graph once, so each output comes from a single input and the function is one-to-one. On the right a horizontal line meets the parabola twice, so one output comes from two inputs and the function is not one-to-one.

The rising line on the left passes: every height is reached exactly once, so it is one-to-one and has an inverse. The parabola y=x2y = x^2 on the right fails: the horizontal line hits it twice, at x=3x = 3 and x=3x = -3 for the height 99, the same collision that blocked its inverse. (Swapping every point (a,b)(a, b) for (b,a)(b, a) also reflects a graph across the line y=xy = x. That reflection is how the inverse is drawn in a later lesson; here the only question is whether the inverse exists.)

A function that fails the test can often be repaired by shrinking its domain until it is one-to-one. Squaring collides only because it accepts both a positive and a negative input for each output. Throw away the negatives, keeping f(x)=x2f(x) = x^2 for x0x \ge 0, and every output now comes from a single nonnegative input. On that restricted domain squaring is one-to-one, and it has the inverse you already met, the square root.

Worked example 4 An inverse on a restricted domain

Find the inverse of f(x)=x2f(x) = x^2 with the domain restricted to x0x \ge 0.

With the domain restricted, the rule is one-to-one, so an inverse function exists. Swap and solve, watching the restriction travel with the variable. Start from

y=x2,x0.y = x^2, \qquad x \ge 0.

Swap xx and yy. The condition x0x \ge 0 was a statement about the input of ff, which becomes the output of f1f^{-1}, so it attaches to yy:

x=y2,y0.x = y^2, \qquad y \ge 0.

Solve x=y2x = y^2 for yy. Two numbers square to xx, namely x\sqrt{x} and x-\sqrt{x}, but the restriction y0y \ge 0 keeps only the nonnegative one:

y=x.y = \sqrt{x}.

So f1(x)=xf^{-1}(x) = \sqrt{x}. The restriction is what rescued the inverse. Without it, x=y2x = y^2 would hand back two values of yy for each positive xx, which is no function at all. This is the general fix for a rule that fails the horizontal line test. Cut the domain down to a piece on which the rule is one-to-one, then invert that piece.

Check your understanding

Which of these functions is one-to-one on all real numbers, so that it has an inverse function?

Answer choices

Verifying an inverse by composition

You now have a way to find an inverse. But how do you check that a proposed answer is right, or test whether two functions handed to you are really inverses? The definition already said it: ff and gg are inverses exactly when they undo each other in both directions,

f(g(x))=xandg(f(x))=x.f(g(x)) = x \qquad \text{and} \qquad g(f(x)) = x.

These are compositions, the operation from the last lesson, so verifying an inverse is just building the two composite functions and checking that each one collapses to xx. Both are required, and the reason goes back to one-to-one. A single direction can hold while the other fails, and when it does the two functions are not inverses.

Worked example 5 Checking a pair in both directions

Show that f(x)=2x6f(x) = 2x - 6 and g(x)=x+62g(x) = \dfrac{x + 6}{2} are inverses, then see why one direction alone would not settle it.

Build both compositions. For g(f(x))g(f(x)), drop the whole rule for ff into gg:

g(f(x))=(2x6)+62=2x2=x.g(f(x)) = \frac{(2x - 6) + 6}{2} = \frac{2x}{2} = x.

For f(g(x))f(g(x)), drop the whole rule for gg into ff:

f(g(x))=2x+626=(x+6)6=x.f(g(x)) = 2 \cdot \frac{x + 6}{2} - 6 = (x + 6) - 6 = x.

Both directions give xx, so ff and gg are inverses.

To see why both were worth checking, look at a pair that passes one test and fails the other. Take f(x)=x2f(x) = x^2 on all numbers and g(x)=xg(x) = \sqrt{x}. One direction looks perfect:

f(g(x))=(x)2=x,f(g(x)) = \left(\sqrt{x}\right)^2 = x,

valid for every x0x \ge 0 that gg accepts. But the other direction breaks:

g(f(x))=x2,g(f(x)) = \sqrt{x^2},

which is not xx for negative inputs. At x=3x = -3 it gives (3)2=9=3\sqrt{(-3)^2} = \sqrt{9} = 3, not 3-3. The square root cannot recover the sign that squaring destroyed. Because g(f(x))=xg(f(x)) = x fails, squaring on all numbers and the square root are not inverses, exactly as the one-to-one test warned. Only after squaring is restricted to x0x \ge 0, so that no sign is ever lost, do both directions hold.

Running a process backward

An inverse earns its keep whenever a function models a process and you need to run that process in reverse. If a rule turns a starting value into a result, its inverse turns the result back into the starting value, which answers a question the forward rule cannot.

Worked example 6 Recovering the input from the output

A phone plan charges a fixed 2020 dollars per month plus 0.100.10 dollars for each minute of calls, so the monthly cost for mm minutes is C(m)=20+0.1mC(m) = 20 + 0.1m. A bill comes to 3535 dollars. Find a formula that recovers the minutes from the cost, and use it.

The cost function runs forward, minutes in and dollars out. You want the reverse, dollars in and minutes out, which is the inverse. Write the cost as cc and solve for mm:

c=20+0.1mc20=0.1mm=c200.1=10(c20).c = 20 + 0.1m \quad\Longrightarrow\quad c - 20 = 0.1m \quad\Longrightarrow\quad m = \frac{c - 20}{0.1} = 10(c - 20).

So the inverse is C1(c)=10(c20)C^{-1}(c) = 10(c - 20), which is 10c20010c - 200. Apply it to the 3535 dollar bill:

C1(35)=10(3520)=1015=150.C^{-1}(35) = 10(35 - 20) = 10 \cdot 15 = 150.

The bill accounts for 150150 minutes. Check it forward: C(150)=20+0.1(150)=20+15=35C(150) = 20 + 0.1(150) = 20 + 15 = 35 dollars, the original bill. The inverse turned a known cost back into the minutes that produced it.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

A raised 1-1 already had a job before anyone attached it to a function. On a number it makes a reciprocal, so 515^{-1} is one fifth. In 1813 John Herschel borrowed that same small symbol for something quite different.

Herschel was an English astronomer, and he wanted a compact way to name the angle with a given sine. He wrote sin1\sin^{-1} for it. He also wrote f1f^{-1} for the function that undoes ff. The borrowing was deliberate. In the writing of his day a raised 22 on a function often meant applying it twice, so f2(x)f^2(x) stood for f(f(x))f(f(x)). If a raised 22 says do it twice, a raised 1-1 saying undo it fits the pattern neatly.

Mathematics never tidied the clash away. We still write f1f^{-1} for the inverse function. We also still write sin2x\sin^2 x for (sinx)2(\sin x)^2, so one small superscript points in two directions depending on its sign.

Knowing where the notation came from is the surest way to keep it straight. The 1-1 was chosen to echo the reciprocal, but it does not mean one. It names the rule that sends every output back to the input it came from. That is the pairing you built here, then confirmed by composing both ways to xx.