Composite functions

AS · P1 · 11 min

A composite function applies one function and then another to the result. If ff doubles a number and gg squares it, then "do ff, then gg" is a new function, written gfgf. Paper 1 asks you to form composites, evaluate them, solve equations involving them, and decide whether a composite can be formed at all, which depends on matching the range of one function to the domain of the other.

The idea

Think of each function as a machine. The output of the first machine is fed straight into the second.

x →  f   f(x) →  g   g(f(x))x \ \xrightarrow{\ \ f\ \ }\ f(x) \ \xrightarrow{\ \ g\ \ }\ g\big(f(x)\big)
Definition

The composite function gfgf is defined by gf(x)=g(f(x))gf(x) = g\big(f(x)\big). It means: apply ff first, then apply gg to the result.

ffff (also written f2f^2) means apply ff twice: ff(x)=f(f(x))ff(x) = f\big(f(x)\big).

The order is the most important thing to get right. gfgf means ff first, because ff is next to the xx. Read it from right to left, as you would read g(f(x))g\big(f(x)\big) from the inside out.

In general gf≠fggf \neq fg. If f(x)=x+1f(x) = x + 1 and g(x)=x2g(x) = x^2:

  • gf(x)=g(x+1)=(x+1)2gf(x) = g(x + 1) = (x + 1)^2 (add one, then square);
  • fg(x)=f(x2)=x2+1fg(x) = f\left(x^2\right) = x^2 + 1 (square, then add one).
Forming a composite function
  1. Identify which function acts first: in gf(x)gf(x) it is ff.
  2. Write g(  )g(\ \ ) with an empty bracket, using the rule for gg with every xx replaced by a bracket.
  3. Put the whole expression f(x)f(x) into each bracket.
  4. Simplify.
  5. For a numerical value such as gf(3)gf(3), it is often quicker to work out f(3)f(3) first and then apply gg to that number.
Forming composites in both orders

The functions ff and gg are defined for x∈Rx \in \mathbb{R} by f(x)=2x+1f(x) = 2x + 1 and g(x)=x2−3g(x) = x^2 - 3. Find (a) fg(x)fg(x), (b) gf(x)gf(x), (c) gf(2)gf(2).

Solution

(a) gg first, then ff. The rule for ff is "double and add one":

fg(x)=f(x2−3)=2(x2−3)+1=2x2−5fg(x) = f\left(x^2 - 3\right) = 2\left(x^2 - 3\right) + 1 = 2x^2 - 5

(b) ff first, then gg. The rule for gg is "square and subtract three":

gf(x)=g(2x+1)=(2x+1)2−3=4x2+4x−2gf(x) = g(2x + 1) = (2x + 1)^2 - 3 = 4x^2 + 4x - 2

(c) f(2)=5f(2) = 5, then g(5)=25−3=22g(5) = 25 - 3 = 22. So gf(2)=22gf(2) = 22. (Check with (b): 4(4)+8−2=224(4) + 8 - 2 = 22.)

Applying a function twice

The function ff is defined by f(x)=3x−2f(x) = 3x - 2 for x∈Rx \in \mathbb{R}. Find ff(x)ff(x) and solve ff(x)=xff(x) = x.

Solutionff(x)=f(3x−2)=3(3x−2)−2=9x−8ff(x) = f(3x - 2) = 3(3x - 2) - 2 = 9x - 8

ff(x)=xff(x) = x gives 9x−8=x9x - 8 = x, so 8x=88x = 8 and x=1x = 1. (Indeed f(1)=1f(1) = 1, so ff(1)=1ff(1) = 1.)

Solving an equation with a composite

With f(x)=2x+1f(x) = 2x + 1 and g(x)=x2−3g(x) = x^2 - 3 for x∈Rx \in \mathbb{R}, solve gf(x)=6gf(x) = 6.

Solution

From the first example, gf(x)=4x2+4x−2gf(x) = 4x^2 + 4x - 2. So

