KS Maths
Topic 2.5 · AA Standard Level

Composite and inverse functions

Square it then add, or add then square it

With f(x) = x² and g(x) = x + 3, start at 2. One order gives 25 and the other gives 7. The two composites agree at exactly one value of x, which is why testing a single number proves nothing.

This video lesson is a free sample. The plans open the rest of the lessons in this course, each with a figure to move and questions that check your answer as you type. See the plans.
Words you need (10 key words in this lesson)

The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.

inverse
The operation that undoes another one.Subtraction is the inverse of addition.
function
A rule that gives exactly one output for each input.f(x) = x plus 2 is a function.
inverse function
A function that undoes another function.If f adds 2, its inverse subtracts 2.
square
Multiply a number by itself. Also, a shape with four equal sides and four right angles.5 squared is 25.
write down
Give the answer with little or no working.Write down the median.
add
Put numbers together to find the total.Add 3 and 4 to get 7.
domain
All the input values a function can use.The domain of the square root is zero and above.
formula
A rule using letters that shows how to work something out.Area = length times width is a formula.
zero
The number 0. It is neither positive nor negative.5 minus 5 is zero.
input
The number you put into a function or machine.If the input is 3, the output is 5.

Warm-up

Four quick ones from earlier work. Try each on paper before you open the answer; a slip here shows you what to watch for later in the lesson.

  1. If p(x) = 3x − 4, find p(−2).
    Answer

    3(−2) − 4 = −6 − 4 = −10. Put the bracket round the negative number so the sign travels with it.

  2. Work out (−3)² and, separately, −3².
    Answer

    (−3)² = 9 because the bracket squares the sign as well. −3² = −9 because only the 3 is squared. Which one you meant matters as soon as a function is applied to a negative input.

  3. Make x the subject of y = 4x − 7.
    Answer

    Add 7 first: y + 7 = 4x. Then divide: x = (y + 7)/4. Undo the operations in the reverse of the order they were done.

  4. The point (1, 6) lies on a graph. Where does it go when the graph is reflected in the line y = x?
    Answer

    (6, 1). A reflection in y = x swaps the coordinates, which is exactly what swapping x and y does when you find an inverse.

Words used in this lesson
function
a rule that gives exactly one output for each input. For example: “double it” is a function: 3 goes in, 6 comes out.
composite function
one function applied to the output of another. For example: “add 1, then double” is a composite of two small functions.
inverse
the function that undoes the first one. For example: the inverse of “add 5” is “subtract 5”.
identity function
the function that changes nothing: it returns what you put in. For example: I(x) = x, so I(7) = 7.
one-to-one
different inputs always give different outputs. For example: “add 5” is one-to-one; “take the absolute value” is not, because −4 and 4 both give 4.
domain
the set of inputs the function is allowed to use. For example: if the domain is x ≥ 0, then −3 is not allowed in.
restrict
make the domain smaller on purpose. For example: restrict the domain to x ≥ 0 so each output has only one input.
reflection
a mirror image across a line. For example: reflecting the point (2, 5) in the y-axis gives (−2, 5).
find
work it out and write the result. For example: “find the inverse” wants a formula for the inverse.
hence
use the result you have just found. For example: “hence solve” means use your composite, not a new method.

Predict first. Before you use the slider: for very large positive x, which curve do you expect to be higher, add-then-square or square-then-add? And for very large negative x? Decide both, and say why.

Then check

Now sweep x from the far left to the far right and watch the two readouts and the gap. Does the order that wins on the right also win on the left? If a prediction was wrong, find the point where the two curves swap places.

x = 2.0
25.00f(g(x)), add then square
7.00g(f(x)), square then add
18.00 apartwhat the order costs

Two different functions, built from the same two pieces. They touch once and are otherwise nowhere near each other.

What a composite is

(f ∘ g)(x) = f(g(x))

and the bracket tells you the order: g acts first, because it is next to the x. Read it from the inside out, the way you would evaluate it.

With f(x) = x² and g(x) = x + 3, and x = 2:

  1. (f ∘ g)(2): add 3 to get 5, then square to get 25.
  2. (g ∘ f)(2): square to get 4, then add 3 to get 7.

As formulas, (f ∘ g)(x) = (x + 3)² and (g ∘ f)(x) = x² + 3. Expanding the first gives x² + 6x + 9, so the two differ by 6x + 6, which is zero only at x = −1. Both give 4 there, and everywhere else they disagree.

So checking one number is not a check. If you test x = −1 the two composites agree and you learn nothing. Test x = 1, or x = 0, where they are 9 and 3. Better still, write both formulas out and compare those, because a formula covers every x at once.

The identity function

