Steply

f(x) = x + 4 and g(x) = 2x. Find f(g(x)) and g(f(x)).

Step by step, with the reason for every step · IGCSE Maths Extended Paper 4 · IGCSE Maths

Step by step

The question

Question: find f(g(x)) and g(f(x)) for f(x) = x + 4 and g(x) = 2x.

f(x) = x + 4
g(x) = 2x

1 Find f(g(x))

f(g(x)) is a function inside a function.

Like with brackets, we start inside.

f works on what g(x) gives.

So first g(x).

For example, with 2: g goes first and gives 4.

Then f works on 4 and gives 8.

inside first: g(x)
x → g → f
g(2) = 2(2)
= 4
f(4) = 4 + 4
= 8

g(x) is 2x.

So f(g(x)) is f(2x).

f(g(x)) = f(2x)

Put (2x) in place of every x in f.

We keep it in brackets.

The + 4 of f just waits at the end.

= (2x) + 4

A bracket with a plus or nothing in front can just be removed.

( ) away

Now we have 2x + 4.

f(g(x)) = 2x + 4

2 Find g(f(x))

g(f(x)) is a function inside a function.

Like with brackets, we start inside.

g works on what f(x) gives.

So first f(x).

f(x) is x + 4.

So g(f(x)) is g(x + 4).

g(f(x)) = g(x + 4)

Put (x + 4) in place of every x in g.

We keep it in brackets: the 2 multiplies the whole x + 4, not just a part.

= 2(x + 4)

The 2 in front of the bracket multiplies every part inside.

a(b + c) = ab + ac

So we write 2 times each part.

= 2(x) + 2(4)

2 times x is 2x.

2 times 4 is 8.

g(f(x)) = 2x + 8

3 Compare

2x + 4 and 2x + 8 are not the same.

So the order matters!

2x + 4 ≠ 2x + 8

Careful!

Inside first, then outside.

Swap them, and you usually get a different rule.

Careful: f(g(x)) is usually not g(f(x))

4 Check

Let's check with a number: x = 1.

Any number works; 1 keeps it easy.

g of 1 is 2, then f of 2 is 6.

f(g(1)) = f(2(1)) = f(2) = 2 + 4 = 6

f of 1 is 5, then g of 5 is 10.

Different, as we found.

g(f(1)) = g(1 + 4) = g(5) = 2(5) = 10

And our rules give the same numbers: 2x + 4 gives 6...

2x + 4: 2(1) + 4 = 2 + 4 = 6

...and 2x + 8 gives 10.

They are right!

2x + 8: 2(1) + 8 = 2 + 8 = 10

Let's look back.

First: find f(g(x)).

Then: find g(f(x)).

Then: compare.

Last: check.

Answer
2x + 4 ≠ 2x + 8

Your turn

Try this one yourself, then check your answer:

f(x) = x + 4, g(x) = 4x, find f(g(x)) and g(f(x))
Show the answer
4x + 4 ≠ 4x + 16

More from IGCSE Maths Extended Paper 4

The whole lesson: IGCSE Maths Extended Paper 4 →