Completing the Square

Completing the square refers to the process of converting a quadratic polynomial of the form ax2+bx+c\hspace{0.2em} ax^2 + bx + c \hspace{0.2em} to the form a(x+h)2+k\hspace{0.2em} a(x + h)^2 + k \hspace{0.2em}.

For example,

Now, “completing the square” is very helpful when it comes to solving quadratic equations or graphing quadratic polynomials. There are other uses too but we’ll limit ourselves to these two only.

So, let’s see how we can complete the square and use it to our advantage.

Quadratic Polynomials — A Quick Intro

A quadratic polynomial is any polynomial of degree two.

However, in this tutorial (as well as in common usage), the phrase "quadratic polynomial" is used to refer to a second–degree polynomial with only one variable.

The standard form of a quadratic polynomial is ax2+bx+c,a0\hspace{0.2em} ax^2 + bx + c, \hspace{0.4em} a \neq 0 \hspace{0.2em}.

Basically, in the standard form, we have the x2\hspace{0.2em} x^2–term, then the x\hspace{0.2em} x–term, and then the constant term term at the end.

aa \hspace{0.2em} cannot be 0\hspace{0.2em} 0 \hspace{0.2em} because then the second–degree term (x2\hspace{0.2em} x^2–term) would vanish and our polynomial would no longer be a second–degree polynomial.

An example of a quadratic polynomial in its standard form would be 4x29x+2\hspace{0.2em} 4x^2 - 9x + 2 \hspace{0.2em}.

Here a few more examples of quadratic polynomials and how they can be expressed in their standard forms even if they don't appear to be so.

Quadratic Polynomial Standard Form
4x+3x21\hspace{0.2em} -4x + 3x^2 - 1 \hspace{0.2em} 3x24x1\hspace{0.2em} {\color{Red} 3} x^2 {\color{Teal} \hspace{0.2em} - \hspace{0.2em} 4} x {\color{Orchid} \hspace{0.2em} - \hspace{0.2em} 1} \hspace{0.2em}
7x5x2\hspace{0.2em} 7x - 5x^2 \hspace{0.2em} 5x2+7x+0\hspace{0.2em} {\color{Red} -5} x^2 {\color{Teal} \hspace{0.2em} + \hspace{0.2em} 7} x {\color{Orchid} \hspace{0.2em} + \hspace{0.2em} 0} \hspace{0.2em}
2x216\hspace{0.2em} 2x^2 - 16 \hspace{0.2em} 2x2+0x16\hspace{0.2em} {\color{Red} 2} x^2 {\color{Teal} \hspace{0.2em} + \hspace{0.2em} 0} x {\color{Orchid} \hspace{0.2em} - \hspace{0.2em} 16} \hspace{0.2em}

Alright, having covered the basics, in the following section we'll see how the method of completing the square works.

Completing the Square — Method

Depending on whether the leading coefficient is 1\hspace{0.2em} 1 \hspace{0.2em}, our method varies slightly and so we'll look at the two types of polynomials separately.

In a quadratic polynomial, the leading coefficient is the coefficient in the second–degree term (the coefficient of x2\hspace{0.2em} x^2 \hspace{0.2em}).

When the Leading Coefficient Is 1

Example
Complete the square for the quadratic polynomial x22x2\hspace{0.2em} x^2 - 2x - 2 \hspace{0.2em}.

Solution

Step 1.  Make sure the leading coefficient is 1\hspace{0.2em} 1 \hspace{0.2em}. And arrange the terms in the standard order (x2\hspace{0.2em} x^2 \hspace{0.2em} followed by x\hspace{0.2em} x \hspace{0.2em} and then the constant), if they are not already.

It is in our case here, so we can move to the next step.

Remember, if a term's coefficient isn't explicitly mentioned, it is 1\hspace{0.2em} 1 \hspace{0.2em} or 1\hspace{0.2em} -1 \hspace{0.2em} depending on the sign of the term.

Step 2.  Take half of the coefficient of x\hspace{0.2em} x \hspace{0.2em} (or whatever the variable is). Then add and subtract its square from the polynomial.

