Skip to main content

Completing the square

So far, you will have come across a few situations where a quadratic cannot be further factorised into two linear factors using common factors, perfect squares, or the difference of two squares. In these cases, you can use a different method where you complete the square.

Before you begin, make sure you are confident with factorising using common factors, the difference of two squares rule, and the difference of two squares rule.

Video tutorial – factorising: completing the square

Watch this video to learn about completing the square.

Hi, I’m Martin Lindsay from the Study and Learning Centre at RMIT University. This is another factorisation movie. This one is on completing the square.

Let’s first look at X plus B all squared, which is the same as X squared plus two B X plus B squared, or putting it around the other way, X squared plus two B X plus B squared is the same as X plus B all squared. Notice the term B is half of the co‑efficient of X, the middle term. In other words X plus B all squared is called a perfect square. So as an example, X squared minus 24 X plus 144, look at the middle term which is minus 24 X, half of that is minus 12 and thus that is our perfect square. So knowing how to find a perfect square is very important when completing the square.

Let’s do an example. Factorise X squared plus eight X minus nine. Step one, half the co-efficient of X, in other words half of eight is four, then we square the result, four squared is 16. Step three, add and subtract 16, in other words X square plus eight X plus 16 is our perfect square, then we subtract the 16 minus nine, notice that expression there is the same as the original expression, eight square plus eight X minus nine. Step four, complete the square and simplify. In other words eight square plus eight X plus 16 is X plus four all squared minus 16 minus nine is minus 25 and then finally factorise using the difference of two squares, which is X plus four plus five brackets X plus four minus five, which is the same as X plus four X minus one.

Let’s do another one. X squared minus six X minus four. Step one, half the co‑efficient of X which is half of six is three, square the result, three squared is nine. Step three, add and subtract nine, that gives us X squared minus six X plus nine, there’s our perfect square, then we have to subtract nine to make sure that we have the original X squared minus six X minus four. Step four, complete the square and simplify, in other words, X squared minus six X plus nine is X minus three all squared minus nine minus four is minus 13 and then finally factorise using the difference of two squares, which is X minus three plus root 13, X minus three minus root 13.

Now let’s look at a slightly harder problem. Notice here we’re factorising two X squared minus 10 X plus two. We can only complete the square if the co-efficient of X squared is one, so the first step we have to do is to remove the factor of two, thus we have two brackets X squared minus five X plus one. Now we go through the same process as before, half the co-efficient of X, but here the co-efficient of X is now five, so that half of that is five over two, square the result, five over two squared is 25 over four, then we add and subtract 25 over four which gives us that expression. Continuing on from the previous slide we have that expression, now we need to take the difference of two squares which gives us two brackets X minus five over two all squared minus 21 over four, but that can be simplified into the final expression two brackets X minus five over two plus root 21 over two brackets X minus five over two minus root 21 over two.

Now try some questions for yourself. The answers to these problems are on the next slide. Thanks for watching this short movie.

Completing the square when \(a=1\)

Completing the square is a method that involves making the quadratic a perfect square, so that you can then factorise using \((x+b)^{2}=x^{2}+2bx+b^{2}\) or \((x-b)^{2}=x^{2}-2bx+b^{2}\). It allows any quadratic to be factorised.

You can complete the square using the following steps:

  1. Take \(\dfrac{1}{2}\) the coefficient in front of \(x\) and square it.
  2. Add the term to the expression. Remember that if you add a term, you must also subtract it to keep the expression balanced.
  3. Group the terms so that you can use the DOTS rule.

Note that DOTS can only be used if you are looking at the DIFFERENCE between squares. If the expression is the SUM of two squares, there will be no real linear factors.

See how this is applied to expressions in the form \(ax^{2}+bx+c\) where \(a=1\) with the following examples.

Example 1 – completing the square when \(a=1\)

Factorise \(x^2+8x-5\) by completing the square.

Find the term by calculating \(\dfrac{1}{2}\) of the coefficient in front of the \(x\), squared:

\[\left(\frac{8}{2}\right)^{2} = (4)^{2}\]

Add and subtract the term:

\[\begin{align*} x^{2}+8x-5 & = x^{2}+8x-5+(4)^{2}-(4)^{2}\quad\textrm{group terms}\\
& = x^{2}+8x+(4)^{2}-5-(4)^{2}\\
& = (x^{2}+8x+16)-5-16\quad\textrm{factorise quadratic using perfect squares}\\
& = (x+4)^{2}-21\quad\textrm{take square root of \(21\) and square it}\\
& = (x+4)^{2}-(\sqrt{21})^{2}\quad\textrm{use DOTS and take square root of both sides}\\
& = (x+4+\sqrt{21})(x+4-\sqrt{21})
\end{align*}\]

Factorise \(x^{2}-6x-4\) by completing the square.

Find the term by calculating \(\dfrac{1}{2}\) of the coefficient in front of the \(x\), squared:

\[\left(\frac{-6}{2}\right)^{2} = (-3)^{2}\]

Add and subtract the term:

\[\begin{align*} x^{2}-6x-4 & = x^{2}-6x-4+(-3)^{2}-(-3)^{2}\quad\textrm{group terms}\\
& = x^{2}-6x+(-3)^{2}-4-(-3)^{2}\\
& = (x^{2}-6x+9)-4-9\quad\textrm{factorise quadratic using perfect squares}\\
& = (x-3)^{2}-13\quad\textrm{take square root of \(13\) and square it}\\
& = (x-3)^{2}-(\sqrt{13})^{2}\quad\textrm{use DOTS and take square root of both sides}\\
& = (x-3+\sqrt{13})(x-2-\sqrt{13})
\end{align*}\]

