In this explainer, we will learn how to factor an expression by completing the square.

Recall the form of a perfect square trinomial.

### Definition: Perfect Square Trinomial

A perfect square trinomial is a polynomial with three terms that can be represented in the form

We recall that perfect square trinomials can be factored as follows:

In these trinomials, and may be variables, constants, or products of variables and constants. Consider the trinomial

This is a perfect square trinomial. In this example, if we take to be and to be , then our value of is and our value of is . Then, our middle term is equal to . This is more visible if we rewrite the trinomial as follows:

Therefore, this polynomial can be factored as

Let us take a look at another example. Suppose we are asked to factor the trinomial

If we take the first and last terms to be and , then and ; hence, , which is the middle term. Therefore, this is a perfect square trinomial, so it can be factored as

Now, however, suppose that we are asked to factor only the binomial

In this case, our usual methods of factoring do not work.

From the previous trinomial we factored, we know that when the middle term was , we were able to factor this as a perfect square trinomial. If we artificially introduced a term of into this polynomial, we would create a perfect square trinomial, which we would then be able to factor.

In fact, we can do this in many instances where we have a polynomial of the form that cannot be factored by other means. This process of introducing the term to create a perfect square trinomial is called completing the square.

### How To: Completing the Square

If we have two terms that are both perfect squares (i.e., in the form ), we can create a perfect square trinomial by completing the square as follows:

- Determine the values of and .
- Calculate .
- Add and to the expression.
- Factor as , or factor as .

For our previous expression, , we will introduce a middle term of to complete the square, along with a term . For any term that we introduce, we must add the same term with the opposite sign; this way, we are effectively adding zero, which does not change the polynomial. In this case, the zero, which we are adding to this polynomial, is in the form .

Our expression with these two new terms is

As in the previous example, we can factor the first three terms as a perfect square trinomial, giving us

Now, we have a difference of squares since the expression within the parentheses is being squared and is a perfect square: the square of .

Recall the definition of the difference of squares.

### Definition: Difference of Squares

A difference of squares is an expression in the form and can be factored as follows:

Therefore, we can factor our new expression, as

Following this, we should check to see if our resulting polynomials within the parentheses are able to be factored. Arranging the terms in the first factor from highest to lowest power of , we have

To see if this trinomial can be factored, we first note that and are both not perfect squares, so we cannot complete the square with this polynomial. To factor by grouping, we take the product of the outer terms, which is . We now look for factors of the coefficient of this product, 18, whose sum will be the coefficient of the middle term, 6. In this case, there are no factor pairs that work. Hence, we can assume this polynomial is prime.

Likewise, the second factor arranged from highest to lowest power of is

As before, and are not both perfect squares, so we cannot complete the square with this polynomial, and there are no factor pairs of 18 that add to . Hence, we can assume this polynomial is prime.

Since the polynomials and are prime, the expression has been factored as much as possible.

Factoring out the GCF (greatest common factor) before completing the square may also be helpful on occasion. Consider that we are asked to factor the following expression:

This expression is not in the form , and so we cannot complete the square. However, if we factor out the GCF, which in this case is , our resulting expression will be

The expression within the parentheses fits the form , so completing the square is now possible here. Occasionally, it will be possible to complete the square without factoring out the GCF; however, doing so will generally reduce the complexity of the polynomial being factored and is recommended when possible.

Let us now work through a few examples where completing the square allows us to factor polynomials. First, we will solve an example where the initial polynomial fits the form . We must first introduce so that we can factor by completing the square, and then we must factor the resulting expression by another method.

### Example 1: Factoring a Binomial by Completing the Square

Factor fully by completing the square.

### Answer

We want to factor this expression by completing the square, so we need to manipulate it to include a perfect square trinomial in the form

In this case, with and , our is and our is . Therefore, the term that we will introduce is . Our new form of the expression is

The first three terms can now be factored as a perfect square trinomial, giving us

Since , this is a difference of squares; hence, we can factor this expression as

We then consider whether the resulting polynomials within each set of parentheses can be factored. In this case, both sets of polynomials are prime, and so we have factored fully.

Therefore, we have that

Next, we will look at an example where factoring out the GCF is a useful first step, because it will yield a less complicated expression for which we must complete the square. In this example, the starting polynomial is already of the form . However, there will be problems in which the starting polynomial is not in this form but factoring out the GCF will produce the form within the parentheses.

### Example 2: Factoring a Binomial by Completing the Square

Factor fully by completing the square.

### Answer

First, we factor out the GCF of . This gives us

Note that since the original question was already in the form , we could have completed the square with the original expression. However, pulling out the GCF first will simplify our calculations.

We now want to complete the square for the expression within the parentheses so that we have the form

In this case, with and , our is and our is . Therefore, the term that we will introduce is . Our new form of the expression is

The first three terms within the parentheses can now be factored as a perfect square trinomial, giving us

