Completing the Square and the Quadratic Formula

As always, read math with a pencil!

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


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:


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

x-1 = 0 x-5 = 0

So the solutions are


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:

x2-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 x2-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+(3) or x-3. Square that: (x-3)2=x2-6x+9. Because of how we picked the 3, when we square x-3 we get the original left side of the equation, x2-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:

x2-6x+9=5+9 (2)

Now we solve that:

x2-6x+9 = 5+9 x2-6x+9 = 4 (x-3)2 = 22 x-3 = ±2 x = 3±2 x = 1,5

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:

10x2-60x+50 = 0 10x2-60x+5010 = 010 x2-6x+5 = 0

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:

x2+3x+3 = 0 x2+3x = 3 x2+3x+94 = 943 (x+32)2 = 34 x+32 = ±34 x = 32±34 = 32±34 = 32±32 = 32±32i

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


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

ax2+bx+c = 0 ax2+bx+ca = 0a x2+bax+ca = 0 x2+bax = ca x2+bax+(b2a)2 = (b2a)2-ca(3) x2+bax+b24a2 = b24a2-ca x2+bax+b24a2 = b24a2-4ac4a2 x2+bax+b24a2 = b2-4ac4a2 (x+b2a)2 = b2-4ac4a2(4) x+b2a = ±b2-4ac4a2(5) x+b2a = ±b2-4ac4a2 x+b2a = ±b2-4ac2a x = b2a±b2-4ac2a x = b±b2-4ac2a(6)

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, x2-6x+5=0:

x = (6)±(6)2-41521 = 6±162 = 6±42 = 3±2 = 1,5

A few notes:

  1. The part of the quadratic formula under the square root sign, b2-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


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


    Written this way, it's very easy to see that b2a is halfway between the zeros (if they exist), evidence that it really is the x-coordinate of the axis of symmetry.