Here, the coefficient of x\hspace{0.2em} x \hspace{0.2em} is 2\hspace{0.2em} -2 \hspace{0.2em}.

  • Dividing it by 2\hspace{0.2em} 2 \hspace{0.2em} we get 1\hspace{0.2em} {\color{Teal} -1} \hspace{0.2em}. We'll call it h\hspace{0.2em} {\color{Teal} h} \hspace{0.2em}.
  • And then taking the square, we get 1\hspace{0.2em} {\color{Red} 1} \hspace{0.2em}.

So we add and subtract 1\hspace{0.2em} {\color{Red} 1} \hspace{0.2em} from the polynomial.

x22x2=x22x+112x^2 - 2x - 2 \hspace{0.4em} = \hspace{0.4em} x^2 - 2x + {\color{Red} 1} - {\color{Red} 1} - 2

Note — Place the new terms (shown in red) after the x\hspace{0.2em} x–term and before the constant term. That way, the part upto the first new term would be a perfect square.

Step 3.  As I just mentioned, everything upto the first additional term makes a perfect square. Replace it with (x+h)2\hspace{0.2em} (x + {\color{Teal} h} )^2 \hspace{0.2em}. Remember h\hspace{0.2em} {\color{Teal} h} \hspace{0.2em} from the last step?

Also, simplify the rest of the polynomial.

In our case here, h\hspace{0.2em} {\color{Teal} h} \hspace{0.2em} is 1\hspace{0.2em} {\color{Teal} -1} \hspace{0.2em}. That means x+h\hspace{0.2em} x + {\color{Teal} h} \hspace{0.2em} would be x1\hspace{0.2em} x {\color{Teal} \hspace{0.25em} - \hspace{0.25em} 1} \hspace{0.2em}. So,

x22x+112=(x1)212=(x1)23\begin{align*} \underline{x^2 - 2x + {\color{Red} 1} } - {\color{Red} 1} - 2 \hspace{0.25em} &= \hspace{0.25em} \underline{(x {\color{Teal} \hspace{0.25em} - \hspace{0.25em} 1} )^2} - {\color{Red} 1} - 2 \\[1em] &= \hspace{0.25em} (x {\color{Teal} \hspace{0.25em} - \hspace{0.25em} 1} )^2 - 3 \end{align*}

And that’s it. We have succesfully completed the square.

Example
Complete the square for the quadratic polynomial x2+3x\hspace{0.2em} x^2 + 3x \hspace{0.2em}.

Solution

Step 1.  We start by confirming the leading coefficient is 1\hspace{0.2em} 1 \hspace{0.2em}. And that the terms are in the standard order.

All's good, so we can move to the next step.

Step 2.  The coefficient of x\hspace{0.2em} x \hspace{0.2em} is 3\hspace{0.2em} 3 \hspace{0.2em}.

  • Dividing it by 2\hspace{0.2em} 2 \hspace{0.2em} we get 3/2\hspace{0.2em} {\color{Teal} 3/2} \hspace{0.2em}. We'll call it h\hspace{0.2em} {\color{Teal} h} \hspace{0.2em}.
  • And then taking the square, we get 9/4\hspace{0.2em} {\color{Red} 9/4} \hspace{0.2em}.

So we add and subtract 9/4\hspace{0.2em} {\color{Red} 9/4} \hspace{0.2em} from the polynomial.

x2+3x=x2+3x+9494x^2 + 3x \hspace{0.4em} = \hspace{0.4em} x^2 + 3x + {\color{Red} \frac{9}{4}} - {\color{Red} \frac{9}{4}}

Again, we place the new terms after the x\hspace{0.2em} x–term. There was no constant term, so we don't need to worry about that.

Step 3.  The first three terms make a perfect square. We replace them with (x+h)2\hspace{0.2em} (x + {\color{Teal} h} )^2 \hspace{0.2em} or (x+3/2)2\hspace{0.2em} (x {\color{Teal} \hspace{0.25em} + \hspace{0.25em} 3/2} )^2 \hspace{0.2em}.

x2+3x+9494=(x+32)294\underline{x^2 + 3x + {\color{Red} \frac{9}{4}} } - {\color{Red} \frac{9}{4}} \hspace{0.25em} = \hspace{0.25em} \underline{\left ( x {\color{Teal} \hspace{0.25em} + \hspace{0.25em} \frac{3}{2}} \right )^2} - {\color{Red} \frac{9}{4}}

Done.

