Steply

f(x) = 5x, g(x) = x - 1, 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) = 5x and g(x) = x − 1.

f(x) = 5x
g(x) = x − 1

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 x − 1.

So f(g(x)) is f(x − 1).

f(g(x)) = f(x − 1)

Put (x − 1) in place of every x in f.

We keep it in brackets.

= 5(x − 1)

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

a(b + c) = ab + ac

So we write 5 times each part.

= 5(x) + 5(−1)
− × + = −

Watch the signs.

5 times x is 5x.

5 times (−1) is −5.

f(g(x)) = 5x − 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 5x.

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

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

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

We keep it in brackets.

= (5x) − 1

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

( ) away

Now we have 5x − 1.

g(f(x)) = 5x − 1

3 Compare

5x − 5 and 5x − 1 are not the same.

So the order matters!

5x − 5 ≠ 5x − 1

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 0, then f of 0 is 0.

f(g(1)) = f(0) = 0

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

Different, as we found.

g(f(1)) = g(5) = 4

And our rules give the same numbers: 5x − 5 gives 0, 5x − 1 gives 4.

They are right!

5x − 5 → 0, 5x − 1 → 4

Let's look back.

First: find f(g(x)).

Then: find g(f(x)).

Then: compare.

Last: check.

Answer
5x − 5 ≠ 5x − 1

Your turn

Try this one yourself, then check:

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

More from Composition order

The whole lesson: Composition order →