The portal has been deactivated. Please contact your portal admin.

Lesson Explainer: Factoring by Completing the Square Mathematics

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 𝑎±2𝑎𝑏+𝑏.

We recall that perfect square trinomials can be factored as follows: 𝑎+2𝑎𝑏+𝑏=(𝑎+𝑏),𝑎2𝑎𝑏+𝑏=(𝑎𝑏).

In these trinomials, 𝑎 and 𝑏 may be variables, constants, or products of variables and constants. Consider the trinomial 9𝑥𝑦+30𝑥𝑦𝑧+25𝑧.

This is a perfect square trinomial. In this example, if we take 𝑎 to be 9𝑥𝑦 and 𝑏 to be 25𝑧, then our value of 𝑎 is 9𝑥𝑦=3𝑥𝑦 and our value of 𝑏 is 25𝑧=5𝑧. Then, our middle term is equal to 2𝑎𝑏. This is more visible if we rewrite the trinomial as follows: 3𝑥𝑦+23𝑥𝑦5𝑧+5𝑧.

Therefore, this polynomial can be factored as 3𝑥𝑦+5𝑧.

Let us take a look at another example. Suppose we are asked to factor the trinomial 81𝑚+36𝑚𝑛+4𝑛.

If we take the first and last terms to be 𝑎 and 𝑏, then 𝑎=81𝑚=9𝑚 and 𝑏=4𝑛=2𝑛; hence, 2𝑎𝑏=29𝑚2𝑛=36𝑚𝑛, which is the middle term. Therefore, this is a perfect square trinomial, so it can be factored as 9𝑚+2𝑛.

Now, however, suppose that we are asked to factor only the binomial 81𝑚+4𝑛.

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 36𝑚𝑛, we were able to factor this as a perfect square trinomial. If we artificially introduced a term of 36𝑚𝑛 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 2𝑎𝑏 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:

  1. Determine the values of 𝑎 and 𝑏.
  2. Calculate 2𝑎𝑏.
  3. Add 2𝑎𝑏 and 2𝑎𝑏 to the expression.
  4. Factor 𝑎+2𝑎𝑏+𝑏 as (𝑎+𝑏), or factor 𝑎2𝑎𝑏+𝑏 as (𝑎𝑏).

For our previous expression, 81𝑚+4𝑛, we will introduce a middle term of 36𝑚𝑛 to complete the square, along with a term 36𝑚𝑛. 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 36𝑚𝑛36𝑚𝑛.

Our expression with these two new terms is 81𝑚+36𝑚𝑛+4𝑛36𝑚𝑛.

As in the previous example, we can factor the first three terms as a perfect square trinomial, giving us 9𝑚+2𝑛36𝑚𝑛.

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

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, 9𝑚+2𝑛36𝑚𝑛, as 9𝑚+2𝑛6𝑚𝑛=9𝑚+2𝑛+6𝑚𝑛9𝑚+2𝑛6𝑚𝑛.

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 9𝑚+6𝑚𝑛+2𝑛.

To see if this trinomial can be factored, we first note that 9𝑚 and 2𝑛 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 18𝑚𝑛. 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 9𝑚6𝑚𝑛+2𝑛.

As before, 9𝑚 and 2𝑛 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 6. Hence, we can assume this polynomial is prime.

Since the polynomials 9𝑚+6𝑚𝑛+2𝑛 and 9𝑚6𝑚𝑛+2𝑛 are prime, the expression 9𝑚+2𝑛+6𝑚𝑛9𝑚+2𝑛6𝑚𝑛 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: 8𝑎𝑐+2𝑏𝑐.

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 2𝑐, our resulting expression will be 2𝑐4𝑎+𝑏.

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 2𝑎𝑏 so that we can factor 𝑎+2𝑎𝑏+𝑏 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 625𝑥+64𝑦 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 𝑎+2𝑎𝑏+𝑏.

