A composite function is one function applied to the result of another. In the notation fg(x), the function g acts first and f acts on its output. Additional Mathematics questions ask you to write fg(x) or gf(x) as a single expression, to evaluate one at a value, or to solve an equation such as fg(x) = 49.
This lesson follows finding a range from a restricted domain, because the output of the inner function must be a value the outer function can accept.
How do you build a composite function?
The safest method is to treat the inner function as a bracket and put it in place of x.
- Identify the inner function. In fg(x) it is g, the one written next to x.
- Write the outer function with a gap where x goes, for example f( ) = 3( ) − 2.
- Put the whole of g(x) in the gap, inside brackets.
- Expand and simplify.
- Check with a number. Pick an easy x, work it step by step, and compare.
Worked example
Given f(x) = 3x − 2 and g(x) = x² + 1, find fg(x) and gf(x), then solve fg(x) = 49.
fg(x), g goes first: fg(x) = f(x² + 1) = 3(x² + 1) − 2 = 3x² + 3 − 2 = 3x² + 1.
gf(x), f goes first: gf(x) = g(3x − 2) = (3x − 2)² + 1 = 9x² − 12x + 4 + 1 = 9x² − 12x + 5.
Check with x = 2. For fg: g(2) = 5, then f(5) = 13, and 3(4) + 1 = 13. For gf: f(2) = 4, then g(4) = 17, and 9(4) − 24 + 5 = 17. Both agree.
Solve fg(x) = 49: 3x² + 1 = 49, so 3x² = 48, so x² = 16, so x = 4 or x = −4.
Check x = −4: g(−4) = 17, then f(17) = 51 − 2 = 49. It works.
The mistake to watch for
A common slip is to apply the functions in the order the letters are written, so fg(x) becomes g first and then f reversed.
Mistaken working: fg(x) = g(f(x)) = (3x − 2)² + 1 = 9x² − 12x + 5.
This is actually gf(x). The student applied f first, which is the wrong way round for fg.
The correction is to read fg(x) as f(g(x)): the function next to x acts first. If the letters are written f then g, the substitution goes g into f. The numerical check at x = 2 would expose the slip straight away, because fg(2) is 13, not 17.
Check yourself
Try these, then open each answer.
1. f(x) = x + 4 and g(x) = 2x. Find fg(x) and gf(x).
Show answer
fg(x) = f(2x) = 2x + 4. gf(x) = g(x + 4) = 2(x + 4) = 2x + 8. So fg(x) = 2x + 4 and gf(x) = 2x + 8. They are different.
2. f(x) = 1/x for x ≠ 0, and g(x) = x − 3. Find fg(x) and gf(x), and state any excluded value for fg.
Show answer
fg(x) = f(x − 3) = 1/(x − 3), with x ≠ 3. gf(x) = g(1/x) = 1/x − 3, with x ≠ 0.
3. f(x) = 2x − 1 and g(x) = x². Solve fg(x) = 17.
Show answer
fg(x) = f(x²) = 2x² − 1. Then 2x² − 1 = 17, so x² = 9, so x = 3 or x = −3. Check x = 3: g(3) = 9, f(9) = 17.
Where this leads next
Composite functions underpin inverses, since f⁻¹ undoes f. Continue with finding an inverse and checking its domain. The function composition and inverse explorer shows fg and gf side by side for any input you choose, and the non-calculator working trainer helps with checking expanded brackets.
If the notation slows you down, a teacher can go through your own working in online one-to-one Additional Mathematics tuition.