In short
A function f: A \to B has an inverse f^{-1}: B \to A if and only if f is bijective (one-one and onto). The inverse satisfies f^{-1}(f(x)) = x for all x \in A and f(f^{-1}(y)) = y for all y \in B. To find it algebraically, swap x and y in the equation y = f(x) and solve for y. Graphically, the graph of f^{-1} is the reflection of the graph of f in the line y = x.
A vending machine takes a code and gives you a snack. Code A3 gives you chips, B2 gives you a samosa, C1 gives you biscuits. If you know the code, you know the snack. But can you go backwards — if someone hands you a samosa, can you figure out which code was pressed?
You can, but only under two conditions. First, no two codes should give the same snack (otherwise, given a samosa, you would not know if it was B2 or D4). Second, every snack in the machine should have a code (otherwise, some snacks have no code to trace back to). The first condition is injectivity. The second is surjectivity. Together, they make the function bijective — and that is exactly when reversal works.
The reversed function — the one that takes a snack and returns the code — is called the inverse.
When does an inverse exist?
Inverse function
Let f: A \to B be a bijection. The inverse function f^{-1}: B \to A is the function satisfying:
Equivalently: f^{-1} \circ f = \text{id}_A and f \circ f^{-1} = \text{id}_B, where \text{id} is the identity function.
Both conditions — one-one and onto — are essential. Here is what goes wrong if either fails.
Without one-one: Take f(x) = x^2 on \mathbb{R}. Then f(3) = 9 and f(-3) = 9. If you try to define f^{-1}(9), you get two answers: 3 and -3. A function must give exactly one output, so f^{-1} is not well-defined.
Without onto: Take f: \mathbb{R} \to \mathbb{R} with f(x) = e^x. The range is (0, \infty), not all of \mathbb{R}. If you try f^{-1}(-5), there is no input whose exponential is -5. The inverse has no value to assign to -5.
A bijective function avoids both problems. One-one ensures each output has at most one preimage. Onto ensures each output has at least one preimage. Together: each output has exactly one preimage, so the reversal is a well-defined function.
Finding the inverse algebraically
The recipe has three steps:
- Write y = f(x).
- Swap x and y to get x = f(y).
- Solve for y. The result is f^{-1}(x).
The swap makes sense: if the original function converts input x into output y, the inverse converts input y back into x. Relabelling y as the new input and x as the new output is exactly this reversal.
The graph of the inverse: reflection in y = x
If the point (a, b) lies on the graph of f, then f(a) = b, which means f^{-1}(b) = a, so (b, a) lies on the graph of f^{-1}. Every point (a, b) gets swapped to (b, a).
Geometrically, swapping coordinates is a reflection in the line y = x. The point (a, b) and the point (b, a) are mirror images across this diagonal. So the graph of f^{-1} is the reflection of the graph of f in the line y = x.
This reflection property gives you a quick way to sketch the inverse: draw the line y = x, then "fold" the original graph across it.
Properties of inverse functions
1. Composing with the inverse gives the identity.
These are the defining equations. They say that f and f^{-1} undo each other, in either order.
2. The inverse of the inverse is the original.
If you reverse the reversal, you get back to where you started.
3. The inverse of a composite reverses the order.
Think of putting on socks and shoes. You put on socks first, then shoes. To undo this, you take off shoes first, then socks. The last operation you did is the first one you undo. This is the same pattern: the inverse of "first g, then f" is "first undo f, then undo g."
4. The domain of f^{-1} is the range of f, and the range of f^{-1} is the domain of f.
This follows directly from the swap: f maps A to B; f^{-1} maps B to A.
5. The graph of f^{-1} is the reflection of the graph of f in the line y = x.
This was shown above. It is the graphical consequence of swapping coordinates.
Two worked examples
Example 1: Finding the inverse of a linear function
Let f: \mathbb{R} \to \mathbb{R} be f(x) = \dfrac{3x - 7}{2}.
Step 1. Write y = f(x):
Why: set up the equation relating input x and output y.
Step 2. Swap x and y:
Why: in the inverse, the old output becomes the new input.
Step 3. Solve for y:
Why: isolate y to express the inverse as a function of x.
Step 4. Verify: f^{-1}(f(x)) = f^{-1}\!\left(\frac{3x-7}{2}\right) = \frac{2 \cdot \frac{3x-7}{2} + 7}{3} = \frac{3x - 7 + 7}{3} = \frac{3x}{3} = x. Checks out.
Why: the round-trip f^{-1} \circ f must return every input unchanged. This confirms the algebra.
Result: f^{-1}(x) = \dfrac{2x + 7}{3}.
Both lines have different slopes (3/2 and 2/3), and each is the other's reflection. The slopes are reciprocals — this always happens for linear functions, because reflecting a line across y = x flips the rise-over-run.
Example 2: Finding the inverse of a restricted quadratic
Let f: [0, \infty) \to [0, \infty) be f(x) = x^2.
On all of \mathbb{R}, f(x) = x^2 is not one-one (since f(3) = f(-3)). But restricted to [0, \infty), it is: if x_1, x_2 \ge 0 and x_1^2 = x_2^2, then x_1 = x_2 (both are non-negative, so the negative root is excluded). And the range of x^2 on [0, \infty) is [0, \infty) — matching the codomain. So f is bijective on this restricted domain.
Step 1. Write y = x^2, with x \ge 0 and y \ge 0.
Why: the domain restriction x \ge 0 is essential — it is what makes the function one-one.
Step 2. Swap: x = y^2, with y \ge 0.
Why: the new variable y inherits the non-negativity constraint from the original domain.
Step 3. Solve for y: y = \sqrt{x}.
Why: since y \ge 0, take the positive square root only.
Step 4. Verify: f^{-1}(f(x)) = \sqrt{x^2} = |x| = x (since x \ge 0). And f(f^{-1}(x)) = (\sqrt{x})^2 = x (since x \ge 0).
Result: f^{-1}(x) = \sqrt{x}, with domain [0, \infty) and range [0, \infty).
The restriction to [0, \infty) is what makes the inverse possible. Without it, the parabola curves back on itself, and the horizontal line test fails. Restricting the domain "cuts" the parabola to a piece that is strictly increasing — and strictly increasing functions are always one-one.
Common confusions
-
"f^{-1}(x) means \frac{1}{f(x)}." No. The superscript -1 in f^{-1} denotes the inverse function, not the reciprocal. f^{-1}(x) is the value that f maps to x. The reciprocal of f(x) is written [f(x)]^{-1} or \frac{1}{f(x)}, never as f^{-1}(x).
-
"Every function has an inverse." Only bijections do. A function that is not one-one (like x^2 on \mathbb{R}) or not onto (like e^x from \mathbb{R} to \mathbb{R}) does not have an inverse unless you restrict its domain or codomain.
-
"The inverse is always the same type of function." Not always. The inverse of a quadratic (with restricted domain) is a square root — a different algebraic form. The inverse of an exponential is a logarithm. The graph is always a reflection, but the formula can look completely different.
-
"You can always read the inverse off the graph by reflecting." The reflection works, but the reflected curve might not pass the vertical line test if the original function was not one-one. If you reflect the full parabola y = x^2 across y = x, you get x = y^2, which gives two y-values for each x > 0. That is a relation, not a function. You need the domain restriction first.
-
"If f and g are inverses, then f \circ g = g \circ f." True — both equal the identity. But be careful: f \circ g = \text{id}_B and g \circ f = \text{id}_A. The identity functions are on different sets (A and B). The compositions are equal in behaviour (both return their input) but live in different contexts.
Going deeper
If you can find the inverse of a given bijection algebraically, sketch its graph by reflection, and apply the composition-reversal rule, you are ready for graph transformations and for using inverses to solve equations. The remainder of this section addresses subtleties.
Left inverses and right inverses
Even when a function is not bijective, partial inverses can exist.
A function h: B \to A is a left inverse of f: A \to B if h \circ f = \text{id}_A. This undoes f from the left. A left inverse exists if and only if f is injective.
A function h: B \to A is a right inverse of f: A \to B if f \circ h = \text{id}_B. This undoes f from the right. A right inverse exists if and only if f is surjective.
When f is bijective, the left inverse and the right inverse coincide, and they are both equal to f^{-1}.
Self-inverse functions
Some functions are their own inverse: f^{-1} = f. These are called involutions. The function f(x) = -x is an involution: applying it twice returns the original input. So is f(x) = \frac{1}{x} (on \mathbb{R} \setminus \{0\}). Graphically, an involution is symmetric about the line y = x — its graph is its own reflection.
Interactive: reflection in y = x
Drag the red point along the curve f(x) = 2x + 1 below. A mirror point on the inverse curve tracks its reflection across y = x. The dashed line connecting them is always perpendicular to y = x and bisected by it.
Where this leads next
You now know what an inverse function is, when it exists, how to find it, and what its graph looks like. The next articles build on this.
- Graph Transformations — Translations — shifting a graph left, right, up, or down. The inverse's reflection is one transformation; translations are another.
- Types of Functions — the one-one / onto classification that determines whether an inverse exists.
- Composite Functions — composition is how the inverse is defined: f^{-1} \circ f = \text{id}.
- Injective and Surjective Nature of Composites — when a composite is bijective, and therefore when it has an inverse.
- Graphs of Basic Functions — the parent functions whose inverses you will encounter most often.