Guides / Factoring
Special factoring: difference of squares, sum and difference of cubes
Short answer
Take out any common factor first. Then match one of these:
a2 − b2 = (a − b)(a + b)
a3 − b3 = (a − b)(a2 + ab + b2)
a3 + b3 = (a + b)(a2 − ab + b2)
For the cubes, the signs follow SOAP: the binomial has the Same sign as the original, the middle of the trinomial has the Opposite sign, and the last term is Always Positive. A sum of squares, a2 + b2, does not factor over the real numbers. After each step, check whether any factor is itself one of these patterns.
Why it works
Each pattern is a multiplication with its middle terms cancelling. Multiply (a − b)(a + b) and you get a2 + ab − ab − b2: the ab terms cancel, leaving a2 − b2. The cube patterns do the same thing with more terms:
- (a − b)(a2 + ab + b2)The difference of cubes pattern.
- a3 + a2b + ab2 − a2b − ab2 − b3a times each term, then −b times each term.
- a3 − b3The a²b terms cancel, and so do the ab² terms. Every sign in the trinomial is chosen to make that happen.
That's why the signs aren't optional. Change one and the cancelling stops, and you get extra terms.
To use a pattern, you have to see each term as a square or a cube. Learn these by sight: squares 1, 4, 9, 16, 25, 36, 49, 64, 81, 100; cubes 1, 8, 27, 64, 125, 216. A variable is a square when its exponent is even and a cube when its exponent is a multiple of 3, so x6 = (x3)2 = (x2)3 is both. Coefficients come along: 9x2 = (3x)2 and 8x3 = (2x)3.
Example 1: difference of squares with a coefficient
Factor 9x2 − 25.
- (3x)2 − 529x² is (3x)² and 25 is 5². Two squares with a minus between them.
- (3x − 5)(3x + 5)a = 3x, b = 5. Check: 9x² + 15x − 15x − 25 = 9x² − 25.
Example 2: sum of cubes
Factor 8x3 + 27.
- (2x)3 + 338x³ is (2x)³ and 27 is 3³. So a = 2x, b = 3.
- (2x + 3)(a2 − ab + b2)Same sign as the original (+) in the binomial; opposite sign (−) on the middle term.
- (2x + 3)(4x2 − 6x + 9)a² = 4x², ab = 6x, b² = 9. The middle term is ab, not 2ab.
The trinomial 4x2 − 6x + 9 is finished. It looks like it might factor, but it doesn't over the real numbers (its discriminant is 36 − 144 = −108, which is negative). That's true of the trinomial from every sum or difference of cubes.
Example 3: take out the GCF first
Factor 2x3 − 54. Neither 2 nor 54 is a perfect cube, so the pattern is hidden until the common factor comes out.
- 2(x3 − 27)Both terms are divisible by 2. Now 27 = 3³ is visible.
- 2(x3 − 33)Difference of cubes, with a = x and b = 3.
- 2(x − 3)(x2 + 3x + 9)SOAP: minus in the binomial (same), plus in the middle (opposite), plus on the 9 (always positive).
Example 4: factor until nothing factors: x4 − 16
- (x2)2 − 42x⁴ is (x²)² and 16 is 4².
- (x2 − 4)(x2 + 4)Difference of squares. Now check each factor again.
- (x − 2)(x + 2)(x2 + 4)x² − 4 is another difference of squares. x² + 4 is a sum of squares, so it stays.
Check by multiplying: (x − 2)(x + 2) = x2 − 4, and (x2 − 4)(x2 + 4) = x4 − 16.
Common mistakes, and the exact line they happen on
1. Factoring a sum of squares
- x2 + 9A sum, not a difference.
- (x + 3)2This is the mistake. (x + 3)² = x² + 6x + 9. The 6x has nowhere to go.
The difference-of-squares pattern works because +ab and −ab cancel. With a plus between the squares there's nothing to cancel, so x2 + 9 doesn't factor over the real numbers. Plug in x = 1 to see it: 1 + 9 = 10, but (1 + 3)2 = 16. A common factor can still come out, as in 4x2 + 36 = 4(x2 + 9), but that's as far as it goes.
2. Getting the cube signs wrong, or factoring the trinomial further
- x3 − 8 = x3 − 23Difference of cubes, a = x, b = 2.
- (x − 2)(x2 − 2x + 4)This is the mistake. The minus was copied into the middle of the trinomial. It multiplies out to x³ − 4x² + 8x − 8.
SOAP says the middle sign is the opposite of the original: (x − 2)(x2 + 2x + 4). A second version of this slip writes 2ab in the middle, as if the trinomial were a perfect square: (x − 2)(x2 + 4x + 4) multiplies out to x3 + 2x2 − 4x − 8. The middle term is ab.
The same instinct causes a third slip, on a correct factoring:
- x3 + 8 = (x + 2)(x2 − 2x + 4)Correct.
- (x + 2)(x − 2)2This is the mistake. x² − 2x + 4 was treated as (x − 2)², which is x² − 4x + 4. The product is x³ − 2x² − 4x + 8, not x³ + 8.
The trinomial from a sum or difference of cubes never factors over the real numbers. Its discriminant is always negative (here 4 − 16 = −12). Once you've applied the cube pattern, the trinomial is done.
3. Missing the GCF
- 3x2 − 4848 isn't a perfect square, and neither is 3x².
- prime (doesn't factor)This is the mistake. Both terms share a factor of 3.
Take the 3 out first: 3(x2 − 16) = 3(x − 4)(x + 4). If the coefficients don't look like squares or cubes, check for a common factor before deciding the pattern doesn't apply.
4. Stopping after one step on x4 − 16
- x4 − 16 = (x2)2 − 42Difference of squares.
- (x2 − 4)(x2 + 4)This is the incomplete line. It's equal to x⁴ − 16, but x² − 4 still factors.
“Factor completely” means every factor gets checked again. The fully factored answer is (x − 2)(x + 2)(x2 + 4). If you are solving x4 − 16 = 0, stopping early hides the solutions x = 2 and x = −2 inside a factor you never finished.
5. Confusing a3 − b3 with (a − b)3
- x3 − 27Difference of cubes.
- (x − 3)3This is the mistake. (x − 3)³ = x³ − 9x² + 27x − 27. Cubing a binomial produces middle terms.
Test it with x = 1: the original is 1 − 27 = −26, but (1 − 3)3 = −8. The correct factoring is (x − 3)(x2 + 3x + 9). It's the same slip as writing (a + b)2 = a2 + b2, run in reverse.
Practice
Factor completely. If something doesn't factor beyond a common factor, say so.
16x2 − 81y2
Show answer
(4x)2 − (9y)2 = (4x − 9y)(4x + 9y).
x3 + 125
Show answer
x3 + 53 = (x + 5)(x2 − 5x + 25). The trinomial doesn't factor further.
5x3 − 40
Show answer
GCF first: 5(x3 − 8) = 5(x − 2)(x2 + 2x + 4).
81x4 − 1
Show answer
(9x2 − 1)(9x2 + 1), and 9x2 − 1 is another difference of squares: (3x − 1)(3x + 1)(9x2 + 1).
3x2 + 12
Show answer
3(x2 + 4), and that's as far as it goes. x2 + 4 is a sum of squares, which doesn't factor over the real numbers.