The function that does nothing is I(x) = x, and it is what an inverse is for:

(f ∘ f⁻¹)(x) = (f⁻¹ ∘ f)(x) = x

Here the order does not matter, and for an inverse that is the definition rather than a lucky feature. Most pairs of functions do not behave like this, as the figure shows.

Finding one is three steps. For h(x) = 2x + 3:

  1. Write y = 2x + 3.
  2. Swap the letters: x = 2y + 3.
  3. Rearrange for y: y = (x − 3)/2.

So h⁻¹(x) = (x − 3)/2. Check it: h(1) = 5, and h⁻¹(5) = 1. Always do that check; it costs one line and it catches almost every rearrangement slip.

An inverse is a reflection in the line y = x. That is the picture behind all the algebra: swapping x and y is exactly what reflecting in y = x does to a point, so (1, 5) on h becomes (5, 1) on h⁻¹. It is also the fastest check in an exam, because a graph and its inverse have to be mirror images across that line, and if they are not then the rearrangement went wrong.

Only a one-to-one function has an inverse. f(x) = x² sends both 3 and −3 to 9, so an inverse would have to send 9 to both, and a function cannot. That is why √9 is defined as 3 and not as ±3, and it is why x² only gets an inverse once you restrict it to x ≥ 0. The restriction is not a technicality; it is what makes the inverse exist.

Inverting a composite reverses the order. This one is worth knowing and is not in the Standard Level content list, so read it as background rather than as something to revise for.

(f ∘ g)⁻¹ = g⁻¹ ∘ f⁻¹, when f and g both have inverses

which is just undoing things in the opposite order to doing them. The condition matters, and our f(x) = x² does not meet it until the domain is restricted: on x ≥ 0 it does, and then (f ∘ g)(2) = 25 undoes as take the square root to get 5, then subtract 3 to get back to 2. Doing it the other way round, subtract 3 from 25 to get 22 and then take the root, gives 4.69, which is not where you started.

On the GDC: composing and inverting

Define the two functions once and the machine will compose them in either order, which makes the difference between the two orders a two-line comparison rather than an argument.

When you may use it. Analysis Paper 1 is non-calculator, and this sub-topic is mostly Paper 1 work: composing and inverting are algebra. Paper 2 is where graphing the pair against y = x is worth the time.

TI-Nspire CX II

  1. On a Calculator page: Define f(x)=x^2 and Define g(x)=x+3
  2. f(g(2)) gives 25 and g(f(2)) gives 7. Put both on one screen
  3. Do not expect f(g(x)) to give you the composite as a formula: the permitted Nspire is non-CAS, so with x undefined it reports an error rather than an expression. Write the formula by hand, then check it at a number, for instance f(g(1)) against (1 + 3)² = 16
  4. To see an inverse, graph f1(x)=2x+3, f2(x)=(x-3)/2 and f3(x)=x with a square window: menu → Window / Zoom → Zoom Square

Casio fx-CG50

  1. MENU → Graph, with Y1=X^2 and Y2=X+3
  2. Then Y3=Y1(Y2(X)), selecting Y1 and Y2 from VARS → F4 GRAPH. Y4 as Y2(Y1(X)) gives the other order. Give the inner function its argument; Y1(Y2) on its own is not reliably read as a composition
  3. Deselect Y1 and Y2 with F1 so only the two composites draw
  4. SHIFT F3 V-Window and F3 STD, then SHIFT F5 G-SOLVE → ISCT finds the single crossing at x = -1

The mark people lose. Composing in the order the letters are written rather than the order they act. (f ∘ g) means g first, because g is the one touching the x. The habit that fixes it: never write f ∘ g without immediately writing f(g(x)) underneath, with the brackets. Then the inside-out reading is on the page and cannot be misremembered under pressure.

A second example, finished by you

The same idea with a different pair of functions. The first three steps are written out with the reason for each; the last is yours. Say each reason out loud before you read it.

Let f(x) = 2x + 1 and g(x) = x². There are two values of x for which (f ∘ g)(x) = (g ∘ f)(x). Find them.

  1. (f ∘ g)(x) = f(g(x)) = f(x²) = 2x² + 1g is next to the x, so it acts first: square, then double and add 1.
  2. (g ∘ f)(x) = g(f(x)) = (2x + 1)² = 4x² + 4x + 1f acts first, then the whole result is squared. Square the entire bracket: the middle term 4x is the one that is easy to lose.
  3. Set them equal: 2x² + 1 = 4x² + 4x + 1, so 0 = 2x² + 4x.Move everything to one side. The 1s cancel, which leaves a quadratic with no constant term.
  4. Factorise 2x² + 4x and set each factor to zero. That gives two values of x; check both in the original composites.Your step. Write it out in full before you type the answer below.

