In algebra, **completing the square** is a mathematical method demonstrated by a man named al-Khwarzimi (780–850), who published a book that gave algebra its very name.

Suppose you were given the following mathematical expression: *x*^{2} + 16*x*. You have been asked to complete the square of this expression. How do you do that?

Here's how it's done:

1. Take the original expression...

$ x^2 + 16x $

2. Factor out the *x*...

$ (x + 8)^2 $

3. Square the constant term (the term with no variable)...

$ 8^2 = 64 $

(or $ 8 * 8 = 64 $)

4. And apply it to the original expression. **All squared terms remain positive when completing the square of an expression.**

$ x^2 + 16x + 64 $

Congratulations! You've completed the square!

## When There's a CoefficientEdit

When coefficients are involved, the only major difference is the inclusion of one step: dividing the entire expression by that coefficient.

For instance, let's say you were given the following expression: 4*x*^{2} - 16*x*.

It's very easy, you know. All you have to do is divide the entire expression by 4.

$ 4x^2 - 16x $ becomes $ x^2 - 4x $.

Then, it's all downhill from here. Complete the square by following the steps above, and your answer should come up as this:

$ x^2 - 4x + 4 $

## When the Linear Term Is An Odd NumberEdit

Suppose you were given the expression *x*^{2} + 7*x*. Here's what you do when the linear term is an odd number:

1. Factor out the *x* and put 7 over 2...

From $ x^2 + 7x $ to $ (x + \frac{7}{2}\,)^2 $...

2. Square the fraction (there's an easy way)...

$ (\frac{7}{2}\,)^2 = \frac{7 * 7}{2 * 2}\, = \frac{49}{4}\, $

3. And apply it to the expression. If you want to, you can simplify the improper fraction into a mixed number or decimal.

$ x^2 + 7x + \frac{49}{4}\, $, which is also $ x^2 + 7x + 12\frac{1}{4}\, $ or $ x^2 + 7x + 12.25 $

There you have it!

## Completing the Square to Solve Quadratic EquationsEdit

Al-Khwarzimi showed how to solve quadratic equations by finding the square by:

1. Rewriting the original problem...

$ x^2 - 6x - 5 = 0 $

2. Moving the variables to different sides...

$ -5 = -x^2 + 6x $

3. Factoring the quadratic and linear terms to complete the square...

$ 5 + 9 = x^2 - 6x + 9 $

$ 14 = (x - 3)^2 $

4. Taking the square roots of both sides...

$ \pm \sqrt{14}\, = x - 3 $

5. And, finally, simplifying the whole thing.

$ 3 \pm \sqrt{14}\, = x $

This is a little trickier, though it's easy once you get used to it.

## Now, Try This!Edit

Complete the square to solve for *x*. Leave the answer in simplest radical form.

$ 4x^2 + 4 = 32x + 8 $