Cambridge IGCSE · Topic 1.7
IGCSE Add Maths 0606 / Topic 1 / IGCSE

One function inside another.

A composite function feeds the output of one function straight into another. Learn the notation \(fg(x)\) and \(f^{2}(x)\), see why \(fg\) and \(gf\) are usually different, solve equations such as \(fg(x) = 5\), and find the domain and range of a composite.

The key idea

\(fg(x) = f\big(g(x)\big)\): apply \(g\) FIRST, then \(f\). In general \(fg \ne gf\). \(f^{2}(x) = ff(x)\). The composite \(gf\) exists only when every output of \(f\) is an allowed input of \(g\); then the domain of \(gf\) lies within the domain of \(f\) and the range of \(gf\) lies within the range of \(g\).

x g(x) fg(x) g: x² + 2 f: 3x − 1 −1 3 8 0 2 5 2 6 17 domain of g outputs of g, inputs of f range of fg
Fig. 1: fg(x) with g(x) = x² + 2 and f(x) = 3x - 1. Each input goes through g first, then f. Reversing the order gives gf(2) = g(5) = 27, not fg(2) = 17
Section 01

Order matters.

In the lab, enter two functions and compare \(fg(x)\), where \(x\) goes into \(g\) first, with \(gf(x)\). Read a composite from the inside out: the function written nearest to \(x\) acts first.

Worked example fg, gf and f squared
\(f(x) = 3x - 1\) and \(g(x) = x^{2} + 2\) for \(x \in \mathbb{R}\). Find (a) \(fg(2)\) and \(gf(2)\) (b) \(fg(x)\) and \(gf(x)\) (c) \(f^{2}(x)\).
  1. (a) \(g(2) = 6\), so \(fg(2) = f(6) = 17\). \(f(2) = 5\), so \(gf(2) = g(5) = 27\).
  2. (b) \(fg(x) = f(x^{2} + 2) = 3(x^{2} + 2) - 1 = 3x^{2} + 5\).
  3. \(gf(x) = g(3x - 1) = (3x - 1)^{2} + 2 = 9x^{2} - 6x + 3\).
  4. (c) \(f^{2}(x) = f(3x - 1) = 3(3x - 1) - 1 = 9x - 4\).
Answer: (a) \(17\) and \(27\)   (b) \(fg(x) = 3x^{2} + 5\), \(gf(x) = 9x^{2} - 6x + 3\)   (c) \(f^{2}(x) = 9x - 4\)
Worked example Exponentials and logarithms
\(f(x) = \mathrm{e}^{x}\) and \(g(x) = 2x + 3\) for \(x \in \mathbb{R}\), and \(h(x) = \ln x\) for \(x > 0\). Find \(fg(x)\), \(gf(x)\) and \(hf(x)\).
  1. \(fg(x) = f(2x + 3) = \mathrm{e}^{2x + 3}\).
  2. \(gf(x) = g(\mathrm{e}^{x}) = 2\mathrm{e}^{x} + 3\).
  3. \(hf(x) = \ln\big(\mathrm{e}^{x}\big) = x\), because \(\ln\) and \(\mathrm{e}^{x}\) undo each other.
Answer: \(fg(x) = \mathrm{e}^{2x + 3}\), \(gf(x) = 2\mathrm{e}^{x} + 3\), \(hf(x) = x\)
Examiner trap

\(fg(x)\) is not \(f(x) \times g(x)\), and \(f^{2}(x)\) is not \(\big(f(x)\big)^{2}\). For \(f(x) = 3x - 1\), \(f^{2}(x) = 9x - 4\), whereas \((3x - 1)^{2} = 9x^{2} - 6x + 1\).

Section 02

Solving with composites.

To solve an equation such as \(fg(x) = 6\), first write \(fg(x)\) as a single expression in \(x\), then solve as usual. On Paper 1 there is no calculator, so leave answers exact: fractions, surds and logarithms such as \(\ln 3\).

Worked example A quadratic composite
\(f(x) = x^{2} - 3\) and \(g(x) = 2x + 1\) for \(x \in \mathbb{R}\). Solve \(fg(x) = 6\).
  1. \(fg(x) = (2x + 1)^{2} - 3\).
  2. \((2x + 1)^{2} - 3 = 6 \Rightarrow (2x + 1)^{2} = 9\).
  3. \(2x + 1 = 3\) or \(2x + 1 = -3\).
  4. Check: \(g(1) = 3\) and \(f(3) = 6\); \(g(-2) = -3\) and \(f(-3) = 6\).