Factorise \(x^{2}+5x+9\) by completing the square.

Find the term by calculating \(\dfrac{1}{2}\) of the coefficient in front of the \(x\), squared:

\[\left(\frac{5}{2}\right)^{2}\quad\textrm{keep as fraction}\]

Add and subtract the term:

\[\begin{align*} x^{2}+5x+9 & = x^{2}+5x+9+\left(\frac{5}{2}\right)^{2}-\left(\frac{5}{2}\right)^{2}\quad\textrm{group terms}\\
& = x^{2}+5x+\left(\frac{5}{2}\right)^{2}+9-\left(\frac{5}{2}\right)^{2}\\
& = (x^{2}+5x+\left(\frac{5}{2}\right)^{2}+9-\left(\frac{5}{2}\right)^{2}\quad\textrm{factorise quadratic using perfect squares}\\
& = \left(x+\frac{5}{2}\right)^{2}+\frac{11}{4}
\end{align*}\]

We are in trouble here. We cannot apply the DOTS rule because we have the SUM of two squares not the DIFFERENCE. So in this case, the quadratic \(x^{2}+5x+9\) does not have any real factors and solutions. Complex factors and solutions do exist but are not considered here.

Geometrically, the lack of real factors means that the graph of \(x^{2}+5x+9\) does not intersect the \(x\)-axis.

Your turn – competing the square when \(a=1\)

  1. Factorise by completing the square.
    1. \(x^{2}+6x-5\)
    2. \(x^{2}+4x+2\)
    3. \(a^{2}-8a-2\)
    4. \(x^{2}+6x+10\)
    5. \(x^{2}-5x+5\)
    6. \(y^{2}+3y+4\)
    7. \(a^{2}-5a-1\)

    1. \((x+3+\sqrt{14})(x+3-\sqrt{14})\)
    2. \((x+2+\sqrt{2})(x+2-\sqrt{2})\)
    3. \((a-4+3\sqrt{2})(a-4-3\sqrt{2})\)
    4. No real linear factors.
    5. \((x-\dfrac{5}{2}+\dfrac{\sqrt{5}}{2})(x-\dfrac{5}{2}-\dfrac{\sqrt{5}}{2})\)
    6. No real linear factors.
    7. \((a-\dfrac{5}{2}+\dfrac{\sqrt{29}}{2})(a-\dfrac{5}{2}-\dfrac{\sqrt{29}}{2})\)

Completing the square when \(a\neq1\)

When \(a\neq1\), we need to first take the \(a\) out by dividing each term by \(a\) before factorising the quadratic. That is:

\[ax^{2}+bx+c=a\left[x^{2}+\frac{b}{a}x+\frac{c}{a}\right]\]

We complete the square on the term in the square brackets. Don’t forget to include the \(a\) in your final answer!

Example – completing the square when \(a\neq1\)

Factorise \(2x^{2}-10x+2\).

Divide all terms in the quadratic by \(a\). Here, \(a=2\).

\[\begin{align*} 2x^{2}-10x+2 & = 2\left[x^{2}-\frac{10}{2}x+\frac{2}{2}\right]\\
& = 2\left[x^{2}-5x+1\right]
\end{align*}\]

Complete the square. Find the term by calculating \(\dfrac{1}{2}\) of the coefficient in front of the \(x\), squared:

\[\left(\frac{-5}{2}\right)^{2}\quad\textrm{keep as fraction}\]

Add and subtract the term:

\[\begin{align*} 2x^{2}-10x+2 & = 2\left[ x^{2}-5x+1+\left(\frac{-5}{2}\right)^{2}-\left(\frac{-5}{2}\right)^{2} \right]\quad\textrm{group terms}\\
& = 2\left[ x^{2}-5x+\left(\frac{-5}{2}\right)^{2}+1-\left(\frac{-5}{2}\right)^{2} \right]\\
& = 2\left[ x^{2}-5x+\left(\frac{25}{4}\right)+1-\frac{25}{4}\right]\quad\textrm{factorise quadratic using perfect squares}\\
& = 2\left[ \left(x-\frac{5}{2}\right)^{2}-\frac{21}{4}\right]\quad\textrm{take square root of \(\frac{21}{4}\) and square it}\\
& = 2\left[ \left(x-\frac{5}{2}\right)^{2}-\left(\frac{\sqrt{21}}{2}\right)^{2}\right]\quad\textrm{use DOTS and take square root of both sides}\\
& = 2 \left(x-\frac{5}{2}+\frac{\sqrt{21}}{2}\right)\left(x-\frac{5}{2}-\frac{\sqrt{21}}{2}\right)
\end{align*}\]

Your turn – completing the square when \(a\neq1\)

  1. Factorise by completing the square.
    1. \(4x^{2}+8x-20\)
    2. \(x^{2}-6x+2\)
    3. \(12-4x-2x^{2}\)

    1. \(4(x+1+\sqrt{6})(x+1-\sqrt{6})\)
    2. \((x-3+\sqrt{7})(x-3-\sqrt{7})\)
    3. \(-2(x+1+\sqrt{7})(x+1-\sqrt{7})\)

Further resources

Surds

Use this resource if you need a refresher on how to simplify surds.

Factorisation

Use this resource if you need a refresher on how to identify common factors.

Quadratic factorisation

Use this resource if you need a refresher on how to factorise quadratic expressions using common factors.

Difference of two squares

Use this resource if you need a refresher on the difference of two squares (DOTS) rule.