Step by step
The question
Question: find g(f(x)) for g(x) = x² + x and f(x) = x − 1.
1 Work out the inside
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).
2 Put it in
Put (x − 1) in place of every x in g.
We keep it in brackets.
3 Write the square out
A square means the bracket times itself.
(x − 1)² is x − 1 times x − 1.
Careful!
We can't just square each part.
x² + 1 is wrong.
The middle part is missing.
So we write the bracket two times.
4 Split the first bracket
Each part of the first bracket multiplies the whole second bracket.
The parts of the first bracket are x and −1.
Each one takes the whole second bracket.
5 Open the brackets
What is in front of a bracket multiplies every part inside.
A bracket with a plus or nothing in front can just be removed.
So we write each part times what is in front.
Watch the signs.
x times x is x².
x times (−1) is −x.
(−1) times x is −x.
(−1) times (−1) is 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.
We move like terms next to each other.
Each term takes its sign with it.
−x − x + x is −x.
1 − 1 is 0.
So the expression is x² − x.
7 Check
Let's check.
We pick a number for each letter: x = 2.
We put it into the start.
Now into our answer.
Both give 2.
Same value, so x² − x is right!
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.