Steply

Solve f(x) = x^2 + 1, g(x) = 2x - 1, (f∘g)(x)

Step by step, with the reason for every step · Composition and inverse functions · Algebra 2

Step by step

The question

Question: find f(g(x)) for f(x) = x² + 1 and g(x) = 2x − 1.

f(x) = x2 + 1
g(x) = 2x − 1

1 Work out the inside

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

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

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

2 Put it in

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

We keep it in brackets.

= (2x − 1)2 + 1

3 Write the square out

A square means the bracket times itself.

(2x − 1)² is 2x − 1 times 2x − 1.

( )² = ( )( )

Careful!

We can't just square each part.

4x² + 1 is wrong.

The middle part is missing.

Careful: not (2x − 1)2 = 4x² + 1 ✗

So we write the bracket two times.

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

4 Split the first bracket

Each part of the first bracket multiplies the whole second bracket.

(a + b)(c + d) = a(c + d) + b(c + d)

The parts of the first bracket are 2x and −1.

Each one takes the whole second bracket.

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

5 Open the brackets

What is in front of a bracket multiplies every part inside.

a(b + c) = ab + ac

So we write each part times what is in front.

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

Watch the signs.

2x times 2x is 4x².

2x times (−1) is −2x.

(−1) times 2x is −2x.

(−1) times (−1) is 1.

= 4x2 − 2x − 2x + 1 + 1

6 Group like terms

Terms are the parts between the + and − signs.

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

All the x terms go together.

Plain numbers go together.

Each colour is one kind.

like terms = same letters,
same powers

−2x − 2x is −4x.

1 + 1 is 2.

−2x − 2x = −4x
1 + 1 = 2

So the expression is 4x² − 4x + 2.

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

7 Check

Let's check.

We pick a number for each letter: x = 2.

We put it into the start.

Start: (2 × 2 − 1)2 + 1 = (3)2 + 1 = 9 + 1
= 10

Now into our answer.

Answer: 4 × 22 − 4 × 2 + 2 = 16 − 8 + 2
= 10

Both give 10.

Same value, so 4x² − 4x + 2 is right!

Both give 10

Let's look back.

First: work out the inside.

Then: put it in.

Then: write the square out.

Then: split the first bracket.

Then: open the brackets.

Then: group like terms.

Last: check.

Answer
f(g(x)) = 4x2 − 4x + 2

Your turn

Try this one yourself, then check:

f(x) = x2 + 1, g(x) = 3x − 1, find f(g(x))
Show the answer
f(g(x)) = 9x2 − 6x + 2

More from Composition and inverse functions

The whole lesson: Composition and inverse functions →