Composition of functions
In f∘g, apply g first, then f: (f∘g)(x) = f(g(x)). Usually f∘g ≠ g∘f, but composition is associative.
How f∘g works
The function written next to x (on the right) acts first.
Example 1: f∘g and g∘f
f(x) = 3x + 2 and g(x) = x² − 1. Find f∘g and g∘f. Is f∘g = g∘f?
- (f∘g)(x) = f(g(x)) = f(x² − 1)
- = 3(x² − 1) + 2 = 3x² − 3 + 2 = 3x² − 1
- (g∘f)(x) = g(f(x)) = g(3x + 2)
- = (3x + 2)² − 1 = 9x² + 12x + 4 − 1 = 9x² + 12x + 3
- At x = 0: f∘g gives −1 but g∘f gives 3, so they are not equal.
f∘g = 3x² − 1 and g∘f = 9x² + 12x + 3, so f∘g ≠ g∘f.
Example 2: finding an unknown constant
f(x) = 2x + 3 and g(x) = 5x + k. If f∘g = g∘f, find k.
- (f∘g)(x) = f(5x + k) = 2(5x + k) + 3 = 10x + 2k + 3
- (g∘f)(x) = g(2x + 3) = 5(2x + 3) + k = 10x + 15 + k
- Equate: 10x + 2k + 3 = 10x + 15 + k
- 2k − k = 15 − 3, so k = 12.
- Check: both become 10x + 27.
k = 12
Example 3: verifying the associative property
f(x) = x + 1, g(x) = 2x and h(x) = x². Show that f∘(g∘h) = (f∘g)∘h.
- (g∘h)(x) = g(x²) = 2x²
- f∘(g∘h)(x) = f(2x²) = 2x² + 1
- (f∘g)(x) = f(2x) = 2x + 1
- (f∘g)∘h(x) = (f∘g)(x²) = 2x² + 1
- Both sides equal 2x² + 1.
f∘(g∘h) = (f∘g)∘h = 2x² + 1. Hence verified.
Common slips
- f∘g is not f × g. You substitute g(x) into f; you do not multiply.
- Put brackets around g(x) when you substitute: f(x² − 1) = 3(x² − 1) + 2, not 3x² − 1 + 2.
- (f∘f)(x) means f(f(x)): put f(x) into f itself.
- To find (f∘g)(a) for a number a, find g(a) first, then apply f to that value.
Filter coffee is a composition: first grind the beans (g), then brew the powder (f). Brewing before grinding does not work, just as f∘g and g∘f usually give different results.
2 marks: “If f(x) = 3x + 1, find k such that (f∘f)(k) = 13.” (f∘f)(k) = 3(3k + 1) + 1 = 9k + 4 = 13, so k = 1.
2 marks: “If f(x) = x² and g(x) = x + 4, find (f∘g)(1) and (g∘f)(1).” (f∘g)(1) = f(5) = 25; (g∘f)(1) = g(1) = 5.
5 marks: “If f(x) = x + 3, g(x) = x² and h(x) = 2x − 1, verify that f∘(g∘h) = (f∘g)∘h.” g∘h = (2x − 1)², so f∘(g∘h) = (2x − 1)² + 3 = 4x² − 4x + 4. f∘g = x² + 3, so (f∘g)∘h = (2x − 1)² + 3 = 4x² − 4x + 4. Both sides are equal, so the property is verified.
Right to left: in f∘g, g sits next to x, so g goes first.