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

Inverse Functions

Learning goals

  • Require both compositions to be the identity
  • Prove the inverse unique from associativity
  • Tie invertibility to being one-to-one onto the range
  • Swap the ordered pairs, which the horizontal line test measures
  • Trade domain for range between the two functions
  • Restrict a domain knowing the choice is not unique

An inverse must undo f from both sides

Give the idea its definition. A function gg is an inverse of ff when composing the two in either order returns the identity:

gf=id  on domfandfg=id  on domg.g \circ f = \operatorname{id} \ \text{ on } \operatorname{dom} f \qquad\text{and}\qquad f \circ g = \operatorname{id} \ \text{ on } \operatorname{dom} g.

Read both halves. The first, g(f(x))=xg(f(x)) = x for every xx in the domain of ff, says gg undoes ff: feed xx through ff and gg brings it back. The second, f(g(x))=xf(g(x)) = x for every xx in the domain of gg, says ff undoes gg the same way. Reversing has to work in both directions, and we insist on both because one alone can hold while the other fails. The example that shows this is the heart of the lesson.

Worked example 1 One side is not enough

Let f(x)=x2f(x) = x^2 with domain all real numbers, and let g(x)=xg(x) = \sqrt{x} with domain x0x \ge 0. Test both compositions.

Start with fgf \circ g. For any x0x \ge 0,

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

so fgf \circ g is the identity on the domain of gg. Stop here and you would call gg the inverse of ff. Now test the other order:

(gf)(x)=g(x2)=x2=x.(g \circ f)(x) = g(x^2) = \sqrt{x^2} = |x|.

This equals xx when x0x \ge 0, but for x<0x < 0 it gives x-x, not xx. For instance (gf)(3)=9=33(g \circ f)(-3) = \sqrt{9} = 3 \ne -3. So gfg \circ f is not the identity on the domain of ff; it collapses every negative input to its positive twin. The function gg undoes ff from one side only. Squaring throws away the sign, and no square root can restore a sign that is already gone. A one-sided inverse is not an inverse, which is exactly why the definition demands both compositions.

Check your understanding

For f(x)=x2f(x) = x^2 on all real numbers and g(x)=xg(x) = \sqrt{x} on x0x \ge 0, a student checks that (fg)(x)=x(f \circ g)(x) = x and concludes g=f1g = f^{-1}. Why is the conclusion wrong?

Answer choices

When both sides do hold, the verification is a short two-part check, and skipping either part is the most common way to get an inverse wrong.

Worked example 2 A two-sided verification

Show that g(x)=x12g(x) = \dfrac{x - 1}{2} is the inverse of f(x)=2x+1f(x) = 2x + 1, both on all real numbers.

Check gfg \circ f first, substituting f(x)f(x) into gg:

(gf)(x)=g(2x+1)=(2x+1)12=2x2=x.(g \circ f)(x) = g(2x + 1) = \frac{(2x + 1) - 1}{2} = \frac{2x}{2} = x.

Now check fgf \circ g, substituting g(x)g(x) into ff:

(fg)(x)=f ⁣(x12)=2x12+1=(x1)+1=x.(f \circ g)(x) = f\!\left(\frac{x - 1}{2}\right) = 2 \cdot \frac{x - 1}{2} + 1 = (x - 1) + 1 = x.

Both compositions return xx for every real number, and both functions have all of R\mathbb{R} as their domain, so g=f1g = f^{-1}. Each line undid the other: the first cancelled “times two then plus one” by “minus one then over two,” and the second ran that cancellation in the opposite order.

There is only one inverse

Because the definition is two-sided, a function cannot have two different inverses. This is the payoff of the previous lesson’s hardest theorem, associativity, and it is what earns us the right to write “the” inverse and give it a name.

The inverse is unique#

Suppose gg and hh are both inverses of ff. Write AA for the domain of ff and BB for its range, so ff sends AA to BB while gg and hh send BB back to AA. Being inverses means gf=idAg \circ f = \operatorname{id}_A and fg=idBf \circ g = \operatorname{id}_B, and likewise hf=idAh \circ f = \operatorname{id}_A and fh=idBf \circ h = \operatorname{id}_B.

Now run a single chain and justify each step:

g=gidB=g(fh)=(gf)h=idAh=h.g = g \circ \operatorname{id}_B = g \circ (f \circ h) = (g \circ f) \circ h = \operatorname{id}_A \circ h = h.

