Steply

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

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

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 + 4.

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

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

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

We keep it in brackets.

= (x + 4) + 1

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

( ) away

Now we have x + 4 + 1.

= x + 4 + 1

Terms are the parts between the + and − signs.

Like terms are the same kind: same letters, same powers.

Plain numbers go together.

Each colour is one kind.

like terms = same letters,
same powers

4 + 1 is 5.

4 + 1 = 5

So the expression is x + 5.

f(g(x)) = x + 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 + 1.

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

g(f(x)) = g(x + 1)

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

We keep it in brackets.

= (x + 1) + 4

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

( ) away

Now we have x + 1 + 4.

= x + 1 + 4

Terms are the parts between the + and − signs.

Like terms are the same kind: same letters, same powers.

Plain numbers go together.

Each colour is one kind.

like terms = same letters,
same powers

1 + 4 is 5.

1 + 4 = 5

So the expression is x + 5.

g(f(x)) = x + 5

3 Compare

Both are x + 5.

Here the order did not matter.

But usually it does.

x + 5 = x + 5

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

f(g(1)) = f(5) = 6

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

The same, as we found.

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

And our rules give the same numbers: x + 5 gives 6, x + 5 gives 6.

They are right!

x + 5 → 6, x + 5 → 6

Let's look back.

First: find f(g(x)).

Then: find g(f(x)).

Then: compare.

Last: check.

Answer
x + 5 = x + 5

Your turn

Try this one yourself, then check:

f(x) = 4x + 3, g(x) = 2x + 1, find f(g(x)) and g(f(x))
Show the answer
8x + 7 = 8x + 7

More from Composition order

The whole lesson: Composition order →