Composition and Inverse Functions
Composition applies one function to the result of another, written (f ∘ g)(x) = f(g(x)), and an inverse function undoes a function, written f−1. In brief: if f(x) = 2x + 3 and g(x) = x2, then f(g(x)) = 2x2 + 3. The inverse of f is f−1(x) = (x − 3)/2, because f−1(f(x)) = x.
Composition builds complicated functions from simple ones, and inverses let you solve for the input when you know the output. Both ideas are central in algebra, logarithms and calculus (the chain rule). This guide explains how to compose functions, when an inverse exists, how to find it step by step and how its graph relates to the original.
How do you compose two functions?
The composition f ∘ g, read “f of g”, means: first apply g, then apply f to the result. So (f ∘ g)(x) = f(g(x)). The order matters. To evaluate, substitute the whole expression g(x) wherever f has an x.
Example 1
Let f(x) = 2x + 3 and g(x) = x2. Then f(g(x)) = 2x2 + 3, but g(f(x)) = (2x + 3)2 = 4x2 + 12x + 9. The two results are different, so composition is generally not commutative. For x = 2: f(g(2)) = f(4) = 11, and g(f(2)) = g(7) = 49.
Example 2: domain
Let f(x) = √x and g(x) = x − 4. Then f(g(x)) = √(x − 4), with domain x ≥ 4. The domain of f ∘ g consists of the x in the domain of g for which g(x) lies in the domain of f.
Example 3: decomposing
The function h(x) = (3x − 1)5 can be written as f(g(x)) with g(x) = 3x − 1 and f(x) = x5. Spotting such an inner and outer function is the first step of the chain rule in calculus.
What is an inverse function?
The inverse of f, written f−1, reverses f: if f(a) = b then f−1(b) = a. Formally, f−1(f(x)) = x for all x in the domain of f, and f(f−1(y)) = y for all y in the range. The notation f−1 is not a reciprocal: f−1(x) ≠ 1/f(x).
An inverse function exists only if f is one-to-one, meaning that different inputs give different outputs. Graphically, this is the horizontal line test: every horizontal line meets the graph at most once. The function y = x2 fails it, since 2 and −2 both give 4. Restricting the domain to x ≥ 0 makes it one-to-one, and the inverse is √x. Strictly monotonic functions always pass the test.
How do you find an inverse function step by step?
- Check that f is one-to-one, or restrict its domain.
- Write y = f(x).
- Swap x and y.
- Solve the new equation for y.
- Write y = f−1(x) and state the domain and range, which are the range and domain of f.
- Check by composing: f(f−1(x)) = x.
Example 4: f(x) = 3x − 7
y = 3x − 7. Swap: x = 3y − 7. Solve: y = (x + 7)/3. So f−1(x) = (x + 7)/3. Check: f((x + 7)/3) = 3 · (x + 7)/3 − 7 = x ✓.
Example 5: f(x) = (x + 1)/(x − 2), x ≠ 2
Swap: x = (y + 1)/(y − 2). Then x(y − 2) = y + 1, so xy − 2x = y + 1, so y(x − 1) = 2x + 1, giving y = (2x + 1)/(x − 1). The inverse has domain x ≠ 1, which is the range of f.
Example 6: f(x) = x2 + 1 for x ≥ 0
Swap and solve: x = y2 + 1, so y = √(x − 1), where the positive root is chosen because y ≥ 0. Domain x ≥ 1.
How are the graphs of f and f−1 related?
The graph of f−1 is the reflection of the graph of f in the line y = x. Every point (a, b) of f corresponds to the point (b, a) of f−1. For f(x) = x3, the point (2, 8) is mapped to (8, 2) on the graph of ∛x. Because of this reflection, the domain and the range switch roles.
Common functions and their inverses
| f(x) | f−1(x) | Condition |
|---|---|---|
| x + a | x − a | none |
| ax (a ≠ 0) | x/a | none |
| x2 | √x | x ≥ 0 for f |
| x3 | ∛x | none |
| 1/x | 1/x | x ≠ 0 |
| 2x | log2 x | x > 0 for the inverse |
| ex | ln x | x > 0 for the inverse |
Where do these ideas come from?
Inverse operations are as old as arithmetic: subtraction undoes addition and division undoes multiplication. Inverse functions came into focus with logarithms, introduced by John Napier in the early seventeenth century as a way of turning multiplication into addition. The notation f−1 and the composition symbol ∘ were adopted in the nineteenth and twentieth centuries, when functions became objects of study in their own right.
Where are composition and inverses used today?
Converting Celsius to Fahrenheit is F = 1.8C + 32, and the inverse C = (F − 32)/1.8 converts back. A price after a discount and then tax is a composition of two functions. In computing, encryption and decryption are inverses, and a program is often a composition of simple steps. Logarithms inverting exponentials are used to solve for time in growth problems.
Which mistakes are common?
Confusing f−1 with 1/f
For f(x) = 2x, f−1(x) = x/2 and 1/f(x) = 1/(2x).
Wrong order in a composition
(f ∘ g)(x) means apply g first. Work from the inside out.
Ignoring one-to-one
x2 has no inverse on all real numbers. State the restriction before finding √.
Forgetting the domain after swapping
The domain of f−1 is the range of f, which can be smaller than all real numbers.