Salam Academy
Functions · Subtopic 2 of 5

Composite Functions

Applying one function after another: what fg(x)fg(x) means, finding and solving with composite expressions, and when a composite function exists.

Cambridge 9709 Paper 1Edexcel YMA01 WMA13Edexcel 9MA0 Paper 1Edexcel 9MA0 Paper 2≈ 35 minRevision 5 · updated 2026-10-27
Section 1 of 14

Learning objectives

  • Understand that fg(x)fg(x) means f(g(x))f\big(g(x)\big): apply gg first, then ff.
  • Evaluate composites such as fg(2)fg(2), and find expressions for fg(x)fg(x), gf(x)gf(x) and ff(x)ff(x).
  • Solve equations involving composite functions.
  • Decide whether a composite exists, using the range of the first function and the domain of the second.
  • Find the range of a composite function on a given domain.
Pause and think

Warm-up: if f(x)=2x+3f(x)=2x+3, what is f(5)f(5)? What is f(banana)f(\text{banana})? What is f(x2−1)f(x^2-1)?

Section 2 of 14

Core idea

Start hereTwo machines in a row

A factory paints a block (machine gg), then packs it (machine ff). The finished product is "pack(paint(block))". The order matters: painting a packed box is not the same thing. When the output of one function is fed straight into another, we get a composite function.

The big idea

fg(x)fg(x) means f(g(x))f(g(x)): apply gg first, then apply ff to the result. Usually fg≠gffg\neq gf. For fgfg to exist, every output of gg must lie in the domain of ff.

1. Reading the notation

fg(3): g first, then f
g: squaref: ×2 + 13919
fg(3)=f(g(3))=f(9)=19fg(3)=f(g(3))=f(9)=19. The function written nearest the xx acts first.
fg(x)=f(g(x))fg(x)=f\big(g(x)\big)
where
g(x)g(x)
the inner function, applied first.
f(…)f(\ldots)
the outer function, applied to whatever gg produced.
Worked examplef(x)=2x+1f(x)=2x+1, g(x)=x2g(x)=x^2

Find fg(3)fg(3), gf(3)gf(3), and expressions for fg(x)fg(x) and gf(x)gf(x).

Goal
Numerical values and formulas.
Strategy
Work from the inside out.
  1. g(3)=9,fg(3)=f(9)=19g(3)=9,\quad fg(3)=f(9)=19
    gg first.
  2. f(3)=7,gf(3)=g(7)=49f(3)=7,\quad gf(3)=g(7)=49
    ff first.
  3. fg(x)=f(x2)=2x2+1fg(x)=f(x^2)=2x^2+1
    Replace the xx in ff by x2x^2.
  4. gf(x)=g(2x+1)=(2x+1)2=4x2+4x+1gf(x)=g(2x+1)=(2x+1)^2=4x^2+4x+1
    Square the whole of f(x)f(x).
Answer1919, 4949; fg(x)=2x2+1fg(x)=2x^2+1, gf(x)=4x2+4x+1gf(x)=4x^2+4x+1.
✓ Checkfg(3)=2(9)+1=19fg(3)=2(9)+1=19 ✓; gf(3)=36+12+1=49gf(3)=36+12+1=49 ✓.
Common misconceptionfgfg is not f×gf\times g fg(x)fg(x) is "ff of gg of xx", not f(x)⋅g(x)f(x)\cdot g(x). And f2(x)f^2(x) means ff(x)ff(x), applying ff twice.

2. When does a composite exist?

Worked exampleDomain condition

f(x)=x−4f(x)=\sqrt{x-4} for x≥4x\ge4; g(x)=x+kg(x)=x+k for x≥0x\ge0. Find the least kk so that fgfg exists.

Goal
Smallest kk.
Strategy
The range of gg must sit inside the domain of ff.
  1. range of g: g(x)≥k\text{range of }g:\ g(x)\ge k
    Smallest output at x=0x=0.
  2. need k≥4\text{need }k\ge4
    All outputs of gg must be ≥4\ge4.
Answerk=4k=4.
✓ CheckWith k=4k=4: fg(0)=0=0fg(0)=\sqrt{0}=0 is defined ✓; with k=3k=3, fg(0)=−1fg(0)=\sqrt{-1} is not.

3. Solving composite equations

Worked exampleSolve gf(x)=25gf(x)=25

With f(x)=2x+1f(x)=2x+1, g(x)=x2g(x)=x^2, solve gf(x)=25gf(x)=25.

Goal
All xx.
Strategy
Write the composite out, then solve.
  1. (2x+1)2=25(2x+1)^2=25
    gf(x)=(2x+1)2gf(x)=(2x+1)^2.
  2. 2x+1=±52x+1=\pm5
    Square root, both signs.
  3. x=2orx=−3x=2\quad\text{or}\quad x=-3
    Solve each.
Answerx=2x=2 or x=−3x=-3.
✓ Checkgf(−3)=g(−5)=25gf(-3)=g(-5)=25 ✓.
Pause and think

With f(x)=2x+1f(x)=2x+1, find ff(x)ff(x).

Summary

  • fg(x)=f(g(x))fg(x)=f(g(x)): right-hand function first.
  • Order matters.
  • Range of gg ⊆ domain of ff.
Key words
Composite function
One function applied to the output of another.
Notationfg(x)=f(g(x))gf(x)=g(f(x))ff(x)=f2(x)=f(f(x))fg(x)=f\big(g(x)\big)\qquad gf(x)=g\big(f(x)\big)\qquad ff(x)=f^2(x)=f\big(f(x)\big)

With f(x)=2x+3f(x)=2x+3 and g(x)=x2−1g(x)=x^2-1: fg(2)=f(3)=9fg(2)=f(3)=9 but gf(2)=g(7)=48gf(2)=g(7)=48. Order matters, and in general fg≠gffg\ne gf.

Fun factSocks, then shoes. Getting dressed is a composite: socks first, then shoes. Do it in the other order and you get a very different result. Composite functions work the same way, which is why fgfg and gfgf are usually different.
In the real worldCurrency conversion is a composite. To change Pakistani rupees to pounds through dollars, you apply "rupees to dollars" and then "dollars to pounds". If d(r)=r280d(r)=\tfrac{r}{280} and p(d)=0.79dp(d)=0.79d, then rupees to pounds is pd(r)=0.79r280pd(r)=\tfrac{0.79r}{280}. (These rates are only examples.)
When does fg exist?
Loading the interactive graph…
Try this
  1. The third curve is fg(x)=(3−x2)−1fg(x)=\sqrt{(3-x^2)-1}. Why does it only appear between about x=−1.4x=-1.4 and x=1.4x=1.4?
  2. ff only accepts inputs ≥1\ge1. Find where g(x)≥1g(x)\ge1: that is exactly where fgfg exists.

fg(x)fg(x) exists only when g(x)g(x) lands inside the domain of ff. On all real numbers the range of gg is g(x)≤3g(x)\le3, which includes values below 11, so fgfg is not defined for every xx.

Keep reading for free

Create a free account to read the rest of this lesson: key formulae, worked examples, explore the graph, common mistakes, exam tip, guided practice and more. Your answers are checked and your progress is saved.