In this case, with 𝑎=625𝑥 and 𝑏=64𝑦, our 𝑎 is 25𝑥 and our 𝑏 is 8𝑦. Therefore, the term (2𝑎𝑏) that we will introduce is 400𝑥𝑦. Our new form of the expression is 625𝑥+400𝑥𝑦+64𝑦400𝑥𝑦.

The first three terms can now be factored as a perfect square trinomial, giving us 25𝑥+8𝑦400𝑥𝑦.

Since 400𝑥𝑦=(20𝑥𝑦), this is a difference of squares; hence, we can factor this expression as 25𝑥+8𝑦(20𝑥𝑦)=25𝑥+8𝑦+20𝑥𝑦25𝑥+8𝑦20𝑥𝑦.

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 625𝑥+64𝑦=25𝑥+20𝑥𝑦+8𝑦25𝑥20𝑥𝑦+8𝑦.

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 16𝑥𝑦+4𝑦𝑧 fully by completing the square.

Answer

First, we factor out the GCF of 4𝑦. This gives us 4𝑦4𝑥+𝑧.

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 𝑎+2𝑎𝑏+𝑏.

In this case, with 𝑎=4𝑥 and 𝑏=𝑧, our 𝑎 is 2𝑥 and our 𝑏 is 𝑧. Therefore, the term (2𝑎𝑏) that we will introduce is 4𝑥𝑧. Our new form of the expression is 4𝑦4𝑥+4𝑥𝑧+𝑧4𝑥𝑧.

The first three terms within the parentheses can now be factored as a perfect square trinomial, giving us 4𝑦2𝑥+𝑧4𝑥𝑧.

Since 4𝑥𝑧=(2𝑥𝑧), the expression within the brackets is a difference of squares; hence, we can factor this expression as 4𝑦2𝑥+𝑧(2𝑥𝑧)=4𝑦2𝑥+𝑧+2𝑥𝑧2𝑥+𝑧2𝑥𝑧.

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 16𝑥𝑦+4𝑦𝑧=4𝑦2𝑥+2𝑥𝑧+𝑧2𝑥2𝑥𝑧+𝑧.

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 2𝑎𝑏, we can still use the same method to introduce the 2𝑎𝑏 term.

Example 3: Factoring a Trinomial by Completing the Square

Factorize fully 4𝑥+9+8𝑥.

Answer

We want to complete the square so that we have the form 𝑎+2𝑎𝑏+𝑏.

In this case, with 𝑎=4𝑥 and 𝑏=9, our 𝑎 is 2𝑥 and our 𝑏 is 3. Therefore, the term of 2𝑎𝑏 that we will introduce is 12𝑥. Our new form of the expression is 4𝑥+12𝑥+9+8𝑥12𝑥.

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 2𝑥+34𝑥.

Since 4𝑥=(2𝑥), this is a difference of squares; hence, we can factor this expression as 2𝑥+3(2𝑥)=2𝑥+3+2𝑥2𝑥+32𝑥.

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 4𝑥+9+8𝑥=2𝑥+2𝑥+32𝑥2𝑥+3.

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 𝑥16𝑦 fully by completing the square.

Answer

Firstly, note that this expression fits the form 𝑎𝑏, with 𝑎=𝑥 and 𝑏=4𝑦. We can therefore factor this expression as a difference of squares. Doing so, we have 𝑥4𝑦=𝑥+4𝑦𝑥4𝑦.

Next, we can see that the second expression is also a difference of squares, this time with 𝑎=𝑥 and 𝑏=2𝑦. This gives us 𝑥+4𝑦𝑥2𝑦=𝑥+4𝑦𝑥+2𝑦𝑥2𝑦.

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 𝑎+2𝑎𝑏+𝑏.

In this case, with 𝑎=𝑥 and 𝑏=4𝑦, our 𝑎 is 𝑥 and our 𝑏 is 2𝑦. Therefore, the term of 2𝑎𝑏 that we will introduce is 4𝑥𝑦. We introduce these terms within the first set of parentheses only. Our new form of the expression is 𝑥+4𝑥𝑦+4𝑦4𝑥𝑦𝑥+2𝑦𝑥2𝑦.

