Composition applies one function to the output of another: (f∘g)(x)=f(g(x)), with g applied first. An inverse function undoes a function, so f−1(f(x))=x. Only a one-to-one function, one whose graph passes the horizontal line test, has an inverse. To find it, solve y=f(x) for x, then swap the names of the variables.
A jacket costs $40. The store takes 25% off, and you also have a $5 coupon. Take the discount first and the price goes to 0.75×40=$30, then the coupon makes it $25. Use the coupon first and the price goes to $35, then the discount makes it 0.75×35=$26.25. The same two steps in the other order cost $1.25 more.
Each step is a function. The discount is d(p)=0.75p and the coupon is c(p)=p−5. Doing one and then the other is a composition, a new function built by feeding one output into the next.
Now run the first order backward. The receipt says $25. Put the coupon back to get $30, then undo the 25% off by dividing by 0.75 to get $40. Undoing goes through the steps in reverse order, each one replaced by its opposite.
Two orders for the same two steps, starting at $40
Order
After the first step
After the second step
Discount, then coupon
0.75×40=30
30−5=25
Coupon, then discount
40−5=35
0.75×35=26.25
Undo the first order
25+5=30
30÷0.75=40
The rule
Composition
The composition of f and g, written f∘g and read “f of g”, applies g first and then f to the result. (f∘g)(x)=f(g(x)). The function written closer to x acts first, so in f(g(x))g is the inside function and f the outside one.
A composition is defined at x only when both steps are. x must be in the domain of g, and the value g(x) must be in the domain of f.
(f∘g)(x)=f(g(x))
Inverse functions
The inverse of f, written f−1, undoes f. If f sends a to b, then f−1 sends b back to a. Putting the two together in either order gives back what you started with. f−1(f(x))=x for every x in the domain of f, and f(f−1(x))=x for every x in the domain of f−1.
The −1 in f−1 is a name, not a power. f−1(x) is not 1/f(x). The inputs of f are the outputs of f−1, so the domain of f becomes the range of f−1 and the range of f becomes the domain of f−1.
f(a)=b⟺f−1(b)=a
Which functions have an inverse
A function has an inverse only if it is one-to-one, which means different inputs always give different outputs. On a graph this is the horizontal line test. No horizontal line may cross the graph more than once.
f(x)=3x−4 passes, since a line with slope 3 rises steadily. f(x)=x2 fails, since the line y=4 crosses it at x=−2 and x=2.
Why it works
Why inverses work the way they do
An inverse undoes the steps in reverse order, like taking off shoes before socks. f(x)=3x−4 multiplies by 3 and then subtracts 4. To undo it, add 4 first and then divide by 3, so f−1(x)=(x+4)/3. Check it with a number. f(5)=11, and (11+4)/3=5.
A function that is not one-to-one cannot be undone. x2 sends both −2 and 2to 4. An inverse would have to send 4 back to −2 and also to 2, and a function gives only one output for each input.
The graph of f−1 is the graph of f reflected across the line y=x. Every point (a,b) on f gives the point (b,a) on f−1, and swapping the coordinates is exactly what the mirror y=x does. (5,11) on f becomes (11,5) on f−1.
f(x)=3x−4 ⟹ f−1(x)=3x+4
f(x)=3x−4⟹ f−1(x)=3x+4
The method
Composing two functions
At a number, work from the inside out. For f(x)=x2−3 and g(x)=2x+1,f(g(1)) needs g(1)=3 first, and then f(3)=9−3=6.
As a formula, replace every x in the outside function by the whole inside function, in brackets. f(g(x))=(2x+1)2−3, which expands to 4x2+4x−2. At x=1 the formula gives 4+4−2=6, the same as the step-by-step value.
f(g(x))=(2x+1)2−3=4x2+4x−2
f(g(x))=(2x+1)2−3=4x2+4x−2
Finding an inverse
Work in the order of the table. Solving for x is ordinary algebra, the same as for any equation. The swap at the end only renames the variables, so that the inverse takes its input as x like every other function.
Finding the inverse of f(x)=(x+2)/4
Step
What to do
For f(x)=(x+2)/4
1
Check that f is one-to-one
A line with slope 1/4 passes
2
Write y=f(x)
y=(x+2)/4
3
Solve for x
x=4y−2
4
Swap the names x and y
f−1(x)=4x−2
5
State the domain of f−1, the range of f
Every real number
6
Check that f(f−1(x))=x
(4x−2+2)/4=x
Seeing a composition inside a formula
Many formulas are compositions in disguise. To find the pieces, work the formula out for one number and watch the order of the steps. For √x2+1 at x=2, you find 22+1=5 first and take the root last. The inside is g(x)=x2+1 and the outside is f(u)=√u.
In (3x−5)4, the inside is 3x−5 and the outside raises it to the 4th power. In 1/(x2+4), the inside is x2+4 and the outside takes the reciprocal. Calculus depends on this skill, because its chain rule treats each layer separately.
Where it breaks
Where it breaks
Each step of a composition limits the domain. With f(x)=√x and g(x)=x−4,f(g(x))=√x−4 needs x≥4. In the other order, g(f(x))=√x−4 needs only x≥0.
Simplifying can hide a restriction. With f(x)=x2 and g(x)=√x,f(g(x))=(√x)2 simplifies to x, but it is still defined only for x≥0, because g must accept x first. Find the domain before you simplify.
Composition is neither multiplication nor commutative. For f(x)=2x+1 and g(x)=x2,f(g(3))=f(9)=19,g(f(3))=g(7)=49, and f(3)⋅g(3)=7⋅9=63. Three different numbers.
A function that fails the horizontal line test has no inverse until you restrict its domain. On x≥0,x2 is one-to-one and its inverse is √x. On x≤0 it is also one-to-one, and the inverse there is −√x.
Check your answer
Check your answer
A composite or an inverse can be tested one number at a time.
For a composite, evaluate it at one number twice. Work inside out step by step, then put the number into your formula. The two results must agree.
For an inverse, run a number through f and then through your f−1. You must get the number back. Then do it in the other order. For a proof, simplify f(f−1(x)) and get exactly x.
Graph f, your f−1 and the line y=x together. The two graphs must be mirror images across the line.
To have Chalk check the work, define each function on its own row of a Math box, f(x)=… and g(x)=…. The Checker substitutes the definitions, so a composite formula such as f(g(x))=2x2+1 reads ✓ and a wrong one reads ✗ at an x where the sides differ. Write an inverse as f−1(x)=… under f(x)=…. Chalk confirms it by composing, and values such as f−1(11)=5 read ✓.
A wrong inverse reads ✗ with “Not the inverse: f(f⁻¹(x)) isn’t x.” A composite at a number written on one row, f(g(3))=19, is checked too.
One thing Chalk does not yet do is worth knowing. The box does not know a restricted domain, so it accepts either branch of an inverse. Check the branch with a value from your domain.
If f(3)=8, what can you say about f−1(3)?
Nothing yet. f(3)=8 gives f−1(8)=3, because the inverse sends the output 8 back to the input 3.f−1(3) asks which input f sends to 3, and the fact given says nothing about that. Answering 8 swaps the pair in the wrong place. On the graph of f, the point (3,8) says nothing about where the height 3 is reached.
An algebra of functions
Composition is associative. h(g(f(x))) can be grouped as h∘(g∘f) or (h∘g)∘f, and both give the same function. The identity I(x)=x changes nothing, so f∘I=I∘f=f. It plays the part that 1 plays for multiplication, and f∘f−1=I says f−1 is the opposite of f in that sense.
The inverse of a composition reverses the order, (f∘g)−1=g−1∘f−1. In the jacket case, the price went through d and then c, so undoing it ran through c−1 and then d−1.
Inverses produce new functions. The logarithm is the inverse of an exponential function, and each trigonometric function gets an inverse once its domain is restricted, exactly as x2 did.
(f∘g)−1=g−1∘f−1
Common mistakes
Reading f−1(x) as 1/f(x). For f(x)=3x−4,f−1(x)=(x+4)/3, not 1/(3x−4), because the −1 names the function that undoes f.f(5)=11, and (11+4)/3 gives 5 back, while 1/11 does not.
Applying the functions in the wrong order. With f(x)=2x+1 and g(x)=x2,f(g(3))=f(9)=19, not g(f(3))=49, because the inside function always acts first.
Multiplying instead of composing. f(g(3)) is 19, but f(3)⋅g(3)=7⋅9=63. Composition feeds one output into the next function, it does not multiply the two outputs.
Substituting into only one x. With f(x)=x2−3x and g(x)=x+1,f(g(x))=(x+1)2−3(x+1)=x2−x−2, because every x in f is replaced by the whole of g(x).
Inverting x2 on all real numbers. Solving y=x2 gives x=±√y, two answers, because x2 is not one-to-one. Restrict to x≥0 first, and the inverse is √x.
Simplifying away a domain. With f(x)=x2 and g(x)=√x,f(g(x)) simplifies to x, yet it is defined only for x≥0. Find the domain before simplifying, since g must accept x first.
Key terms
Composition of functions
Feeding one function’s output into another, written f(g(x)) or (f∘g)(x). The inner output has to be an allowed input for the outer function.
Inverse function
A function that undoes another: if f(2)=5, then f−1(5)=2. It exists only when each output comes from one input, and f−1 does not mean 1/f.
One-to-one function
A function in which different inputs always give different outputs. Its graph passes the horizontal line test: no horizontal line meets it more than once. Exactly the one-to-one functions have inverses.
Domain
The set of inputs for which a function or expression is defined. In the real numbers that rules out zero denominators, negative numbers under even roots and inputs of logarithms that aren’t positive.
Function range
All the output values a function actually takes. A graph’s viewing window can hide some of them.
Work through an example
For f(x)=2x+1 and g(x)=x2, find (f∘g)(x) and (g∘f)(x), and evaluate both at x=3.