Sub topic 7
Difference of squares
This chapter assumes you can multiply binomials with FOIL, you know the exponent rule (x^3)^2 = x^6, and you can factor out a greatest common factor. The difference of squares is the first special product pattern in this tutorial. It is short to learn and appears in almost every later factoring problem.
The pattern
A difference of squares is a binomial that subtracts one perfect square from another. It always factors like this:
a^2 - b^2 = (a - b)(a + b)Here a and b can be numbers, variables, or whole expressions. The two factors use the same two quantities. One factor has a minus sign and the other has a plus sign. These are conjugates, a pair of binomials that differ only in the sign between their terms.
Why it works
Factoring undoes multiplication, so multiply the right side with FOIL:
(a - b)(a + b) = a^2 + ab - ab - b^2 = a^2 - b^2The two middle terms, +ab and -ab, are opposites and cancel. That cancellation is why the product of two conjugate binomials has no middle term. A binomial with no middle term, a minus sign, and two square terms is a strong sign that this pattern applies.
Recognizing a perfect square
A perfect square is an expression you get by squaring something. You need to spot these quickly, in three kinds of term:
- A number is a perfect square if it is the square of an integer.
- A variable power is a perfect square if its exponent is even. Halve the exponent to get the root.
- A product is a perfect square if every part is. Take the root of each part.
| Term | Square root | Reason |
|---|---|---|
| 49 | 7 | 7 * 7 = 49 |
| 25x^2 | 5x | (5x)^2 = 25x^2 |
| x^6 | x^3 | (x^3)^2 = x^6 |
| 81y^4 | 9y^2 | (9y^2)^2 = 81y^4 |
| 16x^2y^2 | 4xy | (4xy)^2 = 16x^2y^2 |
| x^5 | none | the exponent is odd |
| 20 | none | not the square of an integer |
The perfect squares you will meet most often are 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, and 144. Knowing these by sight saves time.
A basic procedure
For a binomial that looks like a difference of squares:
- Confirm there is a minus sign between the two terms.
- Take the square root of the first term. Call it a.
- Take the square root of the second term. Call it b.
- Write (a - b)(a + b).
- Multiply back to check.
Worked examples
Start with a plain case:
x^2 - 49 = (x - 7)(x + 7)
Check: x^2 + 7x - 7x - 49 = x^2 - 49Next, a case with a coefficient. The root of 25x^2 is 5x, and the root of 36 is 6:
25x^2 - 36 = (5x - 6)(5x + 6)
Check: 25x^2 + 30x - 30x - 36 = 25x^2 - 36A case with two variables. The root of 4x^2 is 2x, and the root of 81y^2 is 9y:
4x^2 - 81y^2 = (2x - 9y)(2x + 9y)A case with higher powers. The root of x^6 is x^3, and the root of 100 is 10:
x^6 - 100 = (x^3 - 10)(x^3 + 10)The order of the factors does not matter, because multiplication is commutative. (x + 7)(x - 7) is the same answer as (x - 7)(x + 7).
When the squares come in the other order
If the subtracted term comes first, the pattern still applies:
-x^2 + 16 = 16 - x^2 = (4 - x)(4 + x)You can also factor out -1 first and get -(x^2 - 16) = -(x - 4)(x + 4). Both answers are correct, and they are equal to each other. Check by expanding if you are unsure.
Take out the greatest common factor first
Some binomials do not look like a difference of squares until you remove a common factor. Always check for a greatest common factor (GCF) first.
3x^3 - 75x
= 3x(x^2 - 25)
= 3x(x - 5)(x + 5)The terms 3x^3 and 75x are not perfect squares, so the pattern could not be applied directly. After the GCF 3x is removed, x^2 - 25 is a difference of squares.
Skipping the GCF step causes a different problem. Consider 4x^2 - 100. Both terms are perfect squares, so you might write:
4x^2 - 100 = (2x - 10)(2x + 10)This is correct, but it is not factored completely. Each factor still has a common factor of 2. Removing the GCF first gives a cleaner path:
4x^2 - 100 = 4(x^2 - 25) = 4(x - 5)(x + 5)Expand (2x - 10)(2x + 10) = 4(x - 5)(x + 5) to see that the two answers are equal. The second is the complete factorization.
Factoring more than once
After you apply the pattern, look at each new factor. A factor may be a difference of squares itself.
x^4 - 16
= (x^2)^2 - 4^2
= (x^2 - 4)(x^2 + 4)
= (x - 2)(x + 2)(x^2 + 4)The factor x^2 - 4 is another difference of squares, so it splits again. The factor x^2 + 4 is a sum of squares and stays as it is. A good habit is to re-inspect every factor after each step and stop only when none of them can be factored further.
A related idea: x^6 - 64 is a difference of squares because x^6 = (x^3)^2 and 64 = 8^2. It is also a difference of cubes, because x^6 = (x^2)^3 and 64 = 4^3. Both views are valid. The square view is easier to start with:
x^6 - 64 = (x^3 - 8)(x^3 + 8)The two factors then factor further with the sum and difference of cubes pattern, which is a later chapter.
Squares that are whole expressions
The letters a and b in the pattern can stand for any expression. This is where students often get stuck, so follow the substitution carefully.
(x + 1)^2 - 9Here a = x + 1 and b = 3, so:
(x + 1)^2 - 9 = ((x + 1) - 3)((x + 1) + 3) = (x - 2)(x + 4)Check by expanding the original. (x + 1)^2 - 9 = x^2 + 2x + 1 - 9 = x^2 + 2x - 8. Then (x - 2)(x + 4) = x^2 + 4x - 2x - 8 = x^2 + 2x - 8. The results match.
When both terms are squared binomials, put parentheses around each one so the signs stay right:
(x + 3)^2 - (2x - 1)^2
= ((x + 3) - (2x - 1))((x + 3) + (2x - 1))
= (x + 3 - 2x + 1)(x + 3 + 2x - 1)
= (-x + 4)(3x + 2)The minus sign in front of (2x - 1) changes both signs inside. Forgetting this is the most common error in this kind of problem.
A mental math use
Because (a - b)(a + b) = a^2 - b^2, the pattern also works from right to left, to multiply numbers that sit symmetrically around a round number:
99 * 101 = (100 - 1)(100 + 1) = 100^2 - 1^2 = 10000 - 1 = 9999It also speeds up subtraction of squares:
51^2 - 49^2 = (51 - 49)(51 + 49) = 2 * 100 = 200When the pattern does not apply
Three cases look similar to a difference of squares but are not. Each leads to a common mistake.
A sum of squares
x^2 + 49 has no integer factorization. Try to find a pair of binomials: you would need two numbers whose product is 49 and whose sum is 0 for the middle term to vanish. The pair 7 and -7 sums to 0 but multiplies to -49, not +49. No pair works. A polynomial that cannot be factored over the integers is called prime. The same holds for 9x^2 + 16.
A term that is not a perfect square
x^2 - 20 has a minus sign, but 20 is not the square of an integer. Over the integers, this binomial is prime. Over the real numbers it factors as (x - sqrt(20))(x + sqrt(20)), but this tutorial works with integer coefficients.
Confusing it with a perfect square trinomial
x^2 - 49 and x^2 - 14x + 49 are different. The first is a binomial and gives (x - 7)(x + 7). The second is a trinomial and gives (x - 7)^2. The next chapter covers the second type. Do not mix them up by writing (x - 7)^2 for a binomial.
Using the pattern to solve equations
Factored form lets you solve an equation using the zero product property: if a product is zero, at least one factor is zero.
x^2 - 49 = 0
(x - 7)(x + 7) = 0
x - 7 = 0 or x + 7 = 0
x = 7 or x = -7Both solutions satisfy the original equation, since 7^2 = 49 and (-7)^2 = 49. A common slip is to give only x = 7. A squared quantity always has two roots when the constant is positive.
Checking with software
Python's SymPy library can factor a polynomial and confirm the result by expanding it. This is useful for checking homework, not for replacing practice.
from sympy import symbols, factor, expand
x, y = symbols('x y')
examples = [
x**2 - 49,
25*x**2 - 36,
4*x**2 - 81*y**2,
3*x**3 - 75*x,
x**4 - 16,
x**2 + 49,
]
for expr in examples:
factored = factor(expr)
print(expr, "->", factored, expand(factored) == expr)Each line prints the original expression, its factored form, and True when expanding the factored form returns the original. The last example, x**2 + 49, comes back unchanged, which confirms that a sum of squares is prime over the integers.
Decision flow
The diagram summarizes how to handle a binomial.
Summary of the main points
- a^2 - b^2 = (a - b)(a + b), because the middle terms cancel when you multiply conjugates.
- Check for a GCF first, then test for two perfect squares joined by a minus sign.
- Use the square root of each term, including coefficients and halved exponents.
- Re-inspect every factor, since x^4 - 16 splits twice.
- A sum of squares such as x^2 + 49 is prime over the integers.
- Always verify by expanding.
Exercise
Factor completely: 18x^3 - 8x.
Show answer
First take out the GCF 2x: 18x^3 - 8x = 2x(9x^2 - 4). Then 9x^2 - 4 is a difference of squares with roots 3x and 2, so the result is 2x(3x - 2)(3x + 2). Check: 2x(9x^2 - 4) = 18x^3 - 8x.
Exercise
Factor completely: 81x^4 - 1.
Show answer
Write 81x^4 - 1 = (9x^2)^2 - 1^2 = (9x^2 - 1)(9x^2 + 1). The factor 9x^2 - 1 is another difference of squares: (3x - 1)(3x + 1). The factor 9x^2 + 1 is a sum of squares and is prime. The answer is (3x - 1)(3x + 1)(9x^2 + 1).
Exercise
Factor (x + 5)^2 - 16, and then solve (x + 5)^2 - 16 = 0.
Show answer
With a = x + 5 and b = 4, the factorization is ((x + 5) - 4)((x + 5) + 4) = (x + 1)(x + 9). Setting each factor to zero gives x = -1 or x = -9. Check x = -1: (4)^2 - 16 = 0. Check x = -9: (-4)^2 - 16 = 0.
Exercise
A student writes 4x^2 + 25 = (2x + 5)(2x - 5). Explain the error and give the correct factorization.
Show answer
Expanding (2x + 5)(2x - 5) gives 4x^2 - 25, not 4x^2 + 25. The pattern needs a minus sign between the squares. The expression 4x^2 + 25 is a sum of squares and has no factorization over the integers, so it is prime.