Lesson 15

Completing the square

Theory and examples

Completing the square is a way to rewrite a quadratic into turning point form. The main move is finding the magic number.

Find the magic number

magic number=(coefficient of x2)2\text{magic number}=\left(\frac{\text{coefficient of\ }x}{2}\right)^2

Add and subtract this number. That changes the shape of the expression, but not its value.

Start with the move

Example 1

Complete the square:

x2+6xx^2+6x
1
(62)2=32=9\left(\frac{6}{2}\right)^2 = 3^2 = \textcolor{#2563eb}{9}

Find the magic number. Halve the coefficient of xx, then square it.

2
x2+6x=x2+6x+9−9x^2 + 6x = x^2 + 6x + \textcolor{#2563eb}{9} - \textcolor{#2563eb}{9}

Add and subtract the magic number. This keeps the total value of the expression exactly the same.

3
=x2+6x+9⏟(x+3)2−9= \underbrace{x^2 + 6x + \textcolor{#2563eb}{9}}_{(x+3)^2} - \textcolor{#2563eb}{9}

Recognise that the first three terms are a perfect square.

4
=(x+3)2−9= (x + 3)^2 - 9

Rewrite the perfect square and leave the subtracted magic number outside.

General form

x2+bx=(x+b2)2−(b2)2x^2+bx=\left(x+\frac{b}{2}\right)^2-\left(\frac{b}{2}\right)^2

Where the trick comes from

Why do we halve the middle number and square it? It helps to look at what happens when we multiply out a perfect square.

The pattern: working backwards

Think about expanding (x+3)2(x+3)^2. Using FOIL or grid multiplication, we get:

(x+3)(x+3)=x2+3x+3x+9(x+3)(x+3)=x^2+3x+3x+9
=x2+6x+9=x^2+\textcolor{#2563eb}{6}x+\textcolor{#2563eb}{9}

Notice two things about our final expression:

  • The middle number (66) is double the original number (3+33+3).
  • The final number (99) is that same original number squared (323^2).

So, if we only start with x2+6xx^2+6x, we reverse-engineer this pattern: halve the 66 to get back to 33, then square it to find the missing piece (99).

Optional: why this works in general

The general algebraic proof

(x+a)2=x2+2ax+a2(x+a)^2=x^2+2ax+a^2

If a quadratic starts with x2+bxx^2+bx, we want to force it to match that perfect square structure. To do that, we equate the middle terms:

2a=b  ⟹  a=b22a=b \implies a=\frac{b}{2}

The final term of the perfect square must be a2a^2, so the magic number is:

a2=(b2)2a^2=\left(\frac{b}{2}\right)^2

We add this value to create the perfect square, then subtract it to keep the expression unchanged.

More examples

Example 2: with a constant

x2+8x+5x^2+8x+5
1
(82)2=42=16\left(\frac{8}{2}\right)^2=4^2=\textcolor{#2563eb}{16}

Find the magic number from the coefficient of x.

2
x2+8x+5=x2+8x+16−16+5x^2+8x+5=x^2+8x+\textcolor{#2563eb}{16}-\textcolor{#2563eb}{16}+5

Add and subtract the magic number.

3
=x2+8x+16⏟(x+4)2−16+5=\underbrace{x^2+8x+\textcolor{#2563eb}{16}}_{(x+4)^2}-\textcolor{#2563eb}{16}+5

Recognise the perfect square.

4
=(x+4)2−11=(x+4)^2-11

Simplify the leftover constants.

Example 3: negative middle term

x2−10x+7x^2-10x+7
1
(−102)2=(−5)2=25\left(\frac{-10}{2}\right)^2=(-5)^2=\textcolor{#2563eb}{25}

The magic number is still positive because it is squared.

2
x2−10x+7=x2−10x+25−25+7x^2-10x+7=x^2-10x+\textcolor{#2563eb}{25}-\textcolor{#2563eb}{25}+7

Add and subtract the magic number.

3
=x2−10x+25⏟(x−5)2−25+7=\underbrace{x^2-10x+\textcolor{#2563eb}{25}}_{(x-5)^2}-\textcolor{#2563eb}{25}+7

Recognise the perfect square.

4
=(x−5)2−18=(x-5)^2-18

Simplify the leftover constants.

Why do this?

Completing the square is useful because it rewrites a quadratic in a form that reveals structure. Later, this helps with turning points, graphing, and sometimes factorising.

Worked walkthrough

Worked walkthrough

Optional mastery

Mastery questions

Do you want a high study score? Be disciplined. Do the mastery questions.

Open mastery questions

Checkpoint

Multiple-choice questions

Answer every question correctly to unlock the next lesson. If something is marked red, change your answer and check again.

Question 1
Why are we allowed to add and subtract the same term when completing the square?
Question 2
To complete the square for x2+6xx^2+6x, what term should be added and subtracted?
Question 3
Which expression is equivalent to x2+6xx^2+6x?
Question 4
Select all statements that are correct.

Select all that are correct.