4x2+4x−2=6⇒4x2+4x−8=0⇒x2+x−2=0⇒(x+2)(x−1)=04x^2 + 4x - 2 = 6 \quad\Rightarrow\quad 4x^2 + 4x - 8 = 0 \quad\Rightarrow\quad x^2 + x - 2 = 0 \quad\Rightarrow\quad (x + 2)(x - 1) = 0

So x=1x = 1 or x=−2x = -2.

Alternatively, work backwards: g(f(x))=6g(f(x)) = 6 means (f(x))2−3=6\big(f(x)\big)^2 - 3 = 6, so f(x)=±3f(x) = \pm 3, giving 2x+1=32x + 1 = 3 or 2x+1=−32x + 1 = -3, i.e. x=1x = 1 or x=−2x = -2.

When can a composite be formed?

gf(x)gf(x) feeds the outputs of ff into gg. Every one of those outputs must be an allowed input for gg.

Key result

The composite gfgf can be formed only if

the range of f is contained in the domain of g\text{the range of } f \text{ is contained in the domain of } g

The domain of gfgf is the domain of ff.

If even one output of ff is outside the domain of gg, then gfgf does not exist as a function on that domain.

Deciding whether a composite exists

The functions ff and gg are defined by f(x)=x−4f(x) = x - 4 for x∈Rx \in \mathbb{R} and g(x)=xg(x) = \sqrt{x} for x≥0x \ge 0. Explain why gfgf cannot be formed, and find fg(x)fg(x).

Solution

The range of ff is all real numbers, R\mathbb{R}. The domain of gg is x≥0x \ge 0. The range of ff is not contained in the domain of gg: for example f(0)=−4f(0) = -4, and g(−4)=−4g(-4) = \sqrt{-4} is undefined. So gfgf cannot be formed.

For fgfg: the range of gg is g(x)≥0g(x) \ge 0, which is contained in the domain of ff (R\mathbb{R}). So fgfg exists:

fg(x)=f(x)=x−4,for x≥0fg(x) = f\left(\sqrt{x}\right) = \sqrt{x} - 4, \quad \text{for } x \ge 0
The range of a composite

The functions ff and gg are defined by f(x)=3−2xf(x) = 3 - 2x for −1≤x≤2-1 \le x \le 2 and g(x)=x2g(x) = x^2 for x∈Rx \in \mathbb{R}. Find the range of gfgf.

Solution

First find the range of ff, the set of values fed into gg. ff is decreasing, with f(−1)=5f(-1) = 5 and f(2)=−1f(2) = -1, so the range of ff is −1≤f(x)≤5-1 \le f(x) \le 5.

Now apply gg (squaring) to every number from −1-1 to 55. The squares of numbers in this interval run from 00 (at 00, which is in the interval) up to 2525 (at 55).

Range of gfgf: 0≤gf(x)≤250 \le gf(x) \le 25.

Squaring the end values alone would give 11 and 2525, but 00 lies between −1-1 and 55, and 02=00^2 = 0 is smaller than both.

Finding constants from a composite

The function ff is defined by f(x)=ax+bf(x) = ax + b for x∈Rx \in \mathbb{R}, where aa and bb are constants. Given that ff(x)=9x−8ff(x) = 9x - 8, find the possible pairs of values of aa and bb.

Solutionff(x)=a(ax+b)+b=a2x+ab+bff(x) = a(ax + b) + b = a^2x + ab + b

Compare coefficients with 9x−89x - 8:

  • xx: a2=9a^2 = 9, so a=3a = 3 or a=−3a = -3;
  • constant: ab+b=−8ab + b = -8, i.e. b(a+1)=−8b(a + 1) = -8.

If a=3a = 3: 4b=−84b = -8, b=−2b = -2. If a=−3a = -3: −2b=−8-2b = -8, b=4b = 4.

So a=3, b=−2a = 3,\ b = -2 or a=−3, b=4a = -3,\ b = 4. (Check the second: f(x)=−3x+4f(x) = -3x + 4, ff(x)=−3(−3x+4)+4=9x−8ff(x) = -3(-3x + 4) + 4 = 9x - 8.)

The least constant for which a composite exists

The functions ff and gg are defined by f(x)=x2+2x+kf(x) = x^2 + 2x + k for x∈Rx \in \mathbb{R} and g(x)=xg(x) = \sqrt{x} for x≥0x \ge 0, where kk is a constant. Find the least value of kk for which gfgf can be formed.

