# Completing the Square

I've had a lot of math since the idea of completing the square was first introduced to me, and while comparatively a simple matter, I've always found it a difficult concept to grasp and a difficult process to recall. It turns out that the algebraic process is rooted in geometry.

Completing the Square

Completing the square is the process of converting a quadratic equation of the form

$ax^2 + bx + c = 0$

to the (easier to solve) form

$a(x + d)^2 + e = 0$

where $$d = \frac{b}{2a}$$, and $$e = c - \frac{b^2}{4a}$$.

The purpose of this post is to intuitively explain where the values of $$d$$ and $$e$$ come from.

Suppose we have $$x^2 + 10x = 39$$. We want to find $$x$$, but our equation doesn't factor easily, and we can't really move things around to make it easier to work with. We need to do something else.

Before we get to solving it, let's look at how we might represent $$x^2$$ geometrically. For the hell of it let's represent $$x^2$$ as a square with dimensions $$x$$ by $$x$$. We'll display the dimensions next to their corresponding sides for clarity.

 $$x$$ $$x$$ $$x^2$$

Similarly, let's represent $$10x$$ as a rectangle with dimensions $$10$$ by $$x$$.

 $$x$$ $$10$$ $$10x$$

Note that this $$10x$$ rectangle is equivalent with two $$5$$ by $$x$$ rectangles. Splitting this rectangle into two pieces is a frivolously contrived ingenious move that will allow us to do what's called completing the square.

 $$x$$ $$10$$ $$10x$$
 $$=$$
 $$x$$ $$5$$ $$5x$$
 $$+$$
 $$x$$ $$5$$ $$5x$$

Using this, let's represent $$x^2 + 10x = 39$$ geometrically by attaching the corresponding rectangles to each other. We lay the left hand side out in this manner for the hell of it, totally not knowing that doing so is a key maneuver for what's next.

 $$x$$ $$5$$ $$x$$ $$x^2$$ $$5x$$ $$5$$ $$5x$$
 $$=$$
 $$39$$

This ugly representation of our equation tantalizingly suggests our next step. Let's complete the square by adding the missing part of the square on the left. It feels natural, right? From the dimensions displayed on the outside edge of our rectangles we know the size of the missing square to be $$5$$ by $$5$$, or $$25$$.

 $$x$$ $$5$$ $$x$$ $$x^2$$ $$5x$$ $$5$$ $$5x$$ $$25$$
 $$=$$
 $$39$$
 $$+$$
 $$25$$

The square we've just created has dimensions of $$(x+5)$$ by $$(x+5)$$, and we know its area to be $$39+25$$, or $$64$$. We can therefore set up the equation $$(x+5)^2 = 64$$ as an algebraic representation of our squares.

 $$x+5$$ $$x+5$$ $$=$$ $$64$$

We can use this much easier to solve equation to find $$x$$.

$(x+5)^2 = 64$

Taking the square root of both sides, and being sophisticated students of mathematics we realize that both positive and negative $$8$$ will satisfy $$\sqrt{64}$$. This gives us

$(x+5)=\pm8$

which can be trivially solved to get $$x=3$$ and $$x=-13$$.

Now of course we could have used our old friend, the quadratic formula, which would have spat our solutions right out in our faces. This probably would have been much easier, but then we wouldn't have had to (gasp) think about the solution.

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