# Completing The Square

**Completing the square** is a technique for manipulating a quadratic into a perfect square plus a constant. The most common use of completing the square is solving quadratic equations.

#### Contents

## Introduction

For a quadratic polynomial \(f(x) = ax^2 + bx +c\), completing the square means finding an expression of the form

\[f(x) = A(x-B)^2 + C.\]

Let's consider the case where \( a = 1 \). For example, for \( x^2 + 2x + 4 \), we have the following:

\[ x^2 + 2x +4 = (x^2 + 2x + 1) + 3 = (x+1)^2 + 3.\]

We find the necessary manipulations to complete the square on the basis of the perfect square identity:

\[ (x+a)^2 = x^2 + 2ax + a^2.\]

This means that for a quadratic like \( x^2 + bx + c \), we can make a perfect square by taking half of \( b\) and squaring it:

\[ \begin{align} x^2 + bx + c &= x^2 + bx + \left(\frac{b}{2}\right)^2 - \left(\frac{b}{2}\right)^2 + c \\ &= \left( x + \frac{b}{2}\right)^2 - \left(\frac{b}{2}\right)^2 +c. \end{align} \]

Complete the square for the quadratic \( x^2 + 8x + 10 \).

Since our middle term is \( 8x \), we know that we will want a perfect square with the form \( (x+4)^2 \), which expands to \( x^2 + 8x + 16 \).

Thus, we can do the following:

\[ \begin{align} x^2 + 8x + 10 &= x^2 + 8x + 16 - 16 + 10\\ &= (x^2 + 8x + 16) - 6 \\ &= ( x+ 4 )^2 -6.\ _\square \end{align} \]

Which of the following is equivalent to \( x^2 + 4x + 7 \)?

A. \(\ (x+2)^2 + 3 \)

B. \(\ (x-2)^2 + 3 \)

C. \(\ (x+3)^2 + 3 \)

D. \(\ (x-3)^2 + 3 \)

Completing the square, we see that \( x^2 + 4x + 7 = (x^2 + 4x + 4) + 3 = (x+2)^2 + 3 \). \( _\square \)

## Generalized Statement

Sometimes the leading coefficient is not 1, which means we must use a slightly more sophisticated approach. Note that we can proceed as follows:

\[\begin{array}{ll} ax^2 + bx + c & \text{} \\ =a\left(x^2 + \frac{b}{a}x\right) + c && (\text{factor out leading coefficient}) \\ =a\left[x^2 + \frac{b}{a}x + \left( \frac{b}{2a}\right)^2 \right] - a\left( \frac{b}{2a} \right)^2 + c && (\text{add the needed term to complete the square}) \\ =a\left(x + \frac{b}{2a} \right)^2 - a\left( \frac{b}{2a} \right)^2 + c && (\text{replace the perfect square term}) \\ =a\left(x + \frac{b}{2a} \right)^2 + \frac{4ac-b^2}{4a}. && (\text{simplify the constant terms}) \end{array}\]

Note: We would strongly recommend understanding the motivation for each step so you can reproduce this, rather than merely memorizing the formula.

Complete the square for the quadratic \( 2x^2 + 20x + 100 \).

The important term we need is \( \left(\frac{b}{2a}\right)^2 = \left(\frac{20}{2\cdot 2}\right)^2 = 25. \)

Thus, we have

\[ \begin{align} 2x^2 + 20x + 100 &= 2(x^2 + 10x) + 100 \\ &= 2(x^2 + 20x + 25) + 100 - 2(25) \\ &= 2(x+5)^2 + 50.\ _\square \end{align} \]

Complete the square for \( -x^2 + 4x + 10 \)

We have

\[ \begin{align} -x^2 + 4x + 10 &= -(x^2 -4x) + 10 \\ &= -(x^2 -4x +4) -(-4) + 10 \\ &= -(x-2)^2 + 14.\ _\square \end{align}\]

Note: When the leading coefficient is negative, be very careful with signs, expecially when adding the \( \left( \frac{b}{2a}\right)^2 \) term.

## Applications

For a more extensive list, see Applications of Completing the Square

Finding maximum or minimum values:

What is the maximum value of \( -x^2 + 4x + 10\)?

