Verify a candidate inverse by checking that both compositions equal the identity
Explain why a function has at most one inverse
Decide whether a function is invertible by testing whether it is one-to-one
Find an inverse algebraically and state its domain and range
Justify why restricting a domain to create an inverse is a choice, not a fixed repair
Connect the horizontal line test to swapping each pair (a,b) into (b,a)
An inverse must undo f from both sides
Give the idea its definition. A function g is an inverse of f when composing the two in either
order returns the identity:
g∘f=id on domfandf∘g=id on domg.
Read both halves. The first, g(f(x))=x for every x in the domain of f, says g undoes f: feed
x through f and g brings it back. The second, f(g(x))=x for every x in the domain of g, says
f undoes g 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 1One side is not enough
Let f(x)=x2 with domain all real numbers, and let g(x)=x with domain x≥0. Test both
compositions.
Start with f∘g. For any x≥0,
(f∘g)(x)=f(x)=(x)2=x,
so f∘g is the identity on the domain of g. Stop here and you would call g the inverse of f.
Now test the other order:
(g∘f)(x)=g(x2)=x2=∣x∣.
This equals x when x≥0, but for x<0 it gives −x, not x. For instance (g∘f)(−3)=9=3=−3. So g∘f is not the identity on the domain of f; it collapses every
negative input to its positive twin. The function g undoes f 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)=x2 on all real numbers and g(x)=x on x≥0, a student checks that (f∘g)(x)=x, concludes g=f−1, and adds: "inverses are unique, so no other function could also undo f this way." What is wrong with the student's reasoning?
An inverse must satisfy both g∘f=id and f∘g=id. Here only the second holds.
(g∘f)(x)=x2=∣x∣
For x<0 this is −x=x, so g fails to undo f on the negative inputs, and g is not an inverse of f at all.
The uniqueness fact, that a function cannot have two different inverses, is a statement about functions that already have one; it never promises that an inverse exists in the first place. Since f(x)=x2 on all reals fails the two-sided test no matter what g is tried, f simply has no inverse here, and there is nothing for uniqueness to protect.
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 2A two-sided verification
Show that g(x)=2x−1 is the inverse of f(x)=2x+1, both on all real numbers.
Check g∘f first, substituting f(x) into g:
(g∘f)(x)=g(2x+1)=2(2x+1)−1=22x=x.
Now check f∘g, substituting g(x) into f:
(f∘g)(x)=f(2x−1)=2⋅2x−1+1=(x−1)+1=x.
Both compositions return x for every real number, and both functions have all of R as their
domain, so g=f−1. Each line undid the other: the first canceled “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. Here is why: suppose
g and h both undid f from both directions. Take any output b of f. Since h is an inverse,
f(h(b))=b; feed that into g, and since g undoes f, g(f(h(b)))=h(b). But the left side is also
g(b), because f(h(b))=b. So g(b)=h(b) for every b: g and h agree everywhere, which makes
them the same function. Because there is at most one inverse, we may speak of the inverse of f and
give it the name f−1.
Check your understanding
In the uniqueness argument, g and h both undo f from both sides. For an output b of f, the single expression g(f(h(b))) is read two ways: inside-out as g(f(h(b)))=g(b) (using f(h(b))=b, since h undoes f), and regrouped as (g∘f)(h(b))=h(b) (using g∘f=id, since g undoes f). What justifies reading the same expression both ways?
Associativity says g∘(f∘h) and (g∘f)∘h are the same function, so applying that function to b gives one value no matter how you group the three applications.
Grouping inside-out uses f(h(b))=b (from f∘h=id, since h undoes f) to get g(b). Grouping the other way uses g∘f=id (since g undoes f) to get h(b) directly, because h(b) is an input of f. Since both groupings compute the same value, g(b)=h(b): that is the whole proof, built from the two defining equations of a two-sided inverse plus associativity, not from commutativity (composition is not commutative in general) and not by assuming the conclusion.
That name carries a warning you first met at the end of the previous lesson. The superscript in f−1
marks the inverse for composition, and it never means the reciprocal f1. For f(x)=x+3
the inverse is f−1(x)=x−3, while the reciprocal (f(x))−1=x+31 is a
completely different function. Keep f−1 for undoing and f1 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) forces a=b. With the codomain fixed as the range, invertibility and
one-to-oneness are the same condition.
Here is why. Draw an arrow from each input to the output it produces. If f is one-to-one, no two arrows
point at the same output, so every output in the range has exactly one arrow pointing at it. Reverse every
arrow and you get a new set of arrows, one leaving each output and landing back on the input it came from,
and that is a function: it is f−1. If instead two arrows had pointed at the same output, reversing
them would leave that output with two arrows going out to two different inputs, which is not a function at
all, since a function may only give one answer per input. So the reversed arrows form a function exactly
when the original arrows never collided, which is exactly one-to-one.
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 g
can satisfy f∘g=id there. That is because f(g(b)) is always a genuine output of
f, and it can never equal a value that f misses. With a larger codomain the correct condition is that
f 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 3Finding an inverse, then proving it
Find the inverse of f(x)=x3+1 on all real numbers, and verify it on both sides.
Write y=x3+1 and solve for x:
y−1=x3⟹x=3y−1.
Renaming the input, the candidate is f−1(x)=3x−1. Solving only produces a candidate, so
verify both orders before trusting it:
Both give x across all of R, so f−1(x)=3x−1 is confirmed. Notice that this
check alone is enough: it proves f has an inverse and pins down exactly what it is, all in one step, with
no separate one-to-one argument needed first.
Worked example 4Inverting a linear-fractional rule
Find the inverse of f(x)=x−2x on x=2, and state the domain of the inverse.
Write y=x−2x and solve for x. Clear the denominator, then gather every term containing
x on one side:
y(x−2)=x⟹yx−2y=x⟹yx−x=2y.
Now factor x out of the left side and divide:
x(y−1)=2y⟹x=y−12y.
So f−1(x)=x−12x. The move that carries any linear-fractional rule is exactly this one,
collect the x terms, factor, then divide. Check both orders before trusting the candidate:
Both collapse to x. For the domain, the inputs of f−1 are the values f actually produces, and f
never outputs 1, since x−2x=1 forces x=x−2, which is impossible. So
domf−1 excludes 1, matching the denominator of the formula x−12x.
Check your understanding
Consider f(x)=x+13x on x=−1. Which statement correctly decides whether f has an inverse and, if so, finds it?
Write y=x+13x, clear the denominator, and collect the x terms on one side.
y(x+1)=3x⟹yx+y=3x⟹x(y−3)=−y
Dividing gives x=y−3−y=3−yy, so f−1(x)=3−xx. Solving for x produced one expression with no branching choice, which both shows f is one-to-one and pins down the inverse in the same step, the same shortcut Worked Example 3 used.
The domain of f−1 is the range of f: f never outputs 3, since x+13x=3 would force 3x=3x+3, which is impossible. So domf−1 excludes 3, matching the denominator of 3−xx. The third option mistakes the inverse for the reciprocal 1/f, and the fourth forgets to actually solve for x.
Swapping pairs is what inverting really does
Take the three pairs (1,4),(2,7),(3,10), the input-output pairs of some function f. Swap every
pair’s coordinates and you get (4,1),(7,2),(10,3): the same information, read backward, output
first. Every input of f becomes an output, and every output becomes an input. That swapped set of pairs
is exactly f−1, when it is a function at all.
Now try it on a function that is not one-to-one: (−2,4) and (2,4). Swapping gives (4,−2) and
(4,2), two different pairs that start with the same first number, 4. A function may only give one
answer per input, so this swapped set is not a function; there is no way to know whether 4 should go
back to −2 or to 2. A repeated output is exactly what breaks the swap.
This connects to a claim from the first lesson of this chapter, Relations and Functions: swapping the two
variables reflects the whole picture across y=x, and the horizontal line test is the vertical line
test asked about the swapped picture. Both claims are now proven at once. A function f is, underneath,
its set of pairs (a,f(a)). Swapping every pair gives the inverse relation, and that swapped set is a
function of its first coordinate exactly when no two of f‘s pairs share a second coordinate, that is,
exactly when f is one-to-one, which on a graph is the horizontal line test. So the swapped relation is a
function precisely when f passes the horizontal line test, and only then is there an inverse function
f−1.
Being a function was never a property of a curve alone; it was a property of a curve together with a
choice of input. Inverting changes that choice, feeding in what used to come out. So “can f be undone”
and “does f pass the horizontal line test” are the same question asked two ways.
Restricting the domain is a real choice
Worked Example 1 showed that f(x)=x2 on all real numbers has no inverse, because it fails the
horizontal line test: f(−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 f; 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 neighboring one that
does.
Worked example 5Two honest restrictions of x2
The rule x2 becomes one-to-one on the inputs x≥0, and also on the inputs x≤0. Find the
inverse in each case.
On the domain x≥0, the outputs are all the y≥0, and the input that produced a given y is the
nonnegative square root:
f(x)=x2(x≥0)⟹f−1(x)=x.
Check both orders. The easy side is (f∘f−1)(x)=(x)2=x for x≥0, the domain of
f−1. The awkward side is (f−1∘f)(x)=x2=∣x∣=x, which holds because x≥0.
On the domain x≤0, the same outputs y≥0 now arrive from negative inputs, so the inverse is
the negative root:
f(x)=x2(x≤0)⟹f−1(x)=−x.
Check both orders again. (f∘f−1)(x)=(−x)2=x for x≥0, the domain of f−1.
And (f−1∘f)(x)=−x2=−∣x∣=−(−x)=x, using ∣x∣=−x for x≤0.
Both restrictions are legitimate, and they give different inverses, x and −x. So there
is no such thing as the restriction that makes x2 invertible; there is a choice, and the choice is
part of the answer.
Check your understanding
Take the pairs (0,0),(1,1),(2,4),(3,9) from f(x)=x2 restricted to x≥0. A classmate says: (1) 'swapping every pair to (b,a) gives a function here because no two of these pairs share a second coordinate,' and (2) 'x≥0 is the one restriction that fixes x2, since it worked.' Which claim, if either, is correct?
Swapping each pair (a,a2) to (a2,a) is a function of its first coordinate exactly when no two of the original pairs share a second coordinate, that is, exactly when f passes the horizontal line test. On x≥0, no two different nonnegative inputs give the same square, so the swap really is a function here, confirming claim (1).
But Worked Example 5 restricted x2 two honest ways.
f(x)=x2(x≥0)⇒f−1(x)=xf(x)=x2(x≤0)⇒f−1(x)=−x
Both restrictions pass the horizontal line test on their own domain and give different, equally valid inverses, so x≥0 is a fix, not the fix, and claim (2) is false.
Domain and range trade places
Swapping every pair (a,b) into (b,a) swaps the two coordinates’ roles: the inputs of f−1 are the
outputs of f, and the outputs of f−1 are the inputs of f. In symbols,
domf−1=rangef and rangef−1=domf.
For the x2 example just above, that swap is easy to miss, because x≥0 happened to be both the
domain of f and the range of x. Here is a case where domain and range actually look different.
Let f(x)=x+3 on 0≤x≤5. Its outputs run from f(0)=3 to f(5)=8, so its range is
3≤y≤8. The inverse is f−1(x)=x−3, and by the swap its domain is 3≤x≤8, the
range f just had, while its own range is 0≤y≤5, the domain f just had. Inverting does not
merely flip a formula; it swaps the two sets a function lives between, and the domain is genuine data,
carried along with the rule.
Check your understanding
Let f(x)=2x−1 on the domain 1≤x≤4, so its range is 1≤y≤7. What are the domain AND range of f−1?
Domain and range trade places: domf−1=rangef=[1,7], and rangef−1=domf=[1,4].
f−1(x)=2x+1 confirms it: f−1(1)=1 and f−1(7)=4, so as x runs over [1,7] the output runs over [1,4], matching the swapped domain and range exactly.
Reading the inverse off the graph
The coordinate swap has a picture. A point (a,b) lies on the graph of f exactly when b=f(a), and
that is exactly when (b,a) lies on the graph of f−1. So the graph of f−1 is the set of points
(b,a) as (a,b) runs over the graph of f. The map that sends every point (a,b) to (b,a) is
reflection in the line y=x: it fixes that line and exchanges the horizontal and vertical directions.
Therefore the graph of f−1 is the mirror image of the graph of f across y=x. That is not by
decree but because inverting is swapping coordinates, and swapping coordinates is that reflection.
The rule x squared on the inputs x greater than or equal to zero, labeled x squared, and its inverse the square root, labeled square root of x. 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=x also preserves a graph’s direction: if f is increasing, so is f−1, and if
f is decreasing, so is f−1. Here is why: “increasing” means that whenever the input goes up, the
output goes up too, so an input-step and its matching output-step always point the same way. Swapping
coordinates swaps which one you call the input, but it cannot flip just one of the two steps, so they
still point the same way after the swap. A rising curve reflects to a rising curve, and a falling one to a
falling one.
That mirror is a reliable way to picture an inverse, with one caution. It is tempting to think the two
graphs can only meet on the line y=x, since that is where the mirror itself sits. That is not true in
general: the reflection carries the two graphs into each other, so wherever they cross, the crossings
mirror each other too, but a set can mirror itself without lying entirely on the mirror line. What is
always true is narrower: if f(a)=a for some input a, then a is a fixed point, (a,a) sits on
y=x, and since f−1(a)=a too, that point lies on both graphs. So every fixed point is a common
point on y=x, but a common point off y=x can still happen, as the next example shows.
Worked example 6Where f(x)=−x3 meets its inverse
The function f(x)=−x3 on all real numbers is one-to-one, and its inverse is f−1(x)=−3x,
the negative of the real cube root. Find every point the two graphs share.
A shared point is an x with f(x)=f−1(x), so set the two rules equal:
−x3=−3x⟹x3=3x.
Cube both sides to clear the root, writing 3x as x1/3:
x9=x⟹x9−x=0⟹x(x8−1)=0.
The solutions are x=0 and x8=1, that is x=1 and x=−1. Read off the meeting points: at
x=0 the graphs meet at (0,0), which lies on y=x; at x=1 they meet at (1,−1); and at
x=−1 they meet at (−1,1). Check the last two on both graphs: f(1)=−1 and f−1(1)=−31=−1, so (1,−1) sits on each; and f(−1)=1 with f−1(−1)=−3−1=1, so
(−1,1) does too. Two of the three meeting points, (1,−1) and (−1,1), are not on y=x: the claim
that intersections can happen only on y=x is false in general, even though it happens to be true
whenever f is increasing, since f(x)=−x3 is decreasing.
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.
Common mistakes
Practice
Multiple Choice Questions (MCQ)
Progressively harder sets of questions. Each opens on its own page.
Practice problems at the level of the course, to be worked out on paper. Hints one at a
time, then the answer or the full worked solution, with your progress kept in this browser.
You can skip this and keep going. Read it if you want to know more.
Why an inverse can never have a rival
The main lesson gives the reason in plain words. Here is the formal version, which pins down exactly
where the previous lesson’s associative law is needed.
Suppose g and h are both inverses of f. Write A for the domain of f and B for its range, so
f sends A to B while g and h send B back to A. Being inverses means g∘f=idA and f∘g=idB, and likewise h∘f=idA
and f∘h=idB.
Now run a single chain and justify each step:
g=g∘idB=g∘(f∘h)=(g∘f)∘h=idA∘h=h.
The first equality composes g with the identity on B, its own domain, which changes nothing. The
second replaces idB by f∘h, equal to it because h is an inverse of f. 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 g∘f=idA, and the last drops the identity on A. So g=h:
any two inverses of f are the same function. 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.
∎
Proving invertible means one-to-one, in both directions
The main lesson explains this with arrows. Here is the same claim proved both ways.
With codomain taken as the range, f is invertible exactly when it is one-to-one#
Take f with domain A and codomain its range B=f(A), so every element of B equals f(a) for at
least one a∈A.
Suppose first that f is one-to-one. Each b∈B is f(a) for at least one a, because B is the
range, and for at most one a, because f is one-to-one, so for exactly one. Define g(b) to be that
unique a. Then for every a∈A we get g(f(a))=a, since a is the one input that f sends to
f(a), so g∘f=idA. Likewise, for every b∈B we get f(g(b))=b, since
g(b) was chosen as an input that f sends to b, so f∘g=idB. Both sides hold, so
g is a two-sided inverse.
Conversely, suppose f has an inverse g. If f(a1)=f(a2), apply g to both sides. Because
g∘f=idA,
a1=g(f(a1))=g(f(a2))=a2,
so equal outputs force equal inputs and f is one-to-one. That settles both directions.
∎
Why reflecting across y = x preserves direction
The main lesson states this fact. Here is a proof that it holds for every increasing function, not just
the ones a picture happens to show.
Take two values u<v in the range of f and pull them back through f, writing u=f(a) and
v=f(b), so a=f−1(u) and b=f−1(v). If a≥b held, the increasing f would give
f(a)≥f(b), that is u≥v, contradicting u<v; so a<b, which says 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.
∎
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 either side: from ab=ac it follows that b=c, and from
ba=ca it also follows that b=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. Combining with a fixed element a is itself a map from the set to
itself, sending each x to ax, and cancellation says that map never sends two inputs to one output.
On a finite set, a map from a set to itself 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 elements, and nothing
is left over to be missed. A one-sided inverse for a map of a finite set to itself 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.