Since , the expression within the brackets is a difference of squares; hence, we can factor this expression as

We then consider whether the resulting polynomials within each set of parentheses can be factored. In this case, both sets of polynomials are prime, and so we have factored fully.

Therefore, we have that

Next, we will take a look at an example of using this method to factor a trinomial. If we have an term and a term but the third term is not , we can still use the same method to introduce the term.

### Example 3: Factoring a Trinomial by Completing the Square

Factorize fully .

### Answer

We want to complete the square so that we have the form

In this case, with and , our is and our is 3. Therefore, the term of that we will introduce is . Our new form of the expression is

The first three terms can now be factored as a perfect square trinomial, and the last two terms can be combined as like terms, giving us

Since , this is a difference of squares; hence, we can factor this expression as

We then consider whether the resulting polynomials within each set of parentheses can be factored. In this case, both sets of polynomials are prime, and so we have factored fully.

Therefore, we have that

Next, we will work through an example where other factoring methods are needed first but in the resulting expression, one of the factors can be factored further through completing the square.

### Example 4: Factoring a Higher-Degree Expression by Completing the Square

Factor fully by completing the square.

### Answer

Firstly, note that this expression fits the form , with and . We can therefore factor this expression as a difference of squares. Doing so, we have

Next, we can see that the second expression is also a difference of squares, this time with and . This gives us

Since the expression within the first set of parentheses is in the form , we now want to complete the square for the expression within the parentheses so that we have the form

In this case, with and , our is and our is . Therefore, the term of that we will introduce is . We introduce these terms within the first set of parentheses only. Our new form of the expression is

The first three terms within the first set of parentheses can now be factored as a perfect square trinomial, giving us

Since , the expression within the brackets is a difference of squares; hence, we can factor this expression as

We then consider whether the resulting polynomials within each set of parentheses can be factored. In this case, all sets of polynomials are prime, and so we have factored fully.

Therefore, we have that

Finally, we will look at an example where we complete the square and further steps of factoring are required following the factoring by difference of squares. Sometimes, we might encounter expressions where we need to apply a number of different factoring techniques. These may include factoring out a GCF, factoring by difference of squares, factoring by completing the square, or factoring by grouping.

### Example 5: Factoring an Expression into a Product of Binomials by Completing the Square

Factor fully by completing the square.

### Answer

We want to complete the square so that we have the form included in the expression.

In this case, with and , our is and our is . Therefore, the term that we will introduce is . Our new form of the expression is

The first three terms can now be factored as a perfect square trinomial, and the last two terms can be combined as like terms, giving us

Since , this is a difference of squares; hence, we can factor this expression as

We then consider whether the resulting polynomials within each set of parentheses can be factored. In this case, both sets of polynomials are not prime.

Take the trinomial within the first set of parentheses. Arranging the terms from highest to lowest power of , we have

To see if this trinomial can be factored, we first note that and are not both perfect squares, so we cannot complete the square with this polynomial. To factor by grouping, we take the product of the outer terms, which is . We now look for factors of the coefficient of this product, 28, whose sum will be the coefficient of the middle term, 11. In this case, the factors 4 and 7 work; therefore, we will split the middle term of into and . We rewrite the expression as

The GCF of the first two terms is , and the GCF of the last two terms is . Factoring these out of the first two terms and the last two terms, respectively, gives us

The two parts of this resulting expression share a factor of , which we can factor out next. We are then left with

The trinomial within the second set of parentheses can be factored similarly. Arranging the terms from highest to lowest power of , we have

First, we note that and are not both perfect squares, so we cannot complete the square with this polynomial. To factor by grouping, we would look for factors of 28 that add to . The factors are now and . We can split the middle term of into accordingly:

The GCF of the first two terms is , and the GCF of the last two terms is . Factoring these out of the first two terms and the last two terms, respectively, gives us

Because the expression in the second set of parentheses only differs from the expression in the first set of parentheses by the signs, we will factor out from the second parentheses, which yields

The two parts of this resulting expression share a factor of , which we can factor out next. We are then left with

Let us now return to the main problem. Following our factoring by the difference of squares, we were left with

We have now found that the expression within the first set of parentheses can be factored as and the expression within the second set of parentheses can be factored as .

Hence, we have now factored fully, and we have that

Let us finish by recapping some key points from the explainer.

### Key Points

- A perfect square trinomial is of the form and can be factored as .
- If asked to factor a polynomial that we cannot factor by other means and the polynomial contains two terms of the form , we can complete the square to form a perfect square trinomial.
- If we take the two perfect square terms to be and , the term that must be added to form a perfect square trinomial is .
- Both and must be included so that we are effectively adding zero.
- If possible, factor out a GCF (greatest common factor) first to reduce the complexity of the polynomial that needs to be factored.
- Often, after completing the square, factoring the resulting expression by difference of squares will be possible.
- Once the polynomial has been factored in one way, check to see if the resulting expressions can be factored further.