haya.Learning made clear
Unit I · Relations and functions
8 min readConcept sheetPart II (2 marks); Part III (5 marks) to find an unknown k or to verify that composition is associative

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.

Definition(f∘g)(x) = f(g(x)); g acts first
Not commutativeIn general f∘g ≠ g∘f
Associativef∘(g∘h) = (f∘g)∘h
When it existsf∘g is defined when the range of g lies inside the domain of f

How f∘g works

The function written next to x (on the right) acts first.

Example 1: f∘g and g∘f

Problem

f(x) = 3x + 2 and g(x) = x² − 1. Find f∘g and g∘f. Is f∘g = g∘f?

Working
  1. (f∘g)(x) = f(g(x)) = f(x² − 1)
  2. = 3(x² − 1) + 2 = 3x² − 3 + 2 = 3x² − 1
  3. (g∘f)(x) = g(f(x)) = g(3x + 2)
  4. = (3x + 2)² − 1 = 9x² + 12x + 4 − 1 = 9x² + 12x + 3
  5. At x = 0: f∘g gives −1 but g∘f gives 3, so they are not equal.
Answer

f∘g = 3x² − 1 and g∘f = 9x² + 12x + 3, so f∘g ≠ g∘f.

Example 2: finding an unknown constant

Problem

f(x) = 2x + 3 and g(x) = 5x + k. If f∘g = g∘f, find k.

Working
  1. (f∘g)(x) = f(5x + k) = 2(5x + k) + 3 = 10x + 2k + 3
  2. (g∘f)(x) = g(2x + 3) = 5(2x + 3) + k = 10x + 15 + k
  3. Equate: 10x + 2k + 3 = 10x + 15 + k
  4. 2k − k = 15 − 3, so k = 12.
  5. Check: both become 10x + 27.
Answer

k = 12

Example 3: verifying the associative property

Problem

f(x) = x + 1, g(x) = 2x and h(x) = x². Show that f∘(g∘h) = (f∘g)∘h.

Working
  1. (g∘h)(x) = g(x²) = 2x²
  2. f∘(g∘h)(x) = f(2x²) = 2x² + 1
  3. (f∘g)(x) = f(2x) = 2x + 1
  4. (f∘g)∘h(x) = (f∘g)(x²) = 2x² + 1
  5. Both sides equal 2x² + 1.
Answer

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.
In real life

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.

Exam angle

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.

Remember it

Right to left: in f∘g, g sits next to x, so g goes first.