# Completing the Square

## What is Completing the Square?

Completing the square (CTS) is a method for solving quadratic equations in the form $x^2+bx+c=0$

### Something to work up from:

First, we need to look at what happens when we expand a squared bracket with two terms: $(x+d)^2 = (x+d)(x+d) = x^2+2dx+d^2$ The $$2d$$ here is the most important part, we will see why shortly.
For example: $(x+3)^2=(x+3)(x+3)=x^2+6x+9$
For CTS, we do the above process in reverse. Given an equation in the form $$x^2+bx+c=0$$ we have to aim at factorising as above, so $$b=2d$$, and $$\frac{b}{2}=d$$, leaving us thinking that a good starting point might be $\left(x+\frac{b}{2}\right)^2$

### Explaining with example:

Obviously it isn't usually that easy, if it was then we'd just factorise and solve! Let's just see where this path takes us for a few more steps, using the example $x^2+8x+12=0$ We think about factorising this into a single bracket, we know that it would be something like $\left(x+\frac{8}{2}\right)^2=(x+4)^2=x^2+8x+16$ Having done this, the $$x$$ and $$x^2$$ terms are correct! However, comparing the equations we see that we need to subtract $$4$$ from our new expression for it to be equal to the original: \begin{align} x^2+8x+12 &= x^2+8x+(16-4) \\[3pt]&= (x^2+8x+16)-4 \\[8pt]&=(x+4)^2-4 \end{align}
You'll be glad to know that's the hardest step in CTS! Because we know $$x^2+8x+12=0$$, we know that $$(x+4)^2-4=0$$. Solving by rearranging: \begin{align} (x+4)^2-4&=0 \\[3pt](x+4)^2&=4 \\[3pt]x+4&=\pm\sqrt{4} \\[3pt]x+4&=\pm2 \\[3pt]x&=\pm2-4 \\[3pt]x&=-2\hspace{8 pt}\text{or }-6 \end{align}

### Full worked example 1: nice values

\begin{align} x^2+4x-5 &= 0 \\[3pt](x+2)^2 &= x^2+4x+4 \\[3pt]x^2+4x+4-9 &= x^2+4x-5 \\[3pt]x^2+4x+4-9 &= 0 \\[3pt](x+2)^2-9 &= 0 \\[3pt](x+2)^2 &= 9 \\[3pt]x+2 &= \pm\sqrt{9} \\[3pt]x+2 &= \pm3 \\[3pt]x &= \pm3-2 \\[3pt]x &= 1\hspace{8 pt}\text{or }-5 \end{align}

### Full worked example 2: working with fractions

\begin{align} x^2+3x+2 &= 0 \\[8pt] \left(x+\frac{3}{2}\right)^2 &= x^2+3x+\frac{9}{4} \\[8pt] x^2+3x+\frac{9}{4}-\frac{1}{4} &= x^2+3x+2 \\[8pt] x^2+3x+\frac{9}{4}-\frac{1}{4} &= 0 \\[8pt] \left(x+\frac{3}{2}\right)^2-\frac{1}{4} &= 0 \\[8pt] \left(x+\frac{3}{2}\right)^2 &= \frac{1}{4} \\[8pt] x+\frac{3}{2}=\pm\sqrt{\frac{1}{4}} &= \pm\frac{1}{2} \\[8pt] x &= \pm\frac{1}{2}-\frac{3}{2} \\[8pt] x &= -1\hspace{8 pt}\text{or }-2 \end{align}

### Full worked example 3: surd answer, negative $$x$$ coefficient

\begin{align} x^2-4x+2&=0 \\[3pt](x-2)^2&=x^2-4x+4 \\[3pt]x^2-4x+4-2&=x^2-4x+2 \\[3pt]x^2-4x+4-2&=0 \\[3pt](x-2)^2-2&=0 \\[3pt](x-2)^2&=2 \\[3pt]x-2&=\pm\sqrt{2} \\[3pt]x&=2\pm\sqrt{2} \end{align}

### Full worked example 4: no real roots

\begin{align} \\[3pt]x^2+6x+10&=0 \\[3pt](x+3)^2&=x^2+6x+9 \\[3pt]x^2+6x+9+1&=x^2+6x+10 \\[3pt]x^2+6x+9+1&=0 \\[3pt](x+3)^2+1&=0 \\[3pt](x+3)^2&=-1 \\[3pt]x+3&=\pm\sqrt{-1}\end{align} \\[3pt] \text{Cannot root negative number so no real roots} Unless you are doing further maths, if you get an answer in an exam where you're square rooting a negative number then it's likely you've made a mistake! You could check if there should be real roots by using the discriminant $$b^2-4ac$$.

You may notice that in the above examples, the coefficient of $$x^2$$ is $$1$$. In some questions, you may be told to solve an equation where this isn't the case. Here we'd just divide through by the $$x^2$$ coefficient before solving. See example below.

### Full worked example 5: $$x^2$$ coefficient $$\neq1$$

\begin{align} \\[8pt]3x^2+12x+5&=0 \\[8pt]3\left(x^2+4x+\frac{5}{3}\right)&=0 \\[8pt]x^2+4x+\frac{5}{3}&=0 \\[8pt](x+2)^2&=x^2+4x+4 \\[8pt]x^2+4x+4-\frac{7}{3}&=x^2+4x+\frac{5}{3} \\[8pt]x^2+4x+4-\frac{7}{3}&=0 \\[8pt](x+2)^2-\frac{7}{3}&=0 \\[8pt](x+2)^2&=\frac{7}{3} \\[8pt]x+2&=\pm\sqrt{\frac{7}{3}} \\[8pt]x&=\pm\sqrt{\frac{7}{3}}-2 \end{align}