A function is a machine
A function is a rule that takes an input, does something definite to it, and hands back exactly one output. Think of it as a machine: you drop a number in the top, the machine applies its rule, and one number drops out of the bottom. The whole of this topic — evaluating, composing, inverting — is just asking sensible questions about that machine.
Cambridge writes the same function in two ways, and you must recognise both:
Function notation
f(x) = 3x − 5
The everyday form. f(4) means “the output when the input is 4”.
Mapping notation
f : x ↦ 3x − 5
Read “f maps x to 3x minus 5”. Exactly the same rule, just written with the mapping arrow. Paper 2 occasionally uses this form, so do not let it throw you.
Domain and range
The domain is the set of inputs the function is allowed to take. The range is the set of outputs it actually produces. A mapping diagram shows both at once: every element of the domain fires exactly one arrow into the range.
Mapping diagram for f(x) = 2x + 1 with domain {1, 2, 3, 4}
Evaluating f(x) — numbers, letters, expressions
To evaluate a function, substitute the input in place of every x in the rule. That is the whole method — but Paper 2 tests it three ways: with a number, with an expression like 2a or x + 1, and in reverse, where you are told the output and must solve for the input.
Example 1f(x) = 3x − 5. Find (a) f(4), (b) f(−2), and (c) solve f(x) = 16.
3x = 21
x = 7
Example 2f(x) = 3x − 5. Find and simplify (a) f(2a) and (b) f(x + 1).
Function machine playground
Two linear machines: f(x) = ax + b and g(x) = cx + d. Change any number and watch f, g, gf, fg and f−1 recompute step by step. Try a = 2, c = 3, then swap them — is gf still the same as fg?
Composite functions — gf(x) means g(f(x))
A composite function chains two machines together: the output of the first becomes the input of the second. The notation is the part students misread, so learn it cold:
gf(x) is not g times f. The function written closest to the x acts first, exactly as in g(f(x)) the inner bracket is evaluated first.
The chain for gf(x), where f(x) = 2x + 1 and g(x) = x²
Example 3f(x) = 2x + 1 and g(x) = x². Find (a) gf(x), (b) fg(x), and (c) show that gf(2) ≠ fg(2).
fg(2) = 2(2)² + 1 = 8 + 1 = 9
Inverse functions — the machine in reverse
The inverse function f−1(x) undoes f: it takes each output back to the input it came from. If f(4) = 7, then f−1(7) = 4. Running the machine backwards means undoing each operation, in the reverse order, with the opposite operation.
Two reliable methods — use whichever feels natural, they always agree:
Method 1: swap and solve
- Write y = f(x).
- Rearrange to make x the subject.
- Swap the letters: replace y with x. The result is f−1(x).
Method 2: reverse the flow
List the operations f performs, then undo them backwards.
f(x) = 3x − 5: ×3, then −5.
Reverse: +5, then ÷3, so
f−1(x) =
x + 53.
Example 4Find f−1(x) for f(x) = 3x − 25, and check your answer.
5y + 2 = 3x
x = (5y + 2)/3
= (5x + 2 − 2)/5 = 5x/5 = x ✓
More worked examples
Example 5f(x) = 3x + 2 and g(x) = x − 52. Find fg(x), giving your answer as a fraction in its simplest form.
Example 6f(x) = 2x − 3 and g(x) = 5x + 1. Find (a) gf(x), (b) (gf)−1(x), and (c) show that (gf)−1(x) = f−1g−1(x).
y + 14 = 10x
(gf)⁻¹(x) = (x + 14)/10
= ( (x − 1)/5 + 3 ) / 2
= (x − 1 + 15)/10 = (x + 14)/10 ✓
Your turn
Practice set
- f(x) = 4x + 1. Find f(3), f(−2) and f(½).
- g(x) = 5 − 2x. Solve g(x) = 11.
- f(x) = 3x − 5 and g(x) = x + 2. Find fg(x) and gf(x), both simplified.
- f(x) = x + 72. Find f−1(x).
- h(x) = 2x² + 3. Solve h(x) = 21, giving all solutions.
- f(3) = 4(3) + 1 = 13; f(−2) = 4(−2) + 1 = −7; f(½) = 4(½) + 1 = 2 + 1 = 3
- 5 − 2x = 11 → −2x = 6 → x = −3
- fg(x) = 3(x + 2) − 5 = 3x + 1; gf(x) = (3x − 5) + 2 = 3x − 3 — different, as expected.
- y = (x + 7)/2 → 2y = x + 7 → x = 2y − 7 → f⁻¹(x) = 2x − 7
- 2x² + 3 = 21 → 2x² = 18 → x² = 9 → x = 3 or x = −3 — a square root in a solve step gives two answers; giving only x = 3 loses the final mark.
Key points to remember
- f(x) is the output when x goes in — it is never f multiplied by x.
- To evaluate, substitute in brackets for every x: f(−2) = 3(−2) − 5.
- “Solve f(x) = k” means set the rule equal to k and solve the equation for x.
- gf(x) = g(f(x)): the function nearest x acts first, and usually fg ≠ gf.
- To find f⁻¹: write y = f(x), make x the subject, swap the letters.
- f⁻¹(x) is the inverse, not the reciprocal — it is not 1/f(x).
- Check every inverse with f(f⁻¹(x)) = x; the domain is the set of inputs, the range the set of outputs.
Where next?
🎥 Take the interactive module
Functions: Notation, Domain & Range — the full teaching module for this topic, with real past-paper questions and mark schemes.
✏️ Practise exam questions
Functions — 25 exam-style questions worth 96 marks, with full answers and the mark scheme.
Progress is saved on this device only and appears on the notes home page.