Quadratic expressions have the general form \[ax^2+bx+c\] where \(a\), \(b\) and \(c\) are real numbers and \(a\neq 0\). Quadratics frequently arise in mathematics, science and engineering. Let's factorise a quadratic into two linear factors using the "completing the square" method. This is a general method that allows any quadratic to be factorised. For example \[x^2+8x-5 = \left(x+4-\sqrt{21}\right)\left(x+4+\sqrt{21}\right).\]
A perfect square is of the form: \[\begin{align*} \left(x+b\right)^{2} & =x^{2}+2bx+b^{2}. & \left(1\right) \end{align*}\] or \[\begin{align*} \left(x-b\right)^{2} & =x^{2}-2bx+b^{2}. & \left(2\right) \end{align*}\]
Consider, the expression \[\begin{align*} x^{2}+2bx. \end{align*}\] To make this a perfect square, according to eqn \(\left(1\right),\) you have to add \(b^{2}\). But if you add \(b^{2}\) you must also take it away to preserve equality. That is, given \(x^{2}+2bx\) we can write: \[\begin{align*} x^{2}+2bx & =x^{2}+2bx+b^{2}-b^{2}. & \left(3\right) \end{align*}\]
Note that the amount we added and subtracted is one half of the \(x\) coefficient squared. That is,
If you look at the right hand side of eqn \(\left(3\right)\)we have added \(b^{2}-b^{2}=0\) so the value is unchanged. However we can now group the terms to get:
\[\begin{align*} x^{2}+2bx & =\left(x^{2}+2bx+b^{2}\right)-b^{2}. \end{align*}\] Using eqn \(\left(1\right)\) above the term in brackets on the right hand side is \(\left(x+b\right)^{2}\)and so using the difference of two squares formula (DOTS) 1 The difference of two squares formula states that \[\begin{align*} a^{2}-b^{2} & =\left(a+b\right)\left(a-b\right)\\ & =\left(a-b\right)\left(a+b\right). \end{align*}\] Note that the order of the factors on the right hand side does not matter. \[\begin{align*} x^{2}+2bx & =\left(x+b\right)^{2}-b^{2}\\ & =\left(x+b-b\right)\left(x+b+b\right)\\ & =x\left(x+2b\right). \end{align*}\]
At first this might seem like a lot of work for very little gain. After all, it is pretty obvious that \[\begin{align*} x^{2}+2bx & =x\left(x+2b\right). \end{align*}\]
Completing the square
The advantage of completing the square comes in when we have to factorise something like \(x^{2}+2bx+c\) where \(c\) is a real number. In order to do this we follow the above procedure and the results are magical! The following examples illustrate this.
Example 1
Factorise \(x^{2}+8x-5\) by completing the square.
Solution
We take half of the \(x\) coefficient and square it. We then add and subtract it from the right hand side to get \[\begin{align*} x^{2}+8x-5 & =x^{2}+8x-5+\left(\frac{8}{2}\right)^{2}-\left(\frac{8}{2}\right)^{2}\quad\text{(add the square of half the $x\text{ coefficient and subtract it)}$ }\\ & =x^{2}+8x-5+\left(4\right)^{2}-\left(4\right)^{2}\\ & =x^{2}+8x+\left(4\right)^{2}-5-\left(4\right)^{2}\ (\text{regroup the terms on the RHS)}\\ & =\left(x^{2}+8x+\left(4\right)^{2}\right)-5-16\\ & =\left(x+4\right)^{2}-21\ \text{using eqn $\left(1\right)$ }\\ & =\left(x+4\right)^{2}-\left(\sqrt{21}\right)^{2}\\ & =\left(x+4-\sqrt{21}\right)\left(x+4+\sqrt{21}\right) \end{align*}\] where, in the last line, we used the DOTS rule.
Example 2
Factorise \(x^{2}-6x-4\) by completing the square.
Solution
We take half of the \(x\) coefficient and square it. We then add and subtract this from the right hand side to get \[\begin{align*} x^{2}-6x-4 & =x^{2}-6x-4+\left(-3\right)^{2}-\left(-3\right)^{2}\\ & =x^{2}-6x-4+9-9\\ & =x^{2}-6x+9-4-9\\ & =\left(x-3\right)^{2}-13\ \text{using eqn $\left(2\right)$ }\\ & =\left(x-3\right)^{2}-\left(\sqrt{13}\right)^{2}\\ & =\left(x-3+\sqrt{13}\right)\left(x-3-\sqrt{13}\right)\ \text{using DOTS rule.} \end{align*}\]
Example 3
Factorise \(x^{2}+5x+9\) by completing the square.
Solution
We take half of the \(x\) coefficient and square it. We then add and subtract this from the right hand side to get \[\begin{align*} x^{2}+5x+9 & =x^{2}+5x+9+\left(\frac{5}{2}\right)^{2}-\left(\frac{5}{2}\right)^{2}\\ & =x^{2}+5x+\left(\frac{5}{2}\right)^{2}+9-\left(\frac{5}{2}\right)^{2}\\ & =\left(x+\frac{5}{2}\right)^{2}+9-\frac{25}{4}\ \text{using eqn $\left(1\right)$ }\\ & =\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 in this module.2 Geometrically this means that the graph of \(x^{2}+5x+9\) does not intersect the \(x-\) axis. The graph is shown below
See Exercise 1 below.
Completing the square when the coefficient of \(x^{2}\) is not one
In this section we consider the completing the square method on quadratics of the form \(ax^{2}+bx+c\) where \(a\neq1.\) In this case we simply divide the quadratic by \(a\) and proceed as above. That is we write
\[\begin{align*} ax^{2}+bx+c & =a\left[x^{2}+\frac{b}{a}x+\frac{c}{a}\right] \end{align*}\] and complete the square on the RHS term in the square brackets. Don’t forget to include the \(a\) in the final result!
Example 4
Factorise \(2x^{2}-10x+2\).
Solution
Divide the quadratic by \(2\) and write \[\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*}\] Now complete the square on the quadratic in square brackets on the RHS, \[\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\text{(add the square of half the $x\text{ coefficient and subtract it)}$ }\\ & =2\left[x^{2}-5x+1+\frac{25}{4}-\frac{25}{4}\right]\\ & =2\left[x^{2}-5x+\frac{25}{4}+1-\frac{25}{4}\right]\ (\text{regrouping the terms on the RHS)}\\ & =2\left[\left(x-\frac{5}{2}\right)^{2}+1-\frac{25}{4}\right]\ \text{using eqn $\left(1\right)$ }\\ & =2\left[\left(x-\frac{5}{2}\right)^{2}-\frac{21}{4}\right]\\ & =2\left[\left(x-\frac{5}{2}\right)^{2}-\left(\frac{\sqrt{21}}{2}\right)^{2}\right]\\ & =2\left[\left(x-\frac{5}{2}+\frac{\sqrt{21}}{2}\right)\left(x-\frac{5}{2}-\frac{\sqrt{21}}{2}\right)\right]\ \text{using DOTS rule}\\ & =2\left(x-\frac{5}{2}+\frac{\sqrt{21}}{2}\right)\left(x-\frac{5}{2}-\frac{\sqrt{21}}{2}\right). \end{align*}\]
See Exercise 2 below.
Completing the square and the quadratic formula
This section is beyond the intent of this module and may be skipped if you are not interested.
You may be aware of the quadratic formula. It gives the solutions of the quadratic equation: \[\begin{align*} ax^{2}+bx+c & =0 & \left(4\right) \end{align*}\] and is usually written as \[\begin{align*} x & =\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}. \end{align*}\] The quadratic formula is established by completing the square on eqn \(\left(4\right)\). To see this, we write \[\begin{align*} 0 & =ax^{2}+bx+c\\ & =x^{2}+\frac{b}{a}x+\frac{c}{a}\ \text{assuming $a\neq0$ }\\ & =x^{2}+\frac{b}{a}x+\frac{c}{a}+\left(\frac{b}{2a}\right)^{2}-\left(\frac{b}{2a}\right)^{2}\\ & =x^{2}+\frac{b}{a}x+\left(\frac{b}{2a}\right)^{2}+\frac{c}{a}-\left(\frac{b}{2a}\right)^{2}\ (\text{regrouping the terms on the RHS)}\\ & =\left(x+\frac{b}{2a}\right)^{2}+\frac{c}{a}-\left(\frac{b}{2a}\right)^{2}\ \text{using eqn $\left(1\right)$ }\\ & =\left(x+\frac{b}{2a}\right)^{2}+\frac{c}{a}-\frac{b^{2}}{4a^{2}}\\ & =\left(x+\frac{b}{2a}\right)^{2}+\frac{4ac-b^{2}}{4a^{2}}\\ \left(x+\frac{b}{2a}\right)^{2} & =-\left(\frac{4ac-b^{2}}{4a^{2}}\right)\\ & =\frac{b^{2}-4ac}{4a^{2}}\\ x+\frac{b}{2a} & =\pm\sqrt{\frac{b^{2}-4ac}{4a^{2}}}\\ & =\pm\frac{\sqrt{b^{2}-4ac}}{2a}\\ x & =-\frac{b}{2a}\pm\frac{\sqrt{b^{2}-4ac}}{2a}\\ & =\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}\,, \end{align*}\] and so establishes the quadratic formula.
\(\text{c)$\,\left(a-4+3\sqrt{2}\right)\left(a-4-3\sqrt{2}\right)$ $\qquad\text{d) No real factors}$ }\)
\(\text{e)$\,\left(x-\frac{5}{2}+\frac{\sqrt{5}}{2}\right)\left(x-\frac{5}{2}-\frac{\sqrt{5}}{2}\right)\qquad\text{f)$\,\text{No real factors.}$ }$ }\)