Your answer. Type the value of x that is not zero.

Check before you go on

One question on the main idea. Each wrong option is a different common slip, so the reply tells you which one you made.

p(x) = 3x and q(x) = x + 2. Which of these is (p ∘ q)(x)?

p(x) = 3x and q(x) = x + 2. Which of these is (p ∘ q)(x)?

Undoing a sensor

A fridge sensor does not send the temperature itself. It sends a signal s that depends on the temperature T in °C, by the rule s = 2.5T + 10. To recover T from a signal you need the inverse of that rule. The alarm sounds if T is above 8 °C. The sensor sends the signal 42.

Find the temperature T in °C that gave the signal 42, to 1 decimal place. Then decide whether the alarm sounds.

Your turn

Throughout: f(x) = x² and g(x) = x + 3.

1. Find (f ∘ g)(−6).

2. Find (g ∘ f)(−6).

3. For h(x) = 2x + 3, find h⁻¹(11).

4. Keep f(x) = x² but change g to g(x) = x − 2. At which value of x do f(g(x)) and g(f(x)) agree now?

5. Why does f(x) = x² have no inverse unless you restrict its domain?

Question 5. Why does f of x equals x squared have no inverse unless you restrict its domain?
Where the marks go

1 markThe composite written as f(g(x)), with the order right.

1 markThe substitution or the simplified formula.

1 markFor an inverse, the rearrangement, and the domain restriction where one is needed.

On "find the inverse" questions the domain is often the third mark and the one left blank. If the function is x² or anything built from it, say which half you are keeping.

Something to think about

Let f(x) = mx + c and g(x) = x + d. When is (f ∘ g)(x) equal to (g ∘ f)(x) for every x? Write both composites out first.

One way to think about it

Each composite is a line with gradient m, so only the constant terms can differ. Write the difference between the two constants as one expression and factorise it. When is a product zero? Then say what each possibility means in words: what kind of f, or what kind of g?

Climb to an exam question

Four steps, each one a little harder than the last. Every step is a piece of the exam question at the end, so by the top you have already done each part once.

Step 1 of 4: a composite at one number. k(x) = 3x − 2 and n(x) = x² + 4. Find (n ∘ k)(2).

Step 2 of 4: the composite as a formula. Expand (n ∘ k)(x) = (3x − 2)² + 4 as ax² + bx + c. Type b, the coefficient of x.

Step 3 of 4: an inverse function. k(x) = 3x − 2. Find k⁻¹(x), then type k⁻¹(10).

Step 4 of 4: set up an equation to solve. (n ∘ k)(x) = 13, where k(x) = 3x − 2 and n(x) = x² + 4. Which is this equation written as a quadratic equal to zero?

(n ∘ k)(x) = 13, where k(x) = 3x − 2 and n(x) = x² + 4. Which is this equation written as a quadratic equal to zero?

The exam question

Written for this site in the style of the real papers. Do it on paper first, as you would in the exam, and show your working: most of the marks are for method. There is no calculator on this paper, so give exact answers (fractions, surds, multiples of π) unless the question says otherwise. Then check each part below.

Paper 1 style · no calculator · 7 marks · about 8 minutes

The functions f and g are defined by f(x) = 2x − 5 and g(x) = x² + 1, for x ∈ ℝ.

(a) Find (g ∘ f)(x), giving your answer in the form ax² + bx + c. [2]

(b) Find f⁻¹(x). [2]

(c) Hence, or otherwise, solve the equation (g ∘ f)(x) = 10. [3]

Check (a). Type b, the coefficient of x in your answer.

Check your working for (b)

Write y = 2x − 5, swap the letters, and make the new y the subject. Your answer is a function of x, written with the inverse notation.

Check (c). The equation has two solutions. Type the larger one.

Want the rest of this topic?

This is a free sample lesson. The IB Diploma plan opens every other Diploma lesson, AA and AI, SL and HL, and every lesson from Year 7 for the refreshers. It covers every child in the family and includes all seven revision packs.

$99 for 12 months, or $149 for 2 years

One plan opens every Diploma lesson, AA and AI, SL and HL, for the whole family.

That is $8.25 a month for the whole family.

Student without a card? in one tap.

One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Already paid? Type the email you paid with in the sign-in box, then click the link we send. See every price, including $19 revision packs.

Teaching this lesson?

Every lesson here has a teacher page beside it: worked answers, what each common wrong answer tells you about a student's thinking, and questions at three levels for the board. Every unit has a free sample lesson for students, and a plan opens every other lesson.

See the teacher pages