Steply

f(x) = x + 5, g(x) = 4x, find f(g(x)) and g(f(x))

Step by step, with the reason for every step · Composition order · Algebra 2

Step by step

The question

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

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

1 Find f(g(x))

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

Like with brackets, we start inside.

First g(x).

inside first: g(x)

g(x) is 4x.

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

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

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

We keep it in brackets.

= (4x) + 5

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

( ) away

Now we have 4x + 5.

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

2 Find g(f(x))

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

Like with brackets, we start inside.

First f(x).

f(x) is x + 5.

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

g(f(x)) = g(x + 5)

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

We keep it in brackets.

= 4(x + 5)

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

a(b + c) = ab + ac

So we write 4 times each part.

= 4(x) + 4(5)

4 times x is 4x.

4 times 5 is 20.

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

3 Compare

4x + 5 and 4x + 20 are not the same.

So the order matters!

4x + 5 ≠ 4x + 20

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.

g of 1 is 4, then f of 4 is 9.

f(g(1)) = f(4) = 9

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

Different, as we found.

g(f(1)) = g(6) = 24

And our rules give the same numbers: 4x + 5 gives 9, 4x + 20 gives 24.

They are right!

4x + 5 → 9, 4x + 20 → 24

Let's look back.

First: find f(g(x)).

Then: find g(f(x)).

Then: compare.

Last: check.

Answer
4x + 5 ≠ 4x + 20

Your turn

Try this one yourself, then check:

f(x) = x + 3, g(x) = x, find f(g(x)) and g(f(x))
Show the answer
x + 3 = x + 3

More from Composition order

The whole lesson: Composition order →