When the Leading Coefficient Isn't 1

Example
Complete the square for the quadratic polynomial 2x24x1\hspace{0.2em} 2x^2 - 4x - 1 \hspace{0.2em}.

Solution

In the previous examples, the leading coefficient was alread 1\hspace{0.2em} 1 \hspace{0.2em}, so we could skip the first step and go straight to the second.

Step 1.  As shown below, multiply and divide the given polynomial by the leading coefficient so the leading coefficient becomes 1\hspace{0.2em} 1 \hspace{0.2em}.

Here, the leading coefficient is 2\hspace{0.2em} {\color{Orchid} 2} \hspace{0.2em}. So —

2x24x1=2(2x24x12)=2(x22x12)\begin{align*} 2x^2 - 4x - 1 \hspace{0.25em} &= \hspace{0.25em} {\color{Orchid} 2} \left ( \frac{2x^2 - 4x - 1}{ {\color{Orchid} 2} } \right ) \\[1.5em] &= \hspace{0.25em} {\color{Orchid} 2} \left ( x^2 - 2x - \frac{1}{2} \right ) \end{align*}

Note — What we have inside parentheses is a quadratic polynomial with 1\hspace{0.2em} 1 \hspace{0.2em} as the leading coefficient. And we already learned how to complete the square for such polynomials.

So, for steps 2 and 3, we'll ignore the factor outside the parentheses, 2\hspace{0.2em} {\color{Orchid} 2} \hspace{0.2em}.

Step 2.  The coefficient of x\hspace{0.2em} x \hspace{0.2em} is 2\hspace{0.2em} -2 \hspace{0.2em}.

  • Dividing it by 2\hspace{0.2em} 2 \hspace{0.2em} gives us 1\hspace{0.2em} {\color{Teal} -1} \hspace{0.2em}. Again, let's label it h\hspace{0.2em} {\color{Teal} h} \hspace{0.2em}.
  • And then taking the square, we get 1\hspace{0.2em} {\color{Red} 1} \hspace{0.2em}.

So we add and subtract 1\hspace{0.2em} {\color{Red} 1} \hspace{0.2em} from the polynomial.

x22x12=x22x+1112x^2 - 2x - \frac{1}{2} \hspace{0.4em} = \hspace{0.4em} x^2 - 2x + {\color{Red} 1} - {\color{Red} 1} - \frac{1}{2}

Step 3.  Again, the first three terms make a perfect square. We replace them with (x+h)2\hspace{0.2em} (x + {\color{Teal} h} )^2 \hspace{0.2em} or (x1)2\hspace{0.2em} (x {\color{Teal} \hspace{0.25em} - \hspace{0.25em} 1} )^2 \hspace{0.2em}.

x22x+1112=(x1)2112=(x1)232\begin{align*} \underline{x^2 - 2x + {\color{Red} 1} } - {\color{Red} 1} - \frac{1}{2} \hspace{0.25em} &= \hspace{0.25em} \underline{\left ( x {\color{Teal} \hspace{0.25em} - \hspace{0.25em} 1} \right )^2} - {\color{Red} 1} - \frac{1}{2} \\[1.5em] &= \hspace{0.25em} \underline{\left ( x {\color{Teal} \hspace{0.25em} - \hspace{0.25em} 1} \right )^2} - \frac{3}{2} \end{align*}

We're not done yet.

Step 4.  We need to bring back the factor we ignored for the last two steps.

That means our expression becomes —

2((x1)232) {\color{Orchid} 2} \left ( \left ( x {\color{Teal} \hspace{0.25em} - \hspace{0.25em} 1} \right )^2 - \frac{3}{2} \right )

That's it. Once you have become comfortable working with polynomial with leading coefficiients of 1\hspace{0.2em} 1 \hspace{0.2em}, this would be much simpler than it may appear now.

Solve Quadratic Equations by Completing the Square

Here's an example of how we can solve quadratic equations by completing the square.

Example
Using the method of completing the square, solve the quadratic equation 2x24x1\hspace{0.2em} 2x^2 - 4x -1 \hspace{0.2em}.

Complete the Square to Find the Vertex

Example
Complete the square for the quadratic polynomial 2x24x1\hspace{0.2em} 2x^2 - 4x -1 \hspace{0.2em}.

Completing the Square — Visualization