Factoring is an easy and satisfying way to solve a quadratic equation. Problem is not all quadratics can be factored. In fact only a small number of them can. To be exact, only quadratic equations with rational roots can be factored by traditional means.
Completing the square allows you to get around this problem. The basic idea is to take any quadratic equation and force it into a perfect square factor-able state. Math is very violent sometimes...
So now that you know the why and the idea behind the how, lets see how its done.
First thing before solving any quadratic is to make sure it's in the correct form for using a given technique. Factoring and using the quadratic equation want the equation in standard form:
$$ax^2 + bx + c = 0$$
With completing the square you end up isolating $x$ on the left hand side and putting your equation on the right. So you start out moving $c$ to the right side of the equals sign like so:
$$ax^2 + bx = -c$$
The next step is you divide each term by $a$ to get the equation into a monic form. This means that the coefficient of the the $x^2$ term is one. $$ x^2 + \frac{b}{a}x = \frac{-c}{a} $$
Next thing you want to do is take the value of \(\frac{b}{a}\) divide it by $2$ then square it all. Then add that to both sides of the equation. This is the real magic in completing the square. In any perfect square, the constant term we are adding to both sides has to be $(\frac{b}{2})^2$. This is what makes the perfect square work. $$ x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} = \frac{-c}{a} + \frac{b^2}{4a^2} $$
Here is an image to help you understand what we just did to the left side to complete the square
Let's get the right side of the equals sign simplified by using a common denominator to add the two fractions. We do this by multiplying \(\frac{-c}{a}\) by \(\frac{4a}{4a}\) $$ \bigg( \frac{-c}{a} \times \frac{4a}{4a} \bigg) + \frac{b^2}{4a^2} = \frac{-4ac + b^2}{4a^2} $$
So now we have: $$ x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} = \frac{-4ac + b^2}{4a^2} $$
Now to simplify the the left side the same way: $$ \bigg( \frac{x^2}{1} \times \frac{4a^2}{4a^2} \bigg) + \bigg( \frac{b}{a}x \times \frac{4a}{4a} \bigg) + \frac{b^2}{4a^2} = \frac{4a^2x^2 + 4abx + b^2}{ 4a^2} $$
Leaving us with: $$ \frac{4a^2x^2 + 4abx + b^2}{ 4a^2} = \frac{-4ac + b^2}{4a^2} $$
Now we can multiply both sides by $4a^2$ to get rid of the denominator. $$ {4a^2} \times \frac{4a^2x^2 + 4abx + b^2}{ 4a^2} = \frac{-4ac + b^2}{4a^2} \times 4a^2 $$ Now we have: $$ 4a^2x^2 + 4abx + b^2 = -4ac + b^2 $$ Ok, we are getting close. Now we can factor the left side as we have completed the square, so the left side is now a perfect square. $$ \begin{align*} (2ax+b)(2ax+b) &= -4ac + b^2 \\ (2ax+b)^2 &= -4ac + b^2 \end{align*} $$
Now lets take the square root of both sides: $$ \begin{align*} \sqrt{(2ax+b)^2} &= \pm \sqrt{-4ac + b^2}\\ 2ax+b &= \pm \sqrt{-4ac + b^2} \end{align*} $$
Now to finish isolating $x$ we will subtract $b$ from both sides and divide by $2a$ $$ \begin{align*} 2ax &= -b \pm \sqrt{-4ac + b^2}\\ \\ x &= \frac{-b \pm \sqrt{-4ac + b^2}}{2a} \end{align*} $$
We're done! What's that you say? YES, it is the quadratic formula! The quadratic formula is derived by completing the square! Sometimes it's easier to just use the quadratic formula outright, other times you might prefer to complete the square.
Let's try an example of completing the square. We will use the same equation we used in the last post: $x^2 - 4x - 12 = 0$. You will notice that this one can be factored 'normally', but we will use completing the square anyway. This example is already a monic equation so no need to divide all terms by $a$. $$ \begin{align*} x^2 - 4x - 12 &= 0\\ \\ x^2 - 4x &= 12 \\ \\ x^2 - 4x + 4 &= 16 \\ \\ (x - 2)(x - 2) &= 16\\ \\ (x - 2)^2 &= 16\\ \\ \sqrt{(x-2)^2} &= \pm \sqrt{16}\\ \\ x-2 &= \pm 4\\ \\ x &= 2 \pm 4\\ \\ x &= 6 \; or \; x = -2 \end{align*} $$
There you have it. You now know, if you didn't already, how to complete the square. You also saw how the quadratic equation is derived. I hope this has been informative. Please leave a comment if you have any questions or suggestions. Thanks.