Completing the Square and the Quadratic Formula

 by Jon Dreyer

As always, read math with a pencil!

Let's say you want to solve a quadratic equation:

${x}^{2}-6x+5=0$

Usually if one side of a quadratic equation is easily factored, as this one is, and the other side is zero, factoring is the easiest method to solve the equation. In thise case we rewrite it like this:

$\left(x-1\right)\left(x-5\right)=0$

Then it's easy to solve. Because zero is special, solutions to either of these linear equations are solutions to the quadratic:

$\begin{array}{rcl}x-1& =& 0\\ x-5& =& 0\end{array}$

So the solutions are

$x=1,5$

But some equations are difficult or impossible to factor. How else can we solve quadratic equations we can't factor?

One method is completing the square. We will try this on the same equation. To do this, the first thing is to push the constant term to the other side of the equation by subtracting 5 from both sides:

 ${x}^{2}-6x=-5$ (1)

Notice that this is different from factoring, when we try to get zero on one side of the equation.

Now it's time to start wishing. Wouldn't it be nice if ${x}^{2}-6x$ were a perfect square? Then we could take the square root of both sides and be done. Ok, so it's not a perfect square, but could we make it into one? What would it take? It turns out this is surprisingly easy, since (unlike when factoring) we don't care if one side of the equation is zero. Notice the coefficient of the linear term, in this case $-6$. Take half of that: $-3$. Now add that to $x$, giving $x+\left(-3\right)$ or $x-3$. Square that: ${\left(x-3\right)}^{2}={x}^{2}-6x+9$. Because of how we picked the $-3$, when we square $x-3$ we get the original left side of the equation, ${x}^{2}-6x$, plus that annoying $9$. But it's not that annoying since we can just add the same $9$ to the other side, yielding an equivalent equation:

 ${x}^{2}-6x+9=-5+9$ (2)

Now we solve that:

$\begin{array}{rcl}{x}^{2}-6x+9& =& -5+9\\ {x}^{2}-6x+9& =& 4\\ {\left(x-3\right)}^{2}& =& {2}^{2}\\ x-3& =& ±2\\ x& =& 3±2\\ x& =& 1,5\end{array}$

Notice that these are the same solutions we got by factoring, but the advantage of this method is that it always works, while factoring doesn't.

If the coefficient $a$ is not 1, it may be simplest first to divide both sides of the equation by $a$ and proceed as above:

$\begin{array}{rcl}10{x}^{2}-60x+50& =& 0\\ \frac{10{x}^{2}-60x+50}{10}& =& \frac{0}{10}\\ {x}^{2}-6x+5& =& 0\\ & \dots & \end{array}$

Then we can proceed as above.

Most quadratic equations don't have pretty solutions like the above. They often involve irrational and complex solutions. For example:

$\begin{array}{rcl}{x}^{2}+3x+3& =& 0\\ {x}^{2}+3x& =& -3\\ {x}^{2}+3x+\frac{9}{4}& =& \frac{9}{4}-3\\ {\left(x+\frac{3}{2}\right)}^{2}& =& -\frac{3}{4}\\ x+\frac{3}{2}& =& ±\sqrt{-\frac{3}{4}}\\ x& =& -\frac{3}{2}±\sqrt{-\frac{3}{4}}\\ & =& -\frac{3}{2}±\frac{\sqrt{-3}}{\sqrt{4}}\\ & =& -\frac{3}{2}±\frac{\sqrt{-3}}{2}\\ & =& -\frac{3}{2}±\frac{\sqrt{3}}{2}i\end{array}$

Since this method is so mechanical, we can use it to solve the generic standard-form quadratic equation,

$a{x}^{2}+bx+c=0$

Here's how. It's messy, so get ready with your pencil:

$\begin{array}{rcl}a{x}^{2}+bx+c& =& 0\\ \frac{a{x}^{2}+bx+c}{a}& =& \frac{0}{a}\\ {x}^{2}+\frac{b}{a}x+\frac{c}{a}& =& 0\\ {x}^{2}+\frac{b}{a}x& =& -\frac{c}{a}\\ {x}^{2}+\frac{b}{a}x+{\left(\frac{b}{2a}\right)}^{2}& =& {\left(\frac{b}{2a}\right)}^{2}-\frac{c}{a}\text{(3)}\\ {x}^{2}+\frac{b}{a}x+\frac{{b}^{2}}{4{a}^{2}}& =& \frac{{b}^{2}}{4{a}^{2}}-\frac{c}{a}\\ {x}^{2}+\frac{b}{a}x+\frac{{b}^{2}}{4{a}^{2}}& =& \frac{{b}^{2}}{4{a}^{2}}-\frac{4ac}{4{a}^{2}}\\ {x}^{2}+\frac{b}{a}x+\frac{{b}^{2}}{4{a}^{2}}& =& \frac{{b}^{2}-4ac}{4{a}^{2}}\\ {\left(x+\frac{b}{2a}\right)}^{2}& =& \frac{{b}^{2}-4ac}{4{a}^{2}}\text{(4)}\\ x+\frac{b}{2a}& =& ±\sqrt{\frac{{b}^{2}-4ac}{4{a}^{2}}}\text{(5)}\\ x+\frac{b}{2a}& =& ±\frac{\sqrt{{b}^{2}-4ac}}{\sqrt{4{a}^{2}}}\\ x+\frac{b}{2a}& =& ±\frac{\sqrt{{b}^{2}-4ac}}{2a}\\ x& =& -\frac{b}{2a}±\frac{\sqrt{{b}^{2}-4ac}}{2a}\\ x& =& \frac{-b±\sqrt{{b}^{2}-4ac}}{2a}\text{(6)}\end{array}$

Equation (6) should look familiar! It is the quadratic formula, and now you see where it comes from. It is nothing more than prepackaging of the technique of completing the square.

A few notes about the procedure. Equation (3) is where we actually complete the square. Equation (4) is where we actually write the completed square as a square. Equation (5) is where we take square roots of both sides, being careful to use $±$ because otherwise we lose a correct solution.

Just for completeness, let's use the quadratic formula to solve the original equation, ${x}^{2}-6x+5=0$:

$\begin{array}{rcl}x& =& \frac{-\left(-6\right)±\sqrt{{\left(-6\right)}^{2}-4\cdot 1\cdot 5}}{2\cdot 1}\\ & =& \frac{6±\sqrt{16}}{2}\\ & =& \frac{6±4}{2}\\ & =& 3±2\\ & =& 1,5\end{array}$

A few notes:

1. The part of the quadratic formula under the square root sign, ${b}^{2}-4ac$, is called the discriminant. If the discriminant is positive, the square root is real so the equation must have two real roots. If the discriminant is negative, the square root is imaginary so the equation must have two complex, non-real roots. If the discriminant is zero, there is only one root. You do not need to memorize these facts, just understand why they must be true.
2. You may remember that the axis of symmetry of a quadratic function in standard form is the line

$x=-\frac{b}{2a}$

Where does that come from? One way to see it is to note that the quadratic formula can also be written this way:

$x=-\frac{b}{2a}±\frac{\sqrt{{b}^{2}-4ac}}{2a}$

Written this way, it's very easy to see that $-\frac{b}{2a}$ is halfway between the zeros (if they exist), evidence that it really is the $x$-coordinate of the axis of symmetry.