A composite function chains two functions, so the output of the first becomes the input of the second. The order matters. You form composites, find when a composite exists and what its domain is, and solve equations that involve them.
about 25 min1 simulation1 practice question
Lesson 3 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
Chaining two rules
Think of two machines in a row. The first machine is f and the second is g. A number goes into f, and the result goes into g.
A chain of two machines. The input x enters a box labelled f, which does times 2 plus 1. The output of f enters a box labelled g, which does square it and subtract 3. The result is gf of x. Below the chain, the example x equals 2 gives f(2) equals 5 and then g(5) equals 22.
We write this as gf(x)=g(f(x)). The function written nearest to x acts first. The composite fg(x)=f(g(x)) does g first.
Let f(x)=2x+1 and g(x)=x2−3.
gf(x)=g(2x+1)=(2x+1)2−3=4x2+4x−2.
fg(x)=f(x2−3)=2(x2−3)+1=2x2−5.
These are different, so fg may not be the same as gf. The order of the functions is important. A function applied to itself is written f2(x)=f(f(x)).
When does a composite exist?
The composite gf(x) needs the output of f to be a valid input for g. In terms of sets:
the domain of gf is inside the domain of f;
the range of gf is inside the range of g.
Suppose f(x)=x−5 for all real x, and g(x)=x for x≥0. Then gf(x)=x−5 needs x−5≥0. So the domain of f must be restricted to x≥5 for gf to exist. Without the restriction, gf(1) would need −4, which is not a real number.
Solving with composites
To solve gf(x)=k, first write gf(x) as one expression in x, then solve. Alternatively, undo the functions in the opposite order.
For f(x)=2x+1 and g(x)=x2−3, solve gf(x)=13. Then (2x+1)2−3=13, so (2x+1)2=16 and 2x+1=4 or 2x+1=−4. That gives x=1.5 or x=−2.5. Check each in the original: f(1.5)=4 and g(4)=13.
To solve fg(x)=gf(x), form both expressions and set them equal.
To undo a composite, undo the last function first: (gf)−1(x)=f−1(g−1(x)). We write it as f−1g−1(x).
Practise with new numbers
Try it in Python
The program defines f(x)=2x−8 and g(x)=x and forms gf. Python gives an error where gf does not exist.
Common mistakes
Doing the functions in the wrong order. In gf(x), f acts first.
Assuming fg=gf. They are usually different.
Reading f2(x) as (f(x))2.
Ignoring the domain. If the output of the first function is not allowed in the second, the composite does not exist there.
Losing a solution. Squaring leaves two cases, one positive and one negative.
Remember these
gf(x)=g(f(x)). The function next to x acts first.
gf and fg are usually different.
Domain of gf is inside the domain of f. Range of gf is inside the range of g.
To undo gf: (gf)−1=f−1g−1.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
f(x)=x+4 and g(x)=3x. Find gf(x) and fg(x).
f(x)=5−x and g(x)=x2. Find gf(2).
f(x)=2x−6 for all real x and g(x)=x for x≥0. State the largest domain of gf.
f(x)=x+2 and g(x)=x2. Solve gf(x)=25.
f(x)=3x and g(x)=x−4. Find (gf)−1(x).
References
Cambridge International, IGCSE Additional Mathematics 0606 syllabus (2025, 2026 and 2027), unit 1 Functions.
Enroll free in Domain, Range, Inverse and Composite Functions
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.