The first equality composes gg with the identity on BB, its own domain, which changes nothing. The second replaces idB\operatorname{id}_B by fhf \circ h, equal to it because hh is an inverse of ff. The third is the associative law from the previous lesson, and it is the one place the whole argument rests on it. The fourth uses gf=idAg \circ f = \operatorname{id}_A, and the last drops the identity on AA. So g=hg = h: any two inverses of ff are the same function.

Because there is at most one, we may speak of the inverse of ff and give it the name f1f^{-1}. Notice that associativity is not a decoration here. Without it the middle step would fail, and the phrase “the inverse” would not even be well defined.

That name carries a warning you first met at the end of the previous lesson. The superscript in f1f^{-1} marks the inverse for composition, and it never means the reciprocal 1f\dfrac{1}{f}. For f(x)=x+3f(x) = x + 3 the inverse is f1(x)=x3f^{-1}(x) = x - 3, while the reciprocal (f(x))1=1x+3\bigl(f(x)\bigr)^{-1} = \dfrac{1}{x + 3} is a completely different function. Keep f1f^{-1} for undoing and 1f\dfrac{1}{f} for dividing.

Which functions can be inverted

Not every function has an inverse; Worked Example 1 already met one that does not. The question is which do, and the answer is the cleanest statement in the chapter, provided we say one thing about the codomain out loud and then never forget it.

Throughout the rest of this lesson, take a function’s codomain to be its range, the set of values it actually outputs. A function is one-to-one when different inputs always give different outputs, equivalently when f(a)=f(b)f(a) = f(b) forces a=ba = b. With the codomain fixed as the range, invertibility and one-to-oneness are the same condition.

With codomain taken as the range, ff is invertible exactly when it is one-to-one#

Take ff with domain AA and codomain its range B=f(A)B = f(A), so every element of BB equals f(a)f(a) for at least one aAa \in A.

Suppose first that ff is one-to-one. Each bBb \in B is f(a)f(a) for at least one aa, because BB is the range, and for at most one aa, because ff is one-to-one, so for exactly one. Define g(b)g(b) to be that unique aa. Then for every aAa \in A we get g(f(a))=ag(f(a)) = a, since aa is the one input that ff sends to f(a)f(a), so gf=idAg \circ f = \operatorname{id}_A. Likewise, for every bBb \in B we get f(g(b))=bf(g(b)) = b, since g(b)g(b) was chosen as an input that ff sends to bb, so fg=idBf \circ g = \operatorname{id}_B. Both sides hold, so gg is a two-sided inverse.

Conversely, suppose ff has an inverse gg. If f(a1)=f(a2)f(a_1) = f(a_2), apply gg to both sides. Because gf=idAg \circ f = \operatorname{id}_A,

a1=g(f(a1))=g(f(a2))=a2,a_1 = g(f(a_1)) = g(f(a_2)) = a_2,

so equal outputs force equal inputs and ff is one-to-one. That settles both directions.

The codomain hypothesis is not decoration, and dropping it is the classic way this statement turns false. If the codomain is left larger than the range, some declared output is never actually produced, and no gg can satisfy fg=idf \circ g = \operatorname{id} there. That is because f(g(b))f(g(b)) is always a genuine output of ff, and it can never equal a value that ff misses. With a larger codomain the correct condition is that ff be both one-to-one and onto, that is a bijection. Taking the codomain to be the range is exactly what makes “onto” automatic, and that leaves one-to-one as the only thing to check. Whenever this lesson says “invertible” it means “one-to-one, as a map onto its range.”

Worked example 3 Finding an inverse, then proving it

Find the inverse of f(x)=x3+1f(x) = x^3 + 1 on all real numbers, and verify it on both sides.

First, the function is one-to-one: if a3+1=b3+1a^3 + 1 = b^3 + 1 then a3=b3a^3 = b^3, and

a3b3=(ab)(a2+ab+b2)=0a^3 - b^3 = (a - b)(a^2 + ab + b^2) = 0

forces a=ba = b, because the second factor is positive except at a=b=0a = b = 0. So an inverse exists. To find it, write y=x3+1y = x^3 + 1 and solve for xx:

y1=x3x=y13.y - 1 = x^3 \quad\Longrightarrow\quad x = \sqrt[3]{y - 1}.

Renaming the input, the candidate is f1(x)=x13f^{-1}(x) = \sqrt[3]{x - 1}. Verify both orders:

(f1f)(x)=(x3+1)13=x33=x,(f^{-1} \circ f)(x) = \sqrt[3]{(x^3 + 1) - 1} = \sqrt[3]{x^3} = x,(ff1)(x)=(x13)3+1=(x1)+1=x.(f \circ f^{-1})(x) = \left(\sqrt[3]{x - 1}\right)^3 + 1 = (x - 1) + 1 = x.

Both give xx across all of R\mathbb{R}, so f1(x)=x13f^{-1}(x) = \sqrt[3]{x - 1} is confirmed. Solving for xx produced a candidate; the two-sided check is what turned the candidate into a proof.

Worked example 4 Inverting a linear-fractional rule

Find the inverse of f(x)=xx2f(x) = \dfrac{x}{x - 2} on x2x \ne 2, and state the domain of the inverse.

Write y=xx2y = \dfrac{x}{x - 2} and solve for xx. Clear the denominator, then gather every term containing xx on one side:

y(x2)=xyx2y=xyxx=2y.y(x - 2) = x \quad\Longrightarrow\quad yx - 2y = x \quad\Longrightarrow\quad yx - x = 2y.

Now factor xx out of the left side and divide:

x(y1)=2yx=2yy1.x(y - 1) = 2y \quad\Longrightarrow\quad x = \frac{2y}{y - 1}.

So f1(x)=2xx1f^{-1}(x) = \dfrac{2x}{x - 1}. The move that carries any linear-fractional rule is exactly this one, collect the xx terms, factor, then divide. For the domain, the inputs of f1f^{-1} are the values ff actually produces, and ff never outputs 11, since xx2=1\frac{x}{x - 2} = 1 forces x=x2x = x - 2, which is impossible. So domf1\operatorname{dom} f^{-1} excludes 11, matching the denominator of the formula 2xx1\frac{2x}{x - 1}.

Check your understanding

Taking each function's codomain to be its range, which one has an inverse?

Answer choices

The question Chapter one asked

The first lesson of this chapter, Relations and Functions, opened with a claim that can now be cashed in. It said that whether a set of points is a function depends on which variable you feed in. It added: the horizontal line test is nothing but the vertical line test asked about the other variable, and swapping the two variables reflects the whole picture across y=xy = x. It promised that this swap is exactly what forming an inverse would mean. Here is that promise paid.

A function ff is, underneath, its set of input-output pairs (a,f(a))(a, f(a)). Swapping the two coordinates of every pair produces a new set of points,

{(f(a),a):aA},\{\, (f(a),\, a) : a \in A \,\},

the inverse relation: the same pairings read backward, output first. That swapped relation is a function of its first coordinate exactly when no two of its pairs share that first coordinate. That in turn means no two pairs of ff share the same second coordinate, which means no two inputs of ff produce the same output. That last phrase is one-to-one, and on a graph it is the horizontal line test applied to ff. So the swapped relation is a function precisely when ff is one-to-one, and only then is there an inverse function f1f^{-1}.

This is the chapter closing on itself. Being a function was never a property of a curve; it was a property of a curve together with a choice of input. Inverting is the act of changing that choice, feeding in what used to come out. The vertical line test on the swapped picture is the horizontal line test on the original. So the two questions, “can ff be undone” and “does ff pass the horizontal line test”, were the same question in two costumes all along.

Restricting the domain is a real choice

Worked Example 1 showed that f(x)=x2f(x) = x^2 on all real numbers has no inverse, because it fails the horizontal line test: f(2)=f(2)=4f(-2) = f(2) = 4. The standard repair is to shrink the domain until the rule becomes one-to-one. It is worth being honest about what that move is. You are not fixing ff; by the equality test of the Function Notation lesson, a rule together with a smaller domain is a different function. Restricting the domain replaces the function that had no inverse with a neighbouring one that does.

Worked example 5 Two honest restrictions of x2x^2

The rule x2x^2 becomes one-to-one on the inputs x0x \ge 0, and also on the inputs x0x \le 0. Find the inverse in each case.

On the domain x0x \ge 0, the outputs are all the y0y \ge 0, and the input that produced a given yy is the nonnegative square root:

f(x)=x2 (x0)f1(x)=x.f(x) = x^2 \ (x \ge 0) \quad\Longrightarrow\quad f^{-1}(x) = \sqrt{x}.

Check the awkward side: (f1f)(x)=x2=x=x(f^{-1} \circ f)(x) = \sqrt{x^2} = |x| = x, which holds because x0x \ge 0.

On the domain x0x \le 0, the same outputs y0y \ge 0 now arrive from negative inputs, so the inverse is the negative root:

f(x)=x2 (x0)f1(x)=x.f(x) = x^2 \ (x \le 0) \quad\Longrightarrow\quad f^{-1}(x) = -\sqrt{x}.

Check: (f1f)(x)=x2=x=(x)=x(f^{-1} \circ f)(x) = -\sqrt{x^2} = -|x| = -(-x) = x, using x=x|x| = -x for x0x \le 0.

Both restrictions are legitimate, and they give different inverses, x\sqrt{x} and x-\sqrt{x}. So there is no such thing as the restriction that makes x2x^2 invertible; there is a choice, and the choice is part of the answer. This is the same honesty the transformations and composition lessons practised when they refused to call a non-unique decomposition “the” decomposition.

Domain and range trade places

The pair-swap picture makes one more fact plain, and it is worth stating as a small theorem. When you reverse every pair (a,b)(a, b) into (b,a)(b, a), the first and second coordinates switch roles. So the inputs of f1f^{-1} are the outputs of ff, and the outputs of f1f^{-1} are the inputs of ff.

domf1=rangef\operatorname{dom} f^{-1} = \operatorname{range} f and rangef1=domf\operatorname{range} f^{-1} = \operatorname{dom} f#

By the definition of the inverse, f1f^{-1} carries an output of ff back to the input it came from, so its allowed inputs are exactly the values ff actually produces. That set is the range of ff, giving domf1=rangef\operatorname{dom} f^{-1} = \operatorname{range} f.

For the other equation, f1f^{-1} returns inputs of ff, and it returns every one of them, since each adomfa \in \operatorname{dom} f is handed back from b=f(a)b = f(a) by the relation f1(f(a))=af^{-1}(f(a)) = a. So the outputs of f1f^{-1} are precisely domf\operatorname{dom} f, giving rangef1=domf\operatorname{range} f^{-1} = \operatorname{dom} f.

This is the structural version of a fact the earlier lessons kept circling: the domain is genuine data. Inverting does not merely flip a formula; it swaps the two sets a function lives between. In the example just above, f(x)=x2f(x) = x^2 on x0x \ge 0 has range y0y \ge 0, and its inverse x\sqrt{x} has domain x0x \ge 0 and range y0y \ge 0, the two sets traded exactly as the theorem says.

Reading the inverse off the graph

The coordinate swap has a picture. A point (a,b)(a, b) lies on the graph of ff exactly when b=f(a)b = f(a), and that is exactly when (b,a)(b, a) lies on the graph of f1f^{-1}. So the graph of f1f^{-1} is the set of points (b,a)(b, a) as (a,b)(a, b) runs over the graph of ff. The map that sends every point (a,b)(a, b) to (b,a)(b, a) is reflection in the line y=xy = x: it fixes that line and exchanges the horizontal and vertical directions. Therefore the graph of f1f^{-1} is the mirror image of the graph of ff across y=xy = x. That is not by decree but because inverting is swapping coordinates, and swapping coordinates is that reflection.

A function and its inverse as mirror images across y = xThe parabola x squared restricted to nonnegative inputs and the square root function are reflections of each other in the dashed line y = x, meeting it at the origin and at (1, 1).1212y = x√x(1, 1)
The rule x squared on the inputs x greater than or equal to zero, drawn as the steeper curve, and its inverse the square root, drawn as the shallower curve. Each is the mirror image of the other across the dashed line y = x, and the two curves meet on that line at the origin and at the point (1, 1).

Reflection across y=xy = x also preserves a graph’s direction, and this is worth pinning down because it is easy to assume without proof. If ff is increasing, so is f1f^{-1}. To see it, take two values u<vu < v in the range of ff and pull them back through ff, writing u=f(a)u = f(a) and v=f(b)v = f(b), so a=f1(u)a = f^{-1}(u) and b=f1(v)b = f^{-1}(v). If aba \ge b held, the increasing ff would give f(a)f(b)f(a) \ge f(b), that is uvu \ge v, contradicting u<vu < v; so a<ba < b, which says f1(u)<f1(v)f^{-1}(u) < f^{-1}(v). A rising graph reflects to a rising graph, and by the same argument a falling one reflects to a falling one.

That mirror is a reliable way to picture an inverse, and it is also where a tempting falsehood creeps in, the kind this chapter has spent six lessons hunting. It is often said that the graphs of ff and f1f^{-1} can meet only on the line y=xy = x. That is false. The reflection carries the two graphs into each other, so their set of common points is symmetric across y=xy = x. But a set can be symmetric across a line without lying on it. The extreme case is a function that is its own inverse: f(x)=1xf(x) = \dfrac{1}{x} satisfies f(f(x))=xf(f(x)) = x, so the graph of ff and the graph of f1f^{-1} are the very same curve. The two graphs therefore meet at every one of its points, including (2,12)\left(2, \tfrac{1}{2}\right), which is nowhere near y=xy = x. A non-degenerate example makes the point without that coincidence.