The first three terms within the first set of parentheses can now be factored as a perfect square trinomial, giving us 𝑥+2𝑦4𝑥𝑦𝑥+2𝑦𝑥2𝑦.

Since 4𝑥𝑦=(2𝑥𝑦), the expression within the brackets is a difference of squares; hence, we can factor this expression as 𝑥+2𝑦(2𝑥𝑦)𝑥+2𝑦𝑥2𝑦=𝑥+2𝑦+2𝑥𝑦𝑥+2𝑦2𝑥𝑦𝑥+2𝑦𝑥2𝑦.

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 𝑥16𝑦=𝑥+2𝑥𝑦+2𝑦𝑥2𝑥𝑦+2𝑦𝑥+2𝑦𝑥2𝑦.

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 196𝑥65𝑥𝑦+4𝑦 fully by completing the square.

Answer

We want to complete the square so that we have the form 𝑎+2𝑎𝑏+𝑏 included in the expression.

In this case, with 𝑎=196𝑥 and 𝑏=4𝑦, our 𝑎 is 14𝑥 and our 𝑏 is 2𝑦. Therefore, the term (2𝑎𝑏) that we will introduce is 56𝑥𝑦. Our new form of the expression is 196𝑥+56𝑥𝑦+4𝑦65𝑥𝑦56𝑥𝑦.

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 14𝑥+2𝑦121𝑥𝑦.

Since 121𝑥𝑦=(11𝑥𝑦), this is a difference of squares; hence, we can factor this expression as 14𝑥+2𝑦(11𝑥𝑦)=14𝑥+2𝑦+11𝑥𝑦14𝑥+2𝑦11𝑥𝑦.

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 14𝑥+11𝑥𝑦+2𝑦.

To see if this trinomial can be factored, we first note that 14𝑥 and 2𝑦 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 28𝑥𝑦. 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 11𝑥𝑦 into 4𝑥𝑦 and 7𝑥𝑦. We rewrite the expression as 14𝑥+4𝑥𝑦+7𝑥𝑦+2𝑦.

The GCF of the first two terms is 2𝑥, 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 2𝑥(7𝑥+2𝑦)+𝑦(7𝑥+2𝑦).

The two parts of this resulting expression share a factor of 7𝑥+2𝑦, which we can factor out next. We are then left with (7𝑥+2𝑦)(2𝑥+𝑦).

The trinomial within the second set of parentheses can be factored similarly. Arranging the terms from highest to lowest power of 𝑥, we have 14𝑥11𝑥𝑦+2𝑦.

First, we note that 14𝑥 and 2𝑦 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 11. The factors are now 4 and 7. We can split the middle term of 11𝑥𝑦 into 4𝑥𝑦7𝑥𝑦 accordingly: 14𝑥4𝑥𝑦7𝑥𝑦+2𝑦.

The GCF of the first two terms is 2𝑥, 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 2𝑥(7𝑥2𝑦)+𝑦(7𝑥+2𝑦).

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 1 from the second parentheses, which yields 2𝑥(7𝑥2𝑦)𝑦(7𝑥2𝑦).

The two parts of this resulting expression share a factor of 7𝑥2𝑦, which we can factor out next. We are then left with (7𝑥2𝑦)(2𝑥𝑦).

Let us now return to the main problem. Following our factoring by the difference of squares, we were left with 14𝑥+2𝑦+11𝑥𝑦14𝑥+2𝑦11𝑥𝑦.

We have now found that the expression within the first set of parentheses can be factored as (7𝑥+2𝑦)(2𝑥+𝑦) and the expression within the second set of parentheses can be factored as (7𝑥2𝑦)(2𝑥𝑦).

Hence, we have now factored fully, and we have that 196𝑥65𝑥𝑦+4𝑦=(7𝑥+2𝑦)(2𝑥+𝑦)(7𝑥2𝑦)(2𝑥𝑦).

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

Key Points

  • A perfect square trinomial is of the form 𝑎±2𝑎𝑏+𝑏 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 ±2𝑎𝑏.
  • Both 2𝑎𝑏 and 2𝑎𝑏 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.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.