IB Maths AA HL Topic 2 — Functions Paper 1 & 2 ~7 min read

Composite Functions

A composite function is one function applied to the output of another — like a two-stage machine. Feed x into g, take whatever pops out, then feed that into f. The whole chain is written f(g(x)) or (fg)(x). The single thing you must remember: the order matters. f(g(x)) and g(f(x)) are usually different functions.

📘 What you need to know

The two-stage machine

f(g(x)) — apply g first, then f
x g apply g g(x) f apply f f(g(x))composition reads inside-out — the function closest to the input goes first
Composition (fg)(x)  =  f(g(x))

How to compute f(g(x))

Two scenarios — at a number or as an expression:

At a number
f(g(5))
work inside-out: compute g(5) first, then put that into f
As an expression
f(g(x))
substitute the whole expression for g(x) into f wherever x appears
For “at a number” questions, never expand the algebra — just plug in numbers. It’s faster and harder to mess up.

Order matters — f(g(x)) ≠ g(f(x))

Quick demo with f(x) = x + 1 and g(x) = 2x:

f(g(x))
f(2x) = 2x + 1
double, then add 1
g(f(x))
g(x + 1) = 2(x + 1) = 2x + 2
add 1, then double

Same two functions, two completely different composites. Always check which one the question is asking for.

Watch out — ff(x) is not [f(x)]2

Common confusion ff(x)  =  f(f(x))     [f(x)]2

Take f(x) = x + 3:

ff(x) — apply f twice
f(x + 3) = x + 6
composition
[f(x)]2 — square the output
(x + 3)2 = x2 + 6x + 9
multiplication

Domain of a composite function

The input x has to satisfy two conditions:

🧭 Recipe — domain of f(g(x))

  1. Start with the domain of g — only inputs that g can accept.
  2. Find the outputs of g on that domain (the range of g).
  3. Restrict further so those outputs lie inside the domain of f. Whatever inputs of g produce that restricted set become the domain of the composite.

Worked examples

WE 1

Evaluate composites at a number — both orders

Given f(x) = x2 + 3 and g(x) = 2x − 1, find:
(a) (fg)(4)   (b) (gf)(4)

(a) Inside-out: g first g(4) = 2(4) − 1 = 7 f(7) = 49 + 3 = 52 (a) (f ∘ g)(4) = 52 (b) Inside-out: f first f(4) = 16 + 3 = 19 g(19) = 2(19) − 1 = 37 (b) (g ∘ f)(4) = 37 52 ≠ 37 — same functions, different order, completely different answer
WE 2

Find an expression for f(g(x))

Given f(x) = 3x + 5 and g(x) = x2 − 2, find an expression for (fg)(x).

Step 1: Substitute g(x) = x² − 2 into f wherever x appears (f ∘ g)(x) = f(x² − 2) = 3(x² − 2) + 5 Step 2: Expand and simplify = 3x² − 6 + 5 = 3x² − 1 (f ∘ g)(x) = 3x² − 1 check: g(2) = 2, f(2) = 11; via the composite: 3(4) − 1 = 11 ✓
WE 3

Reverse the order — find g(f(x))

Using the same f and g as WE 2, find an expression for (gf)(x).

Step 1: Substitute f(x) = 3x + 5 into g wherever x appears (g ∘ f)(x) = g(3x + 5) = (3x + 5)² − 2 Step 2: Expand the square (3x + 5)² = 9x² + 30x + 25 (g ∘ f)(x) = 9x² + 30x + 25 − 2 (g ∘ f)(x) = 9x² + 30x + 23 notice this is completely different from (f ∘ g)(x) = 3x² − 1 — same f and g, different order
WE 4

Compose a function with itself

Given f(x) = 2x + 7, find an expression for ff(x) and compare with [f(x)]2.

Step 1: ff(x) = f(f(x)) — apply f twice ff(x) = f(2x + 7) = 2(2x + 7) + 7 = 4x + 14 + 7 ff(x) = 4x + 21 For comparison: [f(x)]² is just squaring the output [f(x)]² = (2x + 7)² = 4x² + 28x + 49 very different — ff(x) = 4x + 21 (linear); [f(x)]² = 4x² + 28x + 49 (quadratic)
WE 5

Find the domain of a composite

Let f(x) = 3x − 2 with domain −2 ≤ x ≤ 4, and let g(x) = √x with domain 1 ≤ x ≤ 49. Find the domain of (fg)(x).

Step 1: g acts first → input must be in g’s domain 1 ≤ x ≤ 49 Step 2: g’s outputs (range of g) g(x) = √x → 1 ≤ g(x) ≤ 7 Step 3: These outputs must fit f’s domain −2 ≤ input ≤ 4 need g(x) ≤ 4 → √x ≤ 4 → x ≤ 16 (g(x) ≥ −2 is automatic since √x ≥ 0) Step 4: Combine with original 1 ≤ x ≤ 49 domain of (f ∘ g): 1 ≤ x ≤ 16 f’s restricted domain shrinks the composite’s domain from 1 ≤ x ≤ 49 down to 1 ≤ x ≤ 16
WE 6

Solve an equation involving a composite

Given f(x) = x + 4 and g(x) = 2x − 1, find the value of x for which (fg)(x) = 11.

Step 1: Find the expression for (f ∘ g)(x) (f ∘ g)(x) = f(2x − 1) = (2x − 1) + 4 = 2x + 3 Step 2: Set equal to 11 and solve 2x + 3 = 11 2x = 8 x = 4 check: g(4) = 7, then f(7) = 11 ✓

💡 Top tips

⚠ Common mistakes

Composition becomes the foundation for the next big idea: inverse functions. An inverse f−1 is the function that “undoes” f, so f(f−1(x)) = x. That’s a composition equal to the identity — and we’ll explore exactly when an inverse can exist in the next note.

Need help with Composite Functions?

Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.

Book Free Session →