Steply

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

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

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

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

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

We keep it in brackets.

= 2(3x − 1) + 5

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

a(b + c) = ab + ac

So we write 2 times each part.

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

Watch the signs.

2 times 3x is 6x.

2 times (−1) is −2.

= 6x − 2 + 5

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

−2 + 5 is 3.

−2 + 5 = 3

So the expression is 6x + 3.

f(g(x)) = 6x + 3

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 2x + 5.

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

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

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

We keep it in brackets.

= 3(2x + 5) − 1

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

a(b + c) = ab + ac

So we write 3 times each part.

= 3(2x) + 3(5) − 1

3 times 2x is 6x.

3 times 5 is 15.

= 6x + 15 − 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

15 − 1 is 14.

15 − 1 = 14

So the expression is 6x + 14.

g(f(x)) = 6x + 14

3 Compare

6x + 3 and 6x + 14 are not the same.

So the order matters!

6x + 3 ≠ 6x + 14

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

f(g(1)) = f(2) = 9

f of 1 is 7, then g of 7 is 20.

Different, as we found.

g(f(1)) = g(7) = 20

And our rules give the same numbers: 6x + 3 gives 9, 6x + 14 gives 20.

They are right!

6x + 3 → 9, 6x + 14 → 20

Let's look back.

First: find f(g(x)).

Then: find g(f(x)).

Then: compare.

Last: check.

Answer
6x + 3 ≠ 6x + 14

Your turn

Try this one yourself, then check:

f(x) = x + 6, g(x) = 4x − 2, find f(g(x)) and g(f(x))
Show the answer
4x + 4 ≠ 4x + 22

More from Composition order

The whole lesson: Composition order →