Solution

Complete the square: f(x)=(x+1)2+k−1f(x) = (x + 1)^2 + k - 1. The range of ff is f(x)≥k−1f(x) \ge k - 1.

For gfgf to exist, every value of ff must be in the domain of gg, i.e. ≥0\ge 0. So we need

k−1≥0⇒k≥1k - 1 \ge 0 \quad\Rightarrow\quad k \ge 1

The least value of kk is 11.

Watch out

Wrong order. fg(x)fg(x) means gg first. Students who do ff first lose every mark in the part. Say it aloud: "fgfg of xx is ff of gg of xx".

Multiplying instead of composing. fg(x)fg(x) is not f(x)×g(x)f(x) \times g(x). For f(x)=2x+1f(x) = 2x + 1 and g(x)=x2−3g(x) = x^2 - 3, f(x)g(x)=(2x+1)(x2−3)f(x)g(x) = (2x + 1)\left(x^2 - 3\right), which is something else.

Reading f2(x)f^2(x) as a square. In Cambridge function notation f2(x)f^2(x) means ff(x)ff(x), not (f(x))2\big(f(x)\big)^2.

Range of a composite from end points. As in the squaring example, the composite may reach values between the images of the end points. Track the whole interval.

Ignoring the domain condition. Before using gfgf, check that the range of ff lies inside the domain of gg.

Exam tip
  • Questions on composites are usually short (2 or 3 marks), but they set up later parts, such as solving fg(x)=0fg(x) = 0 or finding an inverse. Simplify the composite fully.
  • To "explain why gfgf cannot be formed", compare the range of ff with the domain of gg and say which values cause the problem. A numerical example (like f(0)=−4f(0) = -4 above) makes the explanation complete.
  • For gf(a)gf(a) with a number aa, working out f(a)f(a) first is quicker and less error-prone than forming gf(x)gf(x).
  • Keep brackets around substituted expressions until the last line.
Summary
  • gf(x)=g(f(x))gf(x) = g\big(f(x)\big): apply ff first.
  • In general fg≠gffg \neq gf.
  • ff(x)=f2(x)ff(x) = f^2(x) means apply ff twice.
  • To form gfgf, replace every xx in gg by the expression f(x)f(x), in brackets.
  • gfgf exists only if the range of ff lies within the domain of gg.
  • The range of gfgf: find the range of ff, then apply gg to that whole set.
  • Unknown constants: expand the composite and compare coefficients.

Practice questions

Question
  1. f(x)=3x−1f(x) = 3x - 1 and g(x)=x2+2g(x) = x^2 + 2 for x∈Rx \in \mathbb{R}. Find fg(x)fg(x), gf(x)gf(x) and gf(1)gf(1).
  2. f(x)=2x+3f(x) = 2x + 3 for x∈Rx \in \mathbb{R}. Find ff(x)ff(x) and solve ff(x)=21ff(x) = 21.
  3. f(x)=1x+1f(x) = \dfrac{1}{x + 1} for x>−1x > -1. Show that ff(x)=x+1x+2ff(x) = \dfrac{x + 1}{x + 2}.
  4. f(x)=x2f(x) = x^2 and g(x)=x−3g(x) = x - 3 for x∈Rx \in \mathbb{R}. Solve fg(x)=gf(x)fg(x) = gf(x).
  5. f(x)=x+5f(x) = x + 5 for x∈Rx \in \mathbb{R} and g(x)=xg(x) = \sqrt{x} for x≥0x \ge 0. Explain why gfgf cannot be formed. Find fg(x)fg(x) and state its range.
  6. f(x)=2x−1f(x) = 2x - 1 for 0≤x≤30 \le x \le 3 and g(x)=x2−2xg(x) = x^2 - 2x for x∈Rx \in \mathbb{R}. Find the range of gfgf.
  7. f(x)=ax+bf(x) = ax + b for x∈Rx \in \mathbb{R}. Given that f(2)=7f(2) = 7 and ff(1)=13ff(1) = 13, find the possible values of aa and bb.
  8. f(x)=2x+kf(x) = 2x + k for x≥0x \ge 0 and g(x)=x−3g(x) = \sqrt{x - 3} for x≥3x \ge 3. (a) Find the set of values of kk for which gfgf can be formed. (b) For k=7k = 7, solve gf(x)=4gf(x) = 4.
  9. g(x)=4x−1g(x) = 4x - 1 for x∈Rx \in \mathbb{R}, and ff is a function such that fg(x)=16x2−8x+3fg(x) = 16x^2 - 8x + 3. Find f(x)f(x).
Answers
  1. fg(x)=3(x2+2)−1=3x2+5fg(x) = 3\left(x^2 + 2\right) - 1 = 3x^2 + 5. gf(x)=(3x−1)2+2=9x2−6x+3gf(x) = (3x - 1)^2 + 2 = 9x^2 - 6x + 3. gf(1)=g(2)=6gf(1) = g(2) = 6.

  2. ff(x)=2(2x+3)+3=4x+9ff(x) = 2(2x + 3) + 3 = 4x + 9. 4x+9=214x + 9 = 21 gives x=3x = 3.

  3. ff(x)=11x+1+1=11+(x+1)x+1=x+1x+2ff(x) = \dfrac{1}{\frac{1}{x + 1} + 1} = \dfrac{1}{\frac{1 + (x + 1)}{x + 1}} = \dfrac{x + 1}{x + 2}. (The range of ff is f(x)>0f(x) > 0, which is inside the domain x>−1x > -1, so ffff exists.)

  4. (x−3)2=x2−3(x - 3)^2 = x^2 - 3 gives x2−6x+9=x2−3x^2 - 6x + 9 = x^2 - 3, so 6x=126x = 12 and x=2x = 2.

  5. The range of ff is R\mathbb{R}, which includes negative numbers (e.g. f(−6)=−1f(-6) = -1), and these are not in the domain of gg. fg(x)=x+5fg(x) = \sqrt{x} + 5 for x≥0x \ge 0, with range fg(x)≥5fg(x) \ge 5.

  6. The range of ff is −1≤f(x)≤5-1 \le f(x) \le 5. Now g(t)=(t−1)2−1g(t) = (t - 1)^2 - 1 for −1≤t≤5-1 \le t \le 5: least value −1-1 at t=1t = 1; g(−1)=3g(-1) = 3, g(5)=15g(5) = 15. Range of gfgf: −1≤gf(x)≤15-1 \le gf(x) \le 15.

  7. 2a+b=72a + b = 7 and ff(1)=a(a+b)+b=13ff(1) = a(a + b) + b = 13. Substituting b=7−2ab = 7 - 2a: a(7−a)+7−2a=13a(7 - a) + 7 - 2a = 13, so a2−5a+6=0a^2 - 5a + 6 = 0, giving a=2a = 2 or a=3a = 3. Then a=2, b=3a = 2,\ b = 3 or a=3, b=1a = 3,\ b = 1.

  8. (a) The range of ff is f(x)≥kf(x) \ge k; this must lie in x≥3x \ge 3, so k≥3k \ge 3. (b) gf(x)=2x+7−3=2x+4gf(x) = \sqrt{2x + 7 - 3} = \sqrt{2x + 4}. 2x+4=4\sqrt{2x + 4} = 4 gives 2x+4=162x + 4 = 16, so x=6x = 6.

  9. Let t=4x−1t = 4x - 1, so 4x=t+14x = t + 1. Then 16x2−8x+3=(4x)2−2(4x)+3=(t+1)2−2(t+1)+3=t2+216x^2 - 8x + 3 = (4x)^2 - 2(4x) + 3 = (t + 1)^2 - 2(t + 1) + 3 = t^2 + 2. So f(t)=t2+2f(t) = t^2 + 2, i.e. f(x)=x2+2f(x) = x^2 + 2. Check: f(4x−1)=16x2−8x+1+2f(4x - 1) = 16x^2 - 8x + 1 + 2.

How well do you know this?

Builds on

Where this leads

Console

Search notes, courses and tools, or run an action