From the previous example, \( -x^2 + 4x + 10 = - (x-2)^2 + 14\). Since squares are non-negative,

\[ - (x-2)^2 + 14 \leq 14.\]

Thus, the maximum value of the quadratic is \( 14\), which is achieved at \( x=2\). \(_\square\)

Comparing graphs:

In what ways is the graph of \( f(x)= x^2 - 2x + 4 \) different from the graph of \( g(x) = x^2?\)

Completing the square, we see that

\[ \begin{align} f(x) &= x^2 - 2x + 4 \\ &= x^2 -2x + 1 -1 + 4 \\ &= (x^2 -2x + 1) + 3 \\ &= (x -1) ^2 + 3 \end{align} \]

Thus, the graph will be shifted up 3 units and right 1 unit, as shown below:

Note: You may want to refer to Graph Transformation.

Solving equations:

Solve the equation \( x^2 + x - 10 = 0 \).

This equation appears difficult at first, but if we complete the square, the solution becomes apparent. Note that the needed term is \( \frac{b^2}{4} = \frac{1}{4} \):

\[ \begin{align} x^2 + x - 10 &= 0 \\ x^2 + x + \frac{1}{4} -10 &= \frac{1}{4} \\ x^2 + x + \frac{1}{4} &= 10 + \frac{1}{4} \\ \left(x+\frac{1}{2}\right)^2 &= \frac{41}{4}. \end{align} \]

Now we can simply take the root of both sides (remembering to find both the positive and negative roots) and simplify:

\[ \begin{align} \left(x+\frac{1}{2}\right)^2 &= \frac{41}{4} \\ x + \frac{1}{2} &= \pm \sqrt{\frac{41}{4}} \\ x &= -\frac{1}{2} \pm \frac{\sqrt{41}}{2} \\ x &= \frac{-1 \pm \sqrt{41}}{2}.\ _\square \end{align} \]

## Higher Degree Polynomials

We can use the perfect square identity to simplify polynomials even if they are of higher-degree than quadratics.

## Solve \( x^4 + 4x^2 -12 = 0 \).

By letting \( u = x^2 \) we can see that this is a quadratic in \( u\) and thus we can complete the square:

\[ \begin{align} u^2 + 4u - 12 &= 0 \\ u^2 + 4u + 4 - 16 &= 0 \\ (u+2)^2 - 16 &= 0. \end{align}\]

Treating the above as a difference of two squares, we have

\[ \begin{align} (u+2)^2 - 16 &= 0 \\ (u+2 - 4)(u+2+4) &= 0 \\ (u-2)(u+6) &= 0. \end{align}\]

Remembering that \( u = x^2 \), we have either \( x^2 = 2 \) or \( x^2 = -6 \). Thus the possible values of \( x \) are \( \sqrt{2}, -\sqrt{2}, i\sqrt{6}, -i\sqrt{6} \). \(_\square\)

## Problem Solving

For what integer value \( n\) is \( n^2 + 6n + 10\) a perfect square?

Completing the square, we see that \(n^2 + 6n + 10 = (n+3)^2 +1\).

If \( n^2 + 6n + 10 = m^2\) for some integer \( m\), then \( 1 = m^2 - (n+3)^2\).

The only perfect squares that differ by \( 1\) are \( 0\) and \(1\). Hence,

\[ (n+3)^2 = 0, \]

which has the solution \( n = -3\). \(_\square\)

If \( x^2 + y^2 = 9 \), what is the maximum value of \( x^2 + 4y \)?

Since \( x^2 = 9 - y^2 \geq 0 \), we can see that the range of \( y \) is given by

\[ y^2 \leq 9 \implies -3 \leq y \leq 3. \]

Now, substituting \( x^2 = 9 - y^2 \) into \( x^2 + 4y \) and completing the square, we have

\[ \begin{align} x^2 + 4y &= (9 - y^2) + 4y \\ &= -(y^2 - 4y + 4) + 13 \\ &= -(y-2)^2 + 13. \end{align}\]

Thus the maximum value of \( x^2 + 4y \) occurs when \( y = 2 \) and is equal to 13. \(_\square\)

## See Also

**Cite as:**Completing The Square.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/completing-the-square/