Sub topic 5
Special patterns: difference of squares and perfect squares
This chapter assumes you can expand binomials with FOIL, factor out a greatest common factor (GCF), factor trinomials of the form x² + bx + c, and solve a product of linear factors set equal to zero with the zero product property. Two families of expressions factor by a fixed template instead of a search for number pairs. Once you can recognize them, you can factor them quickly. They also lead into the square root method and completing the square in the next chapters.
Difference of squares
A difference of squares is a binomial with two perfect-square terms and a minus sign between them. Expanding (a − b)(a + b) shows why it factors:
(a − b)(a + b) = a² + ab − ab − b² = a² − b²
The two middle terms cancel, so the product has no x-term. This is the monic case x² + bx + c with b = 0. For example, x² − 49 needs two numbers that add to 0 and multiply to −49. The numbers 7 and −7 work, which gives (x − 7)(x + 7).
The pattern is:
a² − b² = (a − b)(a + b)
Here a and b can be any expressions, not just single variables.
- x² − 49 = (x − 7)(x + 7)
- 4x² − 25 = (2x)² − 5² = (2x − 5)(2x + 5)
- 9x² − 16y² = (3x − 4y)(3x + 4y)
- 3x² − 75 = 3(x² − 25) = 3(x − 5)(x + 5). Take out the GCF first, then see the pattern.
The order of the two factors does not matter, since multiplication is commutative.
Factoring more than once
After one application of the pattern, check whether any factor is itself a difference of squares:
x⁴ − 81 = (x² − 9)(x² + 9) = (x − 3)(x + 3)(x² + 9)
The factor x² − 9 splits again. The factor x² + 9 does not.
Solving with the pattern
To solve 25x² − 4 = 0, factor the left side and apply the zero product property:
(5x − 2)(5x + 2) = 0
So 5x − 2 = 0 or 5x + 2 = 0, which gives x = 2/5 or x = −2/5. Substitution confirms it: 25 · (4/25) − 4 = 0.
Perfect square trinomials
A perfect square trinomial is a trinomial that is the square of a binomial. Expanding the two cases gives the patterns:
- (a + b)² = a² + 2ab + b²
- (a − b)² = a² − 2ab + b²
The middle term is twice the product of the two square roots, and its sign matches the sign inside the binomial.
Examples:
- x² + 10x + 25 = (x + 5)². Here 5² = 25 and 2 · 5 = 10.
- x² − 6x + 9 = (x − 3)².
- 4x² − 12x + 9 = (2x − 3)². Here 2x squared is 4x², 3 squared is 9, and 2 · 2x · 3 = 12x.
- 9x² + 30x + 25 = (3x + 5)².
The three-part test
Before you use the pattern, confirm all three conditions:
- The first term is a perfect square.
- The last term is a perfect square.
- The middle term is exactly 2 times the product of the two square roots, in absolute value. Its sign tells you whether the binomial has + or −.
The third condition is the one people skip. Take x² + 6x + 16. The first and last terms are squares (x² and 4²), but 2 · x · 4 = 8x, not 6x. So this is not a perfect square, and it does not factor over the integers either.
There is an equivalent test using coefficients. For ax² + bx + c, the trinomial is a perfect square exactly when b² = 4ac. For 4x² − 12x + 9, b² = 144 and 4ac = 4 · 4 · 9 = 144. This test is the early form of a quantity you will meet again in the quadratic formula chapter.
Solving with the pattern
Solve 4x² − 12x + 9 = 0:
(2x − 3)² = 0
A product of two equal factors is zero, so 2x − 3 = 0 and x = 3/2. The equation has one solution, called a repeated root, because both factors give the same value. This is the "one repeated root" case from the types-of-solutions chapter, and the pattern lets you see it directly.
Recognizing the pattern
| Expression | Pattern? | Factored form | What to check |
|---|---|---|---|
| x² − 36 | Difference of squares | (x − 6)(x + 6) | Two terms, minus sign, both squares |
| x² + 36 | No | Does not factor over the reals | Sum, not difference |
| x² + 12x + 36 | Perfect square | (x + 6)² | 2 · 6 = 12 |
| x² − 12x + 36 | Perfect square | (x − 6)² | Middle term negative |
| x² + 13x + 36 | No | (x + 4)(x + 9) | Middle term is not 12, so use the monic method |
| 8x² − 50 | After GCF | 2(2x − 5)(2x + 5) | 8x² − 50 = 2(4x² − 25) |
The decision flow below combines the checks into one routine.
Checking a candidate in code
The function below applies the same tests to integer coefficients of ax² + bx + c. It reports which pattern applies, if any. The code is exact, since it uses integer square roots rather than floating-point ones.
import math
def is_perfect_square(n):
"""True if n is a non-negative integer square."""
return n >= 0 and math.isqrt(n) ** 2 == n
def term(k):
"""Format k*x, hiding a coefficient of 1."""
return "x" if k == 1 else f"{k}x"
def classify(a, b, c):
"""Classify a*x^2 + b*x + c (integer coefficients, a > 0)."""
if b == 0 and c < 0 and is_perfect_square(a) and is_perfect_square(-c):
p, q = math.isqrt(a), math.isqrt(-c)
return f"difference of squares: ({term(p)} - {q})({term(p)} + {q})"
if c > 0 and is_perfect_square(a) and is_perfect_square(c):
p, q = math.isqrt(a), math.isqrt(c)
if b == 2 * p * q:
return f"perfect square: ({term(p)} + {q})^2"
if b == -2 * p * q:
return f"perfect square: ({term(p)} - {q})^2"
return "no special pattern"
print(classify(1, 0, -49)) # difference of squares: (x - 7)(x + 7)
print(classify(9, 0, -16)) # difference of squares: (3x - 4)(3x + 4)
print(classify(4, -12, 9)) # perfect square: (2x - 3)^2
print(classify(1, 6, 16)) # no special pattern
print(classify(1, 0, 9)) # no special patternThe last two calls show the two failure cases from earlier. The middle term does not match 2ab, and a sum of squares has no real factorization.
Common errors
- Dropping the middle term. Writing (x + 5)² = x² + 25 is wrong. The correct expansion is x² + 10x + 25. Whenever you square a binomial, the 2ab term must appear.
- Factoring a sum of squares. x² + 25 has no real factorization. Do not write (x + 5)(x + 5) or (x + 5)(x − 5). The second gives x² − 25.
- Stopping early. x⁴ − 16 = (x² − 4)(x² + 4) is incomplete, because x² − 4 = (x − 2)(x + 2). The full factorization is (x − 2)(x + 2)(x² + 4).
- Sign slips in perfect squares. x² − 8x + 16 is (x − 4)², not (x + 4)². Expand your answer to confirm.
- Skipping the GCF. 2x² − 18 does not look like a difference of squares until you write 2(x² − 9). Then it is 2(x − 3)(x + 3).
- Losing a root when solving. From x² − 49 = 0 you get two solutions, x = 7 and x = −7. Dividing both sides by x discards x = 0 in other equations and is not a valid shortcut.
- Forcing the pattern. x² + 8x + 16 is a perfect square, but x² + 8x + 15 is not. The second factors as (x + 3)(x + 5) by the usual monic method. When the three-part test fails, switch methods.
Why this matters for the next methods
A perfect square trinomial is the target of completing the square. The expression x² + 6x is missing a constant to become a perfect square. The test says the middle term 6x equals 2 · x · 3, so the missing term is 3² = 9, which gives (x + 3)². The square root method also relies on this chapter. An equation such as (x − 4)² = 25 is a difference of squares in disguise, since (x − 4)² − 25 = 0 factors as (x − 9)(x + 1).
Exercise
Factor completely: 5x² − 80.
Show answer
Take out the GCF 5 to get 5(x² − 16). Then x² − 16 is a difference of squares, so the result is 5(x − 4)(x + 4).
Exercise
Is 25x² + 20x + 4 a perfect square trinomial? If so, factor it and solve 25x² + 20x + 4 = 0.
Show answer
Yes. 25x² = (5x)², 4 = 2², and 2 · 5x · 2 = 20x matches the middle term. So 25x² + 20x + 4 = (5x + 2)². Setting 5x + 2 = 0 gives the single repeated root x = −2/5.
Exercise
A student factors x² + 14x + 36 as (x + 6)². What is wrong, and what do you conclude about the trinomial?
Show answer
The first and last terms are squares (x² and 6²), but the middle term would have to be 2 · 6 = 12, not 14. So the pattern fails. Expanding (x + 6)² gives x² + 12x + 36. Because b² − 4ac = 196 − 144 = 52 is not 0, the trinomial is not a perfect square. It also has no pair of integers that add to 14 and multiply to 36, so it does not factor over the integers.
Exercise
Solve x⁴ − 81 = 0 over the real numbers.
Show answer
Factor: x⁴ − 81 = (x² − 9)(x² + 9) = (x − 3)(x + 3)(x² + 9). The factor x² + 9 is never zero for real x. Setting x − 3 = 0 and x + 3 = 0 gives x = 3 and x = −3.