Functions
Composite functions: order, equations and when they exist
What you need to be able to do
- 1.2Find the composition of two functions: \(fg(x)=f(g(x))\), in the right order.
- 1.2Evaluate composites, solve equations like \(gf(x)=69\), and find unknown constants.
- 1.2Know that \(gf\) can only be formed when the range of f is within the domain of g, and explain why a composite cannot be formed.
Before you start: Domain and range. Next: Inverse functions.
What a composite function is, how to form one, and when it exists, with our own examples. Past-paper questions come in Part 2.
What you should already know
Substituting an expression
If \(f(x)=x^2+3\), then \(f(\text{anything})=(\text{anything})^2+3\). So \(f(a-2)=(a-2)^2+3\) and \(f(3x)=9x^2+3\). Put the whole input in a bracket.
Quick check: \(f(x)=2x-5\): find \(f(x+4)\) and \(f(x^2)\)
\(2x+3\) and \(2x^2-5\)
Domain and range
The domain is the set of allowed inputs, the range the set of outputs (previous page).
Quick check: range of \(x^2+1\) for \(x\in\mathbb R\)?
\(f(x)\ge1\)
Expanding and simplifying
\((2x+1)^2=4x^2+4x+1\); \(3(x^2-2)+4=3x^2-2\).
Quick check: expand \(2(3x-1)^2\)
\(18x^2-12x+2\)
Solving equations with a square
\((x-1)^2=9\Rightarrow x-1=\pm3\): two answers.
Quick check: solve \((2x+1)^2=25\)
\(2x+1=\pm5\): \(x=2\) or \(x=-3\)
fg means: do g first
\(f(x)=x^2+3\) and \(g(x)=2x+1\):
| Composite | Meaning | Work it out | Result |
|---|---|---|---|
| \(fg(x)\) | \(f(g(x))\) | square \(g(x)\), add 3: \((2x+1)^2+3\) | \(4x^2+4x+4\) |
| \(gf(x)\) | \(g(f(x))\) | double \(f(x)\), add 1: \(2(x^2+3)+1\) | \(2x^2+7\) |
| \(ff(x)=f^2(x)\) | \(f(f(x))\) | \((x^2+3)^2+3\) | \(x^4+6x^2+12\) |
| \(fg(2)\) | a number | \(g(2)=5\), then \(f(5)=28\) | \(28\) |
- \(f(x)=3x-2\), \(g(x)=x^2\). Find \(fg(x)\), \(gf(x)\) and \(gf(1)\).
Answer
\(3x^2-2\); \((3x-2)^2\); \(gf(1)=1\) - \(h(x)=\dfrac1{x+2}\). Find \(hh(0)\).
Answer
\(h(0)=\tfrac12\), \(h\left(\tfrac12\right)=\tfrac25\)
Forming and using a composite
- Write the outer function with a bracket where its input goes: for \(fg(x)\), write \(f(\ \ )\) using \(f\)'s rule.
- Put the whole inner function into that bracket, with brackets around it: \(f(2x+1)=(2x+1)^2+3\).
- Simplify only as far as the question asks ("in the form …"). Leaving \((2x+1)^2+3\) unexpanded is often easier for the next part (an inverse).
- To solve \(fg(x)=k\): set the composite equal to \(k\) and solve, with a method shown. Or peel the layers: \(f(\text{something})=k\Rightarrow\) something \(=f^{-1}(k)\).
- Check every answer is in the domain of the inner function (and of the composite). Reject the rest and say so.
Example: solving with a composite. \(f(x)=x^2+3\), \(g(x)=2x+1\). Solve \(fg(x)=12\).
- \(fg(x)=(2x+1)^2+3\), so \((2x+1)^2+3=12\)
- Peel the outer layer: \((2x+1)^2=9\Rightarrow2x+1=\pm3\)
- \(x=1\) or \(x=-2\). Check: \(g(1)=3,\ f(3)=12\) ✓
- \(f(x)=x-4\), \(g(x)=\dfrac{12}{x}\) for \(x\ne0\). Solve \(gf(x)=3\).
Answer
\(\tfrac{12}{x-4}=3\Rightarrow x-4=4\Rightarrow x=8\) - \(f(x)=ax+b\). Given \(f(1)=5\) and \(ff(1)=17\), find \(a\) and \(b\).
Answer
\(a+b=5\), \(5a+b=17\): \(a=3,\ b=2\)
When can gf be formed?
Think of the machines again: \(f\)'s outputs are fed into \(g\). If \(f\) can produce a number that \(g\) refuses, the composite breaks.
1 Explain why fg cannot be formed
\(f(x)=\sqrt{x-1}\) for \(x\ge1\); \(g(x)=3-x\) for \(x\in\mathbb R\). Explain why \(fg\) cannot be formed.
Askedan explanationKnowfg: g first, then fRouteis the range of g inside the domain of f?
- Range of \(g\): all real numbers (a straight line on \(\mathbb R\))
- Domain of \(f\): \(x\ge1\) only
- The range of \(g\) is not within the domain of \(f\) (e.g. \(g(5)=-2\), and \(f(-2)\) is not defined), so \(fg\) cannot be formed
Name both sets in the answer: the range of the inner function and the domain of the outer one, and show one output that the outer function refuses.
2 With an inverse in it
\(g^{-1}\) has range \(g^{-1}(x)\ge-3\); \(h(x)=x+1\) for \(x\ge1\). Why can't \(hg^{-1}\) be formed?
Askedan explanationKnowhg⁻¹: g⁻¹ first, then hRouterange of g⁻¹ vs domain of h
- Range of \(g^{-1}\): \(\ge-3\), which includes values from \(-3\) up to \(1\)
- Domain of \(h\): \(x\ge1\)
- "The range of \(g^{-1}\) is not within the domain of \(h\)." (e.g. \(g^{-1}\) can output \(0\), but \(h(0)\) is not defined)
3 Find the condition
\(g(x)=3x+1\) for \(x>a\); \(f\) has domain \(x>7\). Find the set of \(a\) for which \(fg\) exists.
Askedset of aKnowrange of g is g(x) > 3a + 1Routemake that range sit inside x > 7
- Range of \(g\): \(g(x)>3a+1\)
- Need \(3a+1\ge7\) (so every output is more than 7)
- \(\mathbf{a\ge2}\) (at \(a=2\) the outputs are \(>7\), still fine)
4 The biggest domain that works
\(f(x)=x^2-6x+11=(x-3)^2+2\) for \(p<x<q\); \(g(x)=2x-1\) for \(x<6\). \(gf\) can be formed. Find the least \(p\) and greatest \(q\).
Askedleast p, greatest qKnowrange of f must be < 6Routesolve (x − 3)² + 2 < 6
- Need \(f(x)<6\): \((x-3)^2<4\Rightarrow-2<x-3<2\)
- \(1<x<5\)
- Least \(p=1\), greatest \(q=5\)
The domain and range of a composite
When \(gf\) exists, its domain is the domain of \(f\) (the first machine decides which inputs are allowed). Its range comes from feeding the range of \(f\) through \(g\).
Example. \(f(x)=x^2\) for \(x\ge1\) (range \(f(x)\ge1\)); \(g(x)=3x-2\) for \(x\in\mathbb R\). \(gf(x)=3x^2-2\) for \(x\ge1\). The inputs to \(g\) are all \(\ge1\), and \(g\) is increasing, so \(gf(x)\ge3(1)-2=1\).
- \(f(x)=x+5\) for \(x\ge0\); \(g(x)=\sqrt x\) for \(x\ge0\). Can \(gf\) be formed? What is its range?
Answer
yes: range of \(f\) is \(\ge5\), inside \(x\ge0\); \(gf(x)\ge\sqrt5\) - \(f(x)=x-5\) for \(x\in\mathbb R\); \(g(x)=\sqrt x\) for \(x\ge0\). Can \(gf\) be formed?
Answer
no: \(f\) can output negatives (\(f(0)=-5\)), which \(g\) refuses
Key facts at a glance
- \(fg(x)=f(g(x))\): the function next to \(x\) acts first. \(fg\ne gf\) and \(fg\) is not a product.
- Form it by putting the whole inner function, in brackets, into the outer rule.
- Numbers: work inside out. Equations: set equal and solve, or peel the outer layer.
- \(gf\) exists only when the range of \(f\) lies within the domain of \(g\).
- Domain of \(gf\) = domain of \(f\); its range = the range of \(f\) fed through \(g\).
How composite functions are examined, what the mark scheme wants, then real Paper 1 questions worked through slowly.
How this is examined
A composite is in almost every Functions question: form \(fg(x)\), evaluate it, or solve \(fg(x)=k\) (2-4 marks). The June 2021 report: some candidates "composed the functions in the wrong order or multiplied two or more functions together". For a numerical composite, the November 2021 report found that forming \(ff(x)\) first made the work "more complicated". Explaining why a composite cannot be formed was "the most challenging on the whole paper" (November 2022 report); "the range of \(g^{-1}\) is not within the domain of \(h\)" is the minimum answer schemes accept.
Mark-scheme focus
Explain why the composite function cannot be formed
![Functions f(x) = x + 1/x for x > 0, g(x) = ax + 1 for x ∈ R. (a) gf(x) [1] (b) gf(2) = 11: find a [2] (c) Minimum at x = 1: explain whether f has an inverse [1]. a = 5: (d) g⁻¹f(x) [3] (e) Explain why fg cannot be formed [1]](/notes-content/9709/functions/img/9709_w22_12_q09.png)
- "The range of g does not lie in the domain of f" or "the domain of f does not include the whole of the range of g" B1
- an example outside the domain of f, e.g. \(g(-1)=-4\) but \(f\) needs \(x>0\)
- "because g is not one-one" (irrelevant)
- "because you can't divide by zero" (only part of the story; \(g\) also gives negatives)
- mentioning only one function
A composite fg exists when g's outputs can all be fed into f. The explanation must link the two sets in the right order.
From: 9709/12/O/N/22 Q9(e) and the November 2022 report.
Solve gf(x) = … (reject what is not in the domain)
![f(x) = (x + 3)² − 12 for x ≥ 0, g(x) = 2x − 5. (c) Solve the equation gf(x) = 69. [4]](/notes-content/9709/functions/img/9709_w25_11_q06.png)
- \(gf(x)=2((x+3)^2-12)-5\) *M1; \(2(x+3)^2-29=69\) A1
- solve (no method needed for this one) DM1
- \(x=4\) only A1
- \(x=4\) and \(x=-10\): \(-10\) is not in the domain \(x\ge0\)
- \(f^{-1}\) then \(g^{-1}\) in the wrong order ("scores *M0")
peeling: \(g(\text{f(x)})=69\Rightarrow f(x)=g^{-1}(69)=37\Rightarrow(x+3)^2=49\Rightarrow x=4\).
From: 9709/11/O/N/25 Q6(c).
- Form a composite: almost every functions question, 1-2 marks.
- Solve a composite equation: 3-5 marks; the final A1 needs the domain check ("x = 4 only").
- Find constants from composite values: 4-5 marks 9709/11/M/J/23 Q8(a), 9709/11/M/J/21 Q9(d).
- Why can't it be formed / when can it: 1-3 marks, the hardest marks on the topic.
Worked examples
Example 1 · fg, then an equation with both composites (Paper 1, 5 marks) ★★ Medium
![The functions f and g are defined by f(x) = x² + 3 for x > 0, g(x) = 2x + 1 for x > −1/2. (a) Find an expression for fg(x). [1] (b) Find an expression for (fg)⁻¹(x) and state the domain of (fg)⁻¹. [4] (c) Solve the equation fg(x) − 3 = gf(x). [4]](/notes-content/9709/functions/img/9709_w20_11_q11.png)
Two simple functions combined both ways. Part (a) puts \(g\) inside \(f\). Part (c) needs \(gf\) as well, then an ordinary quadratic. The domains decide which root survives.
- fg(x)g first, then f: f(2x + 1)
- gf(x)f first, then g: g(x² + 3)
- x > 0 / x > −½check the roots at the end
- (a)fg(x)
- (c)x
- \(f(x)=x^2+3\)x > 0
- \(g(x)=2x+1\)x > −½
- \(gf(x)\) needs \(x>0\) (the domain of \(f\)); \(fg(x)\) needs \(x>-\tfrac12\)
- (a)fg(x)
- Use\(f(2x+1)=(2x+1)^2+3\)
- (c)x
- Also\(gf(x)=2(x^2+3)+1\)
- Use\((2x+1)^2=2x^2+7\)
- Trapkeeping x = −3
Why does the −3 make (c) nice?
\(fg(x)-3=(2x+1)^2\): the +3 cancels.
Which root is allowed?
Both composites need \(x>0\) for gf: \(x=1\) only.
5 Now solve it have a go on paper first, then open the worked solution
- (a) \(fg(x)=(2x+1)^2+3\) B1
- (c) \(gf(x)=2(x^2+3)+1\) B1; \((2x+1)^2+3-3=2x^2+7\) *M1
- \(4x^2+4x+1=2x^2+7\Rightarrow2x^2+4x-6=0\Rightarrow(x+3)(x-1)=0\) DM1
- \(x=1\) (\(x=-3\) is not in the domain) A1
The November 2020 report: "some omitted the '–3' on the left-hand side", and "some candidates did not show working for the solution of the quadratic, which resulted in the loss of a method mark."
\(fg(1)-3=9+3-3=9\); \(gf(1)=2(4)+1=9\) ✓.
Example 2 · Find two constants from composite values (Paper 1, 4 marks) ★★ Medium
![f(x) = 1 + 2a/(x − a) for x > a, g(x) = bx − 2 for x ∈ R. (a) Given that f(7) = 5/2 and gf(5) = 4, find the values of a and b. [4]](/notes-content/9709/functions/img/9709_s23_11_q08.png)
Two facts, two unknowns. \(f(7)=\tfrac52\) only involves \(a\): solve that first. Then \(gf(5)\): find \(f(5)\) with your \(a\), feed it into \(g\), set equal to 4.
- f(7) = 5/2an equation in a only
- gf(5)f(5) first (a number), then g of it
- (a)\(a\) and \(b\)
- \(f(x)=1+\dfrac{2a}{x-a}\)
- \(g(x)=bx-2\)
- Finda
- Use\(1+\tfrac{2a}{7-a}=\tfrac52\)
- Findb
- Firstf(5) with a = 3
- Use\(g(f(5))=4\)
Clear the fraction in 2a/(7 − a) = 3/2.
\(4a=3(7-a)\Rightarrow7a=21\).
What is f(5) when a = 3?
\(1+\tfrac{6}{2}=4\).
5 Now solve it have a go on paper first, then open the worked solution
- \(1+\dfrac{2a}{7-a}=\dfrac52\Rightarrow\dfrac{2a}{7-a}=\dfrac32\Rightarrow4a=21-3a\Rightarrow a=3\) M1 A1
- \(f(5)=1+\dfrac{6}{5-3}=4\); \(g(4)=4b-2=4\) M1
- \(b=\tfrac32\) A1
The June 2023 report: "a common error was omitting to multiply the 1 when multiplying through by 7 – a", and for \(b\), "those who found f(5) first were generally more successful".
\(f(7)=1+\tfrac64=\tfrac52\) ✓; \(g(4)=6-2=4\) ✓.
Example 3 · A composite equation with a rejected root (Paper 1, 4 marks) ★★ Medium
![Functions f: x ↦ x² − 1 for x < 0, g: x ↦ 1/(2x + 1) for x < −1/2. (a) Solve the equation fg(x) = 3. [4]](/notes-content/9709/functions/img/9709_s21_13_q08.png)
\(fg(x)=\dfrac{1}{(2x+1)^2}-1\). Set it equal to 3, isolate the bracket, square-root (two signs), and keep only the root inside \(x<-\tfrac12\).
- fgg first: 1/(2x + 1) into f
- x < −½the domain of g: the final check
- (a)x
- \(f(x)=x^2-1\)x < 0
- \(g(x)=\dfrac1{2x+1}\)x < −½
- Findx
- Use\(\dfrac{1}{(2x+1)^2}-1=3\Rightarrow(2x+1)^2=\tfrac14\)
- Trapkeeping \(x=-\tfrac14\)
Isolate the bracket.
\(\tfrac{1}{(2x+1)^2}=4\Rightarrow(2x+1)^2=\tfrac14\Rightarrow2x+1=\pm\tfrac12\).
Which root satisfies x < −½?
\(x=-\tfrac34\). The other, \(-\tfrac14\), is bigger than \(-\tfrac12\).
5 Now solve it have a go on paper first, then open the worked solution
- \(fg(x)=\dfrac{1}{(2x+1)^2}-1\) B1
- \(=3\Rightarrow4(2x+1)^2=1\) M1
- \(2x+1=\pm\tfrac12\) A1
- \(x=-\tfrac34\) only A1
Alternative (peeling): \(f(u)=3\Rightarrow u^2=4\Rightarrow u=-2\) (as \(u<0\)); \(g(x)=-2\Rightarrow2x+1=-\tfrac12\Rightarrow x=-\tfrac34\).
\(g(-\tfrac34)=\tfrac{1}{-1/2}=-2\); \(f(-2)=4-1=3\) ✓.
Example 4 · When can gf be formed? (Paper 1, 3 marks) ★★★ Hard
![(a) Express 4x² − 12x + 13 in the form (2x + a)² + b. [2] f(x) = 4x² − 12x + 13 for p < x < q; g(x) = 3x + 1 for x < 8. (b) Given that it is possible to form gf, find the least possible value of p and the greatest possible value of q. [3]](/notes-content/9709/functions/img/9709_w23_11_q09.png)
Why it is hard: it reverses the usual job: instead of a domain giving a range, a required range gives the domain.
\(gf\) means \(f\) first, then \(g\). \(g\) only accepts inputs less than 8, so every output of \(f\) must be less than 8. The completed square makes that inequality easy.
- possible to form gfrange of f within the domain of g (x < 8)
- least p, greatest qthe widest interval where \(f(x)<8\)
- (b)\(p\) and \(q\)
- \(f(x)=(2x-3)^2+4\)from (a)
- \(g\): \(x<8\)
- Findp, q
- Use\(f(x)<8\)
- Solve\((2x-3)^2<4\)
- Use\(f(x)<8\)
Solve (2x − 3)² < 4 without squaring out.
\(-2<2x-3<2\Rightarrow1<2x<5\Rightarrow\tfrac12<x<\tfrac52\).
Why < 8 and not ≤ 8?
\(g\)'s domain is \(x<8\): 8 itself is not allowed.
5 Now solve it have a go on paper first, then open the worked solution
- (a) \((2x-3)^2+4\) B1 B1
- (b) Need \((2x-3)^2+4<8\) *M1
- \((2x-3)^2<4\Rightarrow\tfrac12<x<\tfrac52\) DM1
- least \(p=\tfrac12\), greatest \(q=\tfrac52\) A1
At \(x=\tfrac12\) or \(\tfrac52\), \(f=8\): exactly the edge, excluded ✓.
Summary
- \(fg(x)=f(g(x))\): the function next to \(x\) acts first. Never multiply.
- Numbers: inside out, one step at a time.
- Solve composites by forming them, or by peeling one layer at a time; reject roots outside the domain.
- gf exists only if range f ⊆ domain g; explain with both sets named.
| If you see… | do this |
|---|---|
| \(fg(x)\) | replace every \(x\) in \(f\) by \((g(x))\) |
| \(fg(3)\) | \(g(3)\) first, then \(f\) of that |
| \(gf(x)=k\) | form it and solve, or \(f(x)=g^{-1}(k)\) |
| "explain why fg cannot be formed" | the range of g is not within the domain of f (example) |
| "given that gf can be formed" | range of f must lie in the domain of g: solve the inequality |
Can I do this?
- I know fg(x) means g first, then f, and can evaluate fg(a) step by step.
- I can form and simplify a composite, and solve a composite equation, rejecting roots outside the domain.
- I can find unknown constants from composite values.
- I can explain when a composite can or cannot be formed, using range and domain.
Anything unticked: revise that section first. All ticked: take the quiz.
Quiz
The multiple-choice and guided questions need JavaScript. The concept checks and exam practice below work without it.
Concept checks
Answer each one in your head first, then open it.
1Is \(fg=gf\) ever true?Show answer
Sometimes: e.g. when \(g=f^{-1}\) (both give \(x\)), or \(f(x)=x+2,\ g(x)=x+5\). In general no.
2Why does \(f^{-1}f(x)=x\)?Show answer
\(f\) takes \(x\) to \(f(x)\); \(f^{-1}\) undoes it. (This is how you check an inverse.)
3How do you find the range of \(fg\)?Show answer
Find the range of \(g\) first, then see which values \(f\) produces from those inputs only.
Exam-style practice
New questions, not used above. Do them on paper, then mark your work against the official mark scheme.
![f(x) = (x + 3)/(x − 1) for x > 1. (a) Find the value of ff(5). [2]](/notes-content/9709/functions/img/9709_w21_12_q03.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (a) | \(f(5)=\tfrac84=2\), then \(f(2)=\tfrac51\) | M1 | inside out, one function at a time |
| \(ff(5)=5\) | A1 | ||
| Total: 2 marks | |||
![f(x) = 48/(x − 1) for 3 ≤ x ≤ 7; g(x) = 2x − 4 for a ≤ x ≤ b. (i) Find the greatest value of a and the least value of b which will permit the formation of gf. [2] (ii) Find gf(x). [1] (iii) Find (gf)⁻¹(x). [2]](/notes-content/9709/functions/img/9709_s19_13_q04.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (i) | range of f: \(f(7)=8\) to \(f(3)=24\); greatest \(a=8\) | B1 | the domain of g must contain the whole range of f |
| least \(b=24\) | B1 | 8 and 24 seen without the right labels: SC B1 | |
| (ii) | \(gf(x)=\dfrac{96}{x-1}-4\) | B1 | or \(\dfrac{100-4x}{x-1}\); \(2\left(\dfrac{48}{x-1}\right)-4\) alone is not enough |
| (iii) | \(y+4=\dfrac{96}{x-1}\Rightarrow x-1=\dfrac{96}{y+4}\) | M1 | allow sign errors |
| \((gf)^{-1}(x)=1+\dfrac{96}{x+4}\) | A1 | must be a function of x | |
| Total: 5 marks | |||
Your progress on this note is saved when JavaScript is on.