Answer: \(x = 1\) or \(x = -2\)
Worked example An exponential composite
\(f(x) = \mathrm{e}^{x}\) and \(g(x) = 3x - 1\) for \(x \in \mathbb{R}\). Solve (a) \(fg(x) = 5\) (b) \(gf(x) = 8\), giving exact answers.
  1. (a) \(fg(x) = \mathrm{e}^{3x - 1} = 5\). Take \(\ln\) of both sides: \(3x - 1 = \ln 5\).
  2. So \(x = \dfrac{1 + \ln 5}{3}\).
  3. (b) \(gf(x) = 3\mathrm{e}^{x} - 1 = 8 \Rightarrow \mathrm{e}^{x} = 3\).
  4. So \(x = \ln 3\).
Answer: (a) \(x = \dfrac{1 + \ln 5}{3}\)   (b) \(x = \ln 3\)
Your turn
\(f(x) = x + 4\) for \(x \in \mathbb{R}\) and \(g(x) = \dfrac{6}{x}\) for \(x \ne 0\). Solve \(gf(x) = x\), giving your answers in surd form.
Examiner trap

From \((2x + 1)^{2} = 9\) you must take BOTH square roots, \(2x + 1 = \pm 3\). Writing only \(2x + 1 = 3\) loses \(x = -2\) and a mark.

Stage 1 · Learn

Check your understanding

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

\(f(x) = 2x + 3\) and \(g(x) = x^{2}\). Find \(fg(-2)\).

Quick check+10 XP

\(f(x) = 3x - 2\). Find \(f^{2}(x)\).

Quick check+10 XP

\(f(x) = \mathrm{e}^{x}\) and \(g(x) = x + 2\). Find \(gf(x)\).

Quick check+10 XP

The composite function \(gf\) exists when

Section 03

Domain and range of a composite.

\(gf\) can only exist if every output of \(f\) is an allowed input of \(g\). If it is not, the domain of \(f\) must be restricted. To find the range of \(gf\), feed the RANGE of \(f\) into \(g\).

Worked example Range of gf and fg
\(f(x) = x^{2} + 1\) for \(x \in \mathbb{R}\) and \(g(x) = \ln x\) for \(x > 0\). Find \(gf(x)\) and \(fg(x)\), and state the range of each.
  1. The range of \(f\) is \(f(x) \ge 1\), which lies inside \(x > 0\), so \(gf\) exists for all real \(x\).
  2. \(gf(x) = \ln(x^{2} + 1)\). Its inputs to \(\ln\) are at least 1, and \(\ln 1 = 0\), so \(gf(x) \ge 0\).
  3. \(fg(x) = (\ln x)^{2} + 1\) for \(x > 0\). \((\ln x)^{2} \ge 0\), with \(0\) when \(x = 1\), so \(fg(x) \ge 1\).
Answer: \(gf(x) = \ln(x^{2} + 1)\), range \(gf(x) \ge 0\); \(fg(x) = (\ln x)^{2} + 1\), range \(fg(x) \ge 1\)
Worked example Restricting the domain
\(f(x) = x - 3\) and \(g(x) = \ln x\) for \(x > 0\). Find the largest domain of \(f\) for which \(gf\) exists, and state the range of \(gf\).
  1. \(gf(x) = \ln(x - 3)\), and \(\ln\) only accepts positive inputs.
  2. So we need \(f(x) = x - 3 > 0\), that is \(x > 3\).
  3. For \(x > 3\), \(x - 3\) takes every positive value, so \(\ln(x - 3)\) takes every real value.
Answer: Domain \(x > 3\); range of \(gf\) is all real numbers
Your turn
\(f(x) = \mathrm{e}^{x}\) and \(g(x) = 2x - 1\) for \(x \in \mathbb{R}\). Find \(gf(x)\) and its range.
Examiner trap

Do not feed the DOMAIN of \(f\) into \(g\). For \(gf(x) = \ln(x^{2} + 1)\), putting 'all real numbers' into \(\ln\) wrongly suggests every real output; the inputs to \(\ln\) are only \(x^{2} + 1 \ge 1\), so \(gf(x) \ge 0\).

Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to IGCSE Additional Mathematics Paper 1 and Paper 2 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

\(f(x) = x^{2} - 5\) and \(g(x) = 3x + 1\) for \(x \in \mathbb{R}\). Solve \(fg(x) = 11\).

Exam style+20 XP

\(f(x) = \mathrm{e}^{x}\) and \(g(x) = 2x - 1\) for \(x \in \mathbb{R}\). Solve \(gf(x) = 5\).

Exam style+20 XP

\(f(x) = x - 4\) and \(g(x) = \ln x\) for \(x > 0\). Find the largest domain of \(f\) for which \(gf\) exists.

Exam style+20 XP

\(f(x) = x^{2} - 2\) and \(g(x) = \mathrm{e}^{x}\) for \(x \in \mathbb{R}\). Find the range of \(gf\).

Skill unlocked

Composites built, solved and ranged.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
Evaluating \(fg\) and \(gf\), building composites with a reciprocal and \(f^{2}\), exponential equations with exact answers, solving \(fg(x) = gf(x)\), restricting a domain for \(\ln\), and a temperature-conversion problem.