Worked example 6 Where f(x)=x3f(x) = -x^3 meets its inverse

The function f(x)=x3f(x) = -x^3 on all real numbers is one-to-one, and its inverse is f1(x)=x3f^{-1}(x) = -\sqrt[3]{x}, the negative of the real cube root. Find every point the two graphs share.

A shared point is an xx with f(x)=f1(x)f(x) = f^{-1}(x), so set the two rules equal:

x3=x3x3=x3.-x^3 = -\sqrt[3]{x} \quad\Longrightarrow\quad x^3 = \sqrt[3]{x}.

Cube both sides to clear the root, writing x3\sqrt[3]{x} as x1/3x^{1/3}:

x9=xx9x=0x(x81)=0.x^9 = x \quad\Longrightarrow\quad x^9 - x = 0 \quad\Longrightarrow\quad x(x^8 - 1) = 0.

The solutions are x=0x = 0 and x8=1x^8 = 1, that is x=1x = 1 and x=1x = -1. Read off the meeting points: at x=0x = 0 the graphs meet at (0,0)(0, 0), which lies on y=xy = x; at x=1x = 1 they meet at (1,1)(1, -1); and at x=1x = -1 they meet at (1,1)(-1, 1). Check the last two on both graphs: f(1)=1f(1) = -1 and f1(1)=13=1f^{-1}(1) = -\sqrt[3]{1} = -1, so (1,1)(1, -1) sits on each; and f(1)=1f(-1) = 1 with f1(1)=13=1f^{-1}(-1) = -\sqrt[3]{-1} = 1, so (1,1)(-1, 1) does too. Two of the three meeting points, (1,1)(1, -1) and (1,1)(-1, 1), are not on y=xy = x. The claim that intersections can happen only on that line is simply wrong.

The graphs of f and its inverse crossing off the line y = xThe curve minus x cubed and the curve minus the cube root of x are reflections across the dashed line y = x, but they meet at (-1, 1) and (1, -1), neither on that line.y = xff⁻¹(-1, 1)(1, -1)
The decreasing function f sending x to minus x cubed and its inverse, the function sending x to minus the cube root of x. The two curves are mirror images across the dashed line y = x, yet they cross at (-1, 1) and (1, -1), marked with dots, neither of which lies on that line.

There is a true statement nearby, and keeping it apart from the false one is the whole discipline of this chapter. If f(a)=af(a) = a, then aa is a fixed point: the point (a,a)(a, a) lies on y=xy = x, and since f1(a)=af^{-1}(a) = a as well, it lies on both graphs. So every fixed point is a common point sitting on the line y=xy = x. That is the one direction that holds. Its converse, that every common point is such a fixed point, is the claim Worked Example 6 just refuted. For a strictly increasing ff the two directions do coincide, and then every intersection really does land on y=xy = x, which is why the false version sounds right. But increasing is a hypothesis, not a general truth, and f(x)=x3f(x) = -x^3 is decreasing, so it is free to break the pattern.

Check your understanding

Which statement about the graphs of a one-to-one function ff and its inverse f1f^{-1} is correct?

Answer choices

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)

Mathematics sometimes gets a definition right by accident, and notices only years later.

Heinrich Weber, a German mathematician, wrote down axioms for a group in 1882. He asked for three things. Combining two elements must give a third element of the system. The combining must be associative. And you may cancel: from ab=acab = ac it follows that b=cb = c. Nowhere did he ask that inverses exist. His definition was correct anyway, because every group he had in mind was finite. On a finite set, cancellation quietly delivers the inverses for nothing.

The reason is a counting argument. On a finite set, a map that never sends two inputs to one output must reach every element. Its outputs are all different, so there are as many of them as there are inputs. Nothing is left over to be missed. A one-sided inverse on a finite set is therefore two-sided already. The gap this lesson warns about cannot open there.

The functions here live where that argument collapses. On the whole real line, squaring sends two inputs to one output and still leaves outputs unused. That is why the square root undoes it from one side and fails from the other. Weber came to see this himself. His textbook of 1895 says that the infinite case must ask for inverses outright. That demand is the pair of compositions this lesson made you check by hand.