Find a course

Module 1: Functions and Their GraphsLesson 3 of 1211 min

Composition and Inverse Functions

Combine functions by feeding one into another, find inverse functions that undo them, and use one-to-one tests and domain restrictions.

Step 1 of 13Learn

Functions in a chain

A store runs a sale: 20% off everything, and on top of that you have a $10 coupon. Is it better to apply the discount first or the coupon first?

Write each step as a function. The discount is d(x) = 0.8x and the coupon is c(x) = x − 10. Applying one and then the other is called composition:

  • Discount first, then coupon: c(d(x)) = 0.8x − 10
  • Coupon first, then discount: d(c(x)) = 0.8(x − 10) = 0.8x − 8

On a $100 item, the first gives $70 and the second $72. The order matters, and the store would rather apply the coupon first.

The notation (f ∘ g)(x) means f(g(x)): apply g first, then f. Read it from the inside out. The output of g becomes the input of f.

To compute f(g(3)) with f(x) = x2 and g(x) = x + 1: first g(3) = 4, then f(4) = 16. In the other order, g(f(3)) = g(9) = 10. In general f(g(x)) and g(f(x)) are different, just like the two sale orders.

To find a formula, substitute the whole inside function: f(g(x)) = (x + 1)2 = x2 + 2x + 1, while g(f(x)) = x2 + 1.

Step 2 of 13Practice · Diagram

c(d(x)) on a $100 item

In a composition, the inside function acts first. Tap each stage to follow the $100.

In c(d(x)), which function is applied to the price first?

Tap the shape that answers the question, then press Check.

c(d(x)) on a $100 itemProcess diagram: Price x = $100 → d: 20% off (× 0.8) → $80 → c: $10 coupon (− 10) → You pay $70.Price x = $100d: 20% off (× 0.8)$80c: $10 coupon (− 10)You pay $70
Price x = $100
d: 20% off (× 0.8)

d(100) = 80.

$80
c: $10 coupon (− 10)

c(80) = 70.

You pay $70

The other order, d(c(100)) = 0.8 × 90 = $72, costs more.

Step 3 of 13Practice · Work it out

Let f(x) = 3x − 1 and g(x) = x2. What is f(g(2))?

Step 4 of 13Practice · Fill in the blanks

Fill in the blanks

If f(x) = x + 4 and g(x) = 2x, then f(g(x)) = and g(f(x)) = .

Step 5 of 13Learn

Inverse functions undo each other

An inverse function, written f-1, reverses f. If f takes 3 to 7, then f-1 takes 7 back to 3. Composing a function with its inverse brings you back to where you started: f-1(f(x)) = x and f(f-1(x)) = x.

The −1 in f-1 is not an exponent. f-1(x) is not 1/f(x).

Finding an inverse algebraically:

  1. Write y = f(x).
  2. Swap x and y.
  3. Solve for y.
  4. Write the result as f-1(x).

Example: f(x) = (x − 2)/5.

  • y = (x − 2)/5
  • Swap: x = (y − 2)/5
  • Solve: 5x = y − 2, so y = 5x + 2
  • f-1(x) = 5x + 2

Check: f(f-1(x)) = ((5x + 2) − 2)/5 = x. It works.

Think of an inverse as undoing steps in reverse order, like taking off shoes and socks. f subtracts 2 and then divides by 5. To undo it, multiply by 5 first, then add 2.

Graphically, the inverse is the mirror image of the graph across the line y = x, because swapping x and y swaps every point (a, b) to (b, a). The temperature conversion F = 1.8C + 32 and its inverse C = (F − 32)/1.8 are a real-life pair.

Step 6 of 13Diagram

f and its inverse undo each other

Take f(x) = 2x + 1. Follow 3 around the loop: f sends it to 7, and f-1 brings it back.

f and its inverse undo each otherCycle diagram: x = 3 → f: double, add 1 → 7 → f^-1: subtract 1, halve.f^-1(f(x)) = xx = 3f: double, add 17f^-1: subtract1, halve

Tap a shape with to see more.

x = 3
f: double, add 1

f(3) = 2·3 + 1 = 7.

7
f^-1: subtract 1, halve

f-1(x) = (x − 1)/2, so f-1(7) = 3. The inverse undoes the steps in reverse order.

Step 7 of 13Practice · Put in order

Order the steps to find the inverse of f(x) = 4x + 9.

Drag the items, or use the arrow buttons, to put them in order.

  1. Divide by 4: f-1(x) = (x − 9)/4
  2. Write y = 4x + 9
  3. Swap x and y: x = 4y + 9
  4. Subtract 9: x − 9 = 4y

Step 8 of 13Learn

When an inverse exists

Not every function has an inverse function. f(x) = x2 sends both 3 and −3 to 9. If you try to reverse it, 9 would have to go back to two different inputs, and a function can only have one output. So x2, on all real numbers, has no inverse function.

A function has an inverse exactly when it is one-to-one: different inputs always give different outputs. Graphically, that's the horizontal line test: no horizontal line crosses the graph more than once. A horizontal line marks one output; crossing twice would mean two inputs share that output.

  • y = 2x + 1, y = x3 and y = √x pass the test and have inverses.
  • y = x2 and y = |x| fail it.

The fix is to restrict the domain. If you only allow x ≥ 0, then f(x) = x2 is one-to-one, and its inverse is f-1(x) = √x. That's exactly why the square root symbol always gives the non-negative root: √ is the inverse of x2 restricted to x ≥ 0.

The domain and range also swap. If f has domain [0, ∞) and range [3, ∞), then f-1 has domain [3, ∞) and range [0, ∞). You'll see this same restriction idea again with inverse trig functions, where sine and cosine have to be restricted before they can be undone.

Step 9 of 13Practice · Select all that apply

Which functions are one-to-one on all real numbers, and so have inverse functions?

Select all that apply.

Step 10 of 13Note

Step 11 of 13Compare

Inverse vs reciprocal for f(x) = 2x

Aspectf-1(x) = x/21/f(x) = 1/(2x)
x = 10.50.5
x = 210.25
x = 420.125
MeaningUndoes f: input ↔ output swapOne divided by the output

Step 12 of 13Practice · True or false

If f(x) = x3 + 1, then f-1(9) = 2.

Step 13 of 13Practice · Choose one

Which is the inverse of f(x) = (x + 3)/2?