Worked Example · Functions · Paper 1 · 6 marks

Composite Functions and Solving fg(x) = k

Rig, founder of IGCSE Add Math Malaysia

Written by Rig, our founder

8 years teaching IGCSE & SPM maths · Updated 16 August 2026

Composite functions test one idea: the inner function acts first. Write fg(x)fg(x) as f(g(x))f(g(x)), substitute the whole of gg into ff, and the algebra follows. The examiner usually adds a “solve” part to check you can then treat the result as an ordinary equation.

The functions ff and gg are defined by f(x)=2x+3f(x) = 2x + 3 and g(x)=x21g(x) = x^2 - 1. (i) Find fg(x)fg(x) and gf(x)gf(x), simplifying each. [4] (ii) Solve the equation fg(x)=21fg(x) = 21. [2]

The working

(i) fg(x)=f(g(x))fg(x) = f\big(g(x)\big): put g(x)=x21g(x) = x^2 - 1 into ff wherever xx appears: fg(x)=2(x21)+3=2x22+3=2x2+1(M1, A1)fg(x) = 2(x^2 - 1) + 3 = 2x^2 - 2 + 3 = 2x^2 + 1 \quad \text{(M1, A1)}

gf(x)=g(f(x))gf(x) = g\big(f(x)\big): put f(x)=2x+3f(x) = 2x + 3 into gg: gf(x)=(2x+3)21=4x2+12x+91=4x2+12x+8(M1, A1)gf(x) = (2x + 3)^2 - 1 = 4x^2 + 12x + 9 - 1 = 4x^2 + 12x + 8 \quad \text{(M1, A1)}

The two are different, order matters.

(ii) Solve fg(x)=21fg(x) = 21 using the simplified fg(x)=2x2+1fg(x) = 2x^2 + 1: 2x2+1=21    2x2=20    x2=10    x=±10(M1, A1)2x^2 + 1 = 21 \;\Rightarrow\; 2x^2 = 20 \;\Rightarrow\; x^2 = 10 \;\Rightarrow\; x = \pm\sqrt{10} \quad \text{(M1, A1)}

Both roots are valid (gg and ff are defined for all real xx), so x=10x = \sqrt{10} or x=10x = -\sqrt{10}.

Where the marks are won and lost

  • The substitution direction is the whole topic. fg=f(g)fg = f(g), so gg goes inside ff. Writing g(f)g(f) for fgfg loses both marks in (i).
  • Expanding (2x+3)2(2x + 3)^2 needs the middle term 12x12x. Dropping it gives 4x2+84x^2 + 8 and a wrong gfgf.
  • In (ii), x2=10x^2 = 10 has two roots. Giving only +10+\sqrt{10} concedes the accuracy mark unless a domain rules the negative out (here it does not).

Common mistakes

  • Computing gfgf when fgfg was asked (reversed order).
  • Expanding (2x+3)2(2x+3)^2 as 4x2+94x^2 + 9.
  • Forgetting the ±\pm when square-rooting.

Full method: Composite Functions notes. Topic home: Functions pillar.

Common questions

Does fg(x) mean f first or g first?
fg(x) means apply g first, then f, so it is f(g(x)). You read composite functions from right to left, the inner function acts on x before the outer one. This is why fg and gf are usually different: 2(x² − 1) + 3 is not the same as (2x + 3)² − 1. Getting the order backwards is the most common error in the whole topic, so always substitute the inner function into the outer one, not the reverse.

Keep going

See the teaching work on your own child. Then decide.

Every student starts with a 1-hour trial class taught by the vetted tutor your child would actually have. Real teaching, a diagnostic on real exam questions, and a straight answer on the gap to target. One hour at your tutor's rate (RM80–90/hr), no package and no deposit, and you decide afterwards whether to book a weekly slot. Online anywhere in Malaysia.