Compose functions in the correct order and check the inputs
Read gf as g after f and check that every inner output is allowed by the outer function.
Pure Mathematics 1 (Paper 1) · AS & A Level Mathematics 9709, 2026–2027. Written practice is self-checked; show your reasoning and domain restrictions.
Before you begin
- Identify the domain and range of a simple function.
- Substitute a whole expression into a second function using brackets.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
Which function is applied first in gf(x)?
What you will learn
- Form gf(x) and fg(x) using the Cambridge composition convention.
- Check the range-to-domain condition and state any deliberate domain restriction.
Read from the input outwards
Cambridge notation gf(x) means g(f(x)): apply f first, then g. This is composition, not multiplication of the two outputs. For f(x) = 3x + 2 and g(x) = x², gf(x) = (3x + 2)², whereas fg(x) = 3x² + 2. In general gf and fg are different functions.
An input-output chain can prevent order errors: write x → f(x) → g(f(x)). Substitute the complete inner expression wherever the outer rule has its input variable. For squaring, keep the whole inner expression in brackets, including any negative sign or constant.
Make the domains fit before declaring a composite
The composite gf can be defined on the entire stated domain of f only when the range of f lies within the domain of g. If f(x) = 2x − 1 on all real x and g(x) = √x on x ≥ 0, the condition fails: some f outputs are negative. To build a valid restricted composite, explicitly restrict f's inputs to x ≥ 1/2. On that new domain, gf(x) = √(2x − 1).
In the reverse order, g's outputs are non-negative and all are accepted by the original real-domain f. Thus fg(x) = 2√x − 1 on x ≥ 0 is valid without further restriction. A displayed algebraic expression can have a natural domain, but that does not silently override a function's declared domain. State which input set you are using.
Pause and explain
For f(x) = x − 5 on x ≥ 0 and g(x) = √x on x ≥ 0, can gf use all of f's original inputs?
Worked example
Let f(x) = 2x − 1 on all real x and g(x) = √x on x ≥ 0. Explain how to form gf and give fg.
Show the worked solution
- The range of the original f is all real numbers, which is not contained in g's domain x ≥ 0.
- Restrict f to x ≥ 1/2; then gf(x) = √(2x − 1) on that restricted domain.
- For fg, every output √x is allowed by f, so fg(x) = 2√x − 1 on x ≥ 0.
Answer The unrestricted gf is not valid. With f restricted to x ≥ 1/2, gf(x) = √(2x − 1). fg(x) = 2√x − 1 for x ≥ 0.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Let f(x) = 3x + 2 and g(x) = x² on all real x. Find gf(2) and fg(2).
Give me a hint
Write each input-output chain before evaluating.
Compare my reasoning
- For gf(2), apply f: f(2) = 8, then g(8) = 64.
- For fg(2), apply g: g(2) = 4, then f(4) = 14.
- The results differ because composition order matters; all intermediate inputs here are real and permitted.
gf(2) = 64; fg(2) = 14.
Look for these in your work
- Apply the inner function first.
- Show the intermediate value for each order.
Let f(x) = x + 4 on x ≥ 0 and g(x) = 1/x on x > 0. Find gf, its domain and its range.
Give me a hint
All outputs of f are at least 4, so they satisfy g's input requirement.
Compare my reasoning
- The range of f is [4, ∞), contained within the positive domain of g.
- Thus gf(x) = 1/(x + 4) on the whole stated domain x ≥ 0.
- At x = 0 the output is 1/4; larger inputs approach but never attain zero.
gf(x) = 1/(x + 4), domain x ≥ 0, range 0 < y ≤ 1/4.
Look for these in your work
- Check the original range-to-domain condition.
- Keep the original input set and the correct output endpoints.
A two-stage model uses f(x) = x − 5 for x ≥ 0, followed by g(u) = √u for u ≥ 0. What is the largest subset of f's domain on which the real composite can be defined? Give its rule.
Give me a hint
Require f's output to be a permitted square-root input.
Compare my reasoning
- The second stage requires x − 5 ≥ 0.
- Together with the original x ≥ 0, the allowed input set is x ≥ 5.
- Explicitly restrict the first stage to that set; the composite is gf(x) = √(x − 5).
Restrict to x ≥ 5; gf(x) = √(x − 5).
Look for these in your work
- Express the second stage's input requirement as an inequality.
- Declare the restriction and retain the original domain condition.
Common mistakes
- gf applies f first; it is not the product g(x)f(x).
- Check the inner range against the outer domain, not the reverse.
- State a new input restriction instead of silently changing a declared function.
What can you explain now?
For f(x) = x² + 1 and g(x) = 3x, both on all real x, find gf(x) and fg(x).
Compare with the explanation
gf(x) = 3x² + 3; fg(x) = 9x² + 1.
Apply f then g for gf; apply g then f for fg. All intermediate real values are allowed.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
Explain why equal input domains do not guarantee that composition is possible. Build an example where gf and fg have different values and different domain restrictions.
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.