Completing the Square

When I was about 5 or 6 years old, my Grandpa taught me about square numbers, and helped me memorize several of them: "2 squared is 4," "5 squared is 25," "9 squared is 81," and so on. I hadn't learned multiplication yet, though. So without counting one by one, I had no idea how many items there were in a 6x7 array, but if it was a 6x6 or 7x7 group I knew exactly how many there were.

pennies formed into a 4x4 square with 6 leftover pennies on the side.

As a result, I remember sitting on the floor arranging coins into squares so that I could count them. If I formed the largest square that I could, then I could know quickly how many were in that group, and then I'd only have to count one-by-one for the ones that didn't fit in that square. For example, if I had 22 pennies, I could make a 4x4 square to count 16 of them, and then I could count the extra 6 pennies to get from 16 to 22.

In Algebra, we sometimes need to be able to express a quadratic polynomial in a format similar to what I did with my pennies: writing it in terms of perfect squares with some extra bits left over. This format can be helpful for graphing the polynomial, and it can also be used to solve quadratic equations, particularly ones that aren't able to be factored. The process of getting the expression into that format is called "completing the square."

For example, if we complete the square on $7x^2 + 42x + 79$, we can rewrite it as $7(x+3)² + 16$. Getting a quadratic into this format can be tricky because, like we did with factoring, we have to take one of the terms and split it up in a very specific way. This time, however, it's the last term (i.e. the one with no x's on it) that is getting split up, rather than the middle one. In the case of 7x^2 + 42x + 79, the 79 is the one that got split, becoming 63+16. This then allowed the 7x^2 + 42x + 63 portion to turn into 7(x+3)².

So how do we know how to split it up? How did we know that 79 needed to be 63+16, and not something else, like 54+25 or -12+91? As with factoring, the key lies in looking at the other terms in the expression to figure out which numbers will make it work out the way we want it to.

When we're completing a square, the goal is to take a quadratic in standard format ($ax²+bx+c$)and turn it into $a(x+h)²+k$ format. To help us figure out how to do that, let's first work backwards and see how $a(x+h)²+k$ can turn into standard format.

Remember that squaring something means multiplying it by itself, so $(x+h)²$ really means $(x+h)(x+h)$. So if we multiply it all out, $a(x+h)²+k$ ends up being  $ax²+2ahx+ah²+k$. So if we want to work our way back from ax²+bx+c format, we have to split up the c term into ah²+k. The a in there is already clearly defined by the ax² term, and the h can be found from the fact that the bx term is really 2ahx. If b=2ah, then that means h is b/2a. Finally, since c is ah² +k, that means k is c-ah².

Whoa, Math Sister, that's a lot of letters! Can you show an example with actual numbers? Of course!

Suppose we want to complete the square on the expression 5x²-40x+36. We know the 36 needs to split up into two separate terms, and everything else going to get rearranged to be part of the squared portion. So first, we'll use parentheses to put the first two terms into a group and leave the 36 on its own: (5x²-40x)+36. Next, we'll factor out a 5 from the parentheses: 5(x²-8x)+36.

Now we need to figure out how to split up the 36. Here's the tricky bit: since the goal is to have a perfect square plus some extra, we need to split 36 in a way where we can put a number in the parentheses to make the entire group be a perfect square. Let's use a blank space for that number: we want to find _ so that (x²-8x+__) is a perfect square. Now, since __ is being added inside the parentheses, it's affected by the 5 that's multiplied on the outside, so what we really have is 5 times __. That means 36 is being split up into 5__ and something else, so the "something else" has to be 36 minus the 5__. So our entire expression now looks like this: 5(x²-8x+__)+36-5__.

(If that's confusing, you can think about it another way: we've taken 5(x²-8x)+36 and added in +5__ -5__, which is really just adding zero in a sneaky, roundabout way.)

Now, to find what goes in the blank, we first need to take HALF of the number on the x term in the parentheses - we'll call this number "h". (Make sure to write that number down, we'll need to use it a few times!) In this case, our x term is -8x, so we'll take -8 and divide it by 2 to get h=-4. Now, we take the square of that number, and that's what goes in the blank. In this case, -4 squared is -4×-4, or 16, so the expression becomes 5(x²-8x+16)+36-5(16).

Finally, because we chose a number that would make a perfect square, we can rewrite the parentheses portion in squared form. Using the "h" we found a moment ago, the parentheses become (x+h)². In this particular example, h was -4, so (x²-8x+16) turns into (x-4)². We can also simplify the "leftover" portion: 36-5(16) becomes -44. So for our final answer, the expression has become 5(x-4)²-44.

Ok, that was a lot - let's sum up the steps.

  1. Write your expression in ax²+bx+c form, if it's not already. Add parentheses around ax²+bx, leaving c on the outside.

  2. Factor out a from the parentheses group.

  3. Put in blanks. Add a blank inside the parentheses, and subtract blank times a outside the parentheses.

  4. Find h: take the coefficient of the x term in the parentheses and divide it by 2.

  5. Add on both blanks.

  6. Using h from step 4, rewrite the parentheses as a perfect square: (x+h)².

  7. Simplify the "leftover" portion outside the parentheses.

Now let's try using those steps on another example: 17+3x²+18x.

Step 1: rearrange it to standard form: 3x²+18x+17. Add parentheses: (3x²+18x)+17.

Step 2: factor out a. Factoring out 3 from the parentheses gives us 3(x²+6x)+17.

Step 3: Add in the blanks: 3(x²+6x+__)+17 - 3__.

Step 4: Find h. The x term is 6, so dividing that by 2 gives h=3.

Step 5: Add on the blanks: 3² is 9, so we have 3(x²+6x+9)+17 - 3(9).

Step 6: Rewrite the parentheses as a perfect square: (x²+6x+9) is (x+3)², giving us 3(x+3)²+17 - 3(9)

Step 7: Simplify the "leftovers": 17 - 3(9) is 17 - 27, which is -10. So the final answer is 3(x+3)²-10.

Now it's your turn - try the problems below and let me know your answer in the comments!

Complete the square to convert each of the following expressions to vertex form.

  1. -5x²+70x+18

  2. 12x²-120x+49

  3. 8x²+20x-75 Warning: this one will involve some fractions/decimals!

Previous
Previous

Solving Quadratic Equations

Next
Next

Factoring Quadratics