Composite Functions

On this page

How to work out a composite function at a number, find its expression, find the inverse of a composite, and solve equations with one or both orders.

The method

fg(x) means f(g(x)): the function next to x acts first. Work from the inside out.

For fg(x) the input is x itself. Step 1 gives an expression, and step 2 puts the whole of it into f, in a bracket.

gf(x) is a different function: f acts first. Here gf(x)=(5-2x)^2+1, not 3-2x^2.

fg(x) never means f(x)\times g(x). Do not work out f(3) and g(3) separately.

Now try this

f(x)=x^2-3x and g(x)=4x-7

Find gf(-2)

  1. f acts first: f(-2)=(-2)^2-3\times(-2)=4+6=10
  2. g(10)=4\times10-7=33

More like this: practice questions

Worked example 1: Finding a composite function

f(x)=2x-3 and g(x)=x^2+4x

Find gf(x)

Give your answer in its simplest form.

  1. f acts first, so 2x-3 replaces every x in g:gf(x)=(2x-3)^2+4(2x-3)
  2. =4x^2-12x+9+8x-12
  3. =4x^2-4x-3
  4. The 4 multiplies the whole bracket: 4(2x-3), not 4\times2x-3.
  5. In a "Show that" question, write every line and end with the expression you were given.

Now try this

f(x)=x^2-5 and g(x)=3x+1

Find fg(x)

Give your answer in its simplest form.

Type powers with ^ and fractions with /, for example x^2 or (x+1)/3

  1. g acts first: fg(x)=(3x+1)^2-5
  2. =9x^2+6x+1-5
  3. =9x^2+6x-4

More like this: practice questions

Worked example 2: The inverse of a composite function

f(x)=x^3 and g(x)=3x-1

The function h is such that h(x)=fg(x)

Find h^{-1}(x)

  1. Form the composite first: h(x)=fg(x)=(3x-1)^3
  2. Then find the inverse of that one function. Write y=(3x-1)^3 and make x the subject.
  3. \sqrt[3]{y}=3x-1so x=\dfrac{\sqrt[3]{y}+1}{3}
  4. h^{-1}(x)=\dfrac{\sqrt[3]{x}+1}{3}
  5. Give the answer in terms of x, not y. For hg^{-1}(x), find g^{-1}(x) first, then put it into h.

Now try this

f(x)=x+4 and g(x)=\dfrac{6}{x}

The function h is such that h(x)=gf(x)

Find h^{-1}(x)

Type powers with ^ and fractions with /, for example x^2 or (x+1)/3

  1. h(x)=gf(x)=\dfrac{6}{x+4}
  2. y=\dfrac{6}{x+4}so x+4=\dfrac{6}{y}so x=\dfrac{6}{y}-4
  3. h^{-1}(x)=\dfrac{6}{x}-4

More like this: practice questions

Worked example 3: Solving an equation with a composite function

f(x)=x^2 and g(x)=x-3

Find the values of x for which fg(x)=2x^2-x-15

  1. Form the composite first: fg(x)=(x-3)^2
  2. (x-3)^2=2x^2-x-15
  3. x^2-6x+9=2x^2-x-15
  4. 0=x^2+5x-24
  5. 0=(x+8)(x-3)so x=-8 or x=3
  6. Only fg(x) changes. The right-hand side is already in terms of x: do not put x-3 into it.

Now try this

f(x)=2x+5 and g(x)=x^2-4

Solve gf(x)=5

Give every value, separated by commas

  1. gf(x)=(2x+5)^2-4, so (2x+5)^2-4=5
  2. (2x+5)^2=9so 2x+5=3 or 2x+5=-3. A square root can be positive or negative.
  3. x=-1 or x=-4

More like this: practice questions

Worked example 4: An equation with both orders

f(x)=x^2+2 and g(x)=1-2x

Show that fg(x)+2gf(x)=0 has just one solution, and find it.

  1. fg(x)=(1-2x)^2+2=4x^2-4x+3
  2. gf(x)=1-2(x^2+2)=-2x^2-3
  3. fg(x)+2gf(x)=4x^2-4x+3+2(-2x^2-3)
  4. =4x^2-4x+3-4x^2-6=-4x-3
  5. The x^2 terms cancel, so -4x-3=0 is linear and has just one solution: x=-\dfrac34
  6. Label each composite as you write it. The 2 multiplies all of gf(x). Add the two expressions; do not set each one equal to 0.

Now try this

f(x)=3x-2 and g(x)=x^2+1

Solve gf(x)=3fg(x)

  1. gf(x)=(3x-2)^2+1=9x^2-12x+5
  2. fg(x)=3(x^2+1)-2=3x^2+1so 3fg(x)=9x^2+3
  3. 9x^2-12x+5=9x^2+3so -12x=-2so x=\dfrac16

More like this: practice questions

Interactive diagram

Practice questions