Sub topic 9
Sum and difference of cubes
This chapter assumes you can multiply binomials and trinomials with the distributive property, use the exponent rule (x^m)^n = x^(mn), and factor out a greatest common factor (GCF). You should also know the difference of squares pattern from the previous chapter. The goal here is to factor expressions of the form a^3 + b^3 and a^3 - b^3. You will also see where they fit in a full factoring strategy and what goes wrong most often.
The two formulas
A cube is a number or expression multiplied by itself three times. The sum and difference of cubes are two special products:
a^3 + b^3 = (a + b)(a^2 - ab + b^2)
a^3 - b^3 = (a - b)(a^2 + ab + b^2)Each formula turns a two-term expression into a binomial times a trinomial. The two formulas differ only in signs, so those signs are the main thing to learn.
| Pattern | First factor | Second factor (trinomial) |
|---|---|---|
| a^3 + b^3 | a + b | a^2 - ab + b^2 |
| a^3 - b^3 | a - b | a^2 + ab + b^2 |
A common memory aid is SOAP, which describes the signs in order:
- Same: the binomial's sign matches the sign in the original expression.
- Opposite: the middle term of the trinomial has the opposite sign.
- Always Positive: the last term of the trinomial is always positive.
Why the formulas work
Factoring is the reverse of multiplying, so you can verify the sum formula by expanding it:
(a + b)(a^2 - ab + b^2)
= a*a^2 - a*ab + a*b^2 + b*a^2 - b*ab + b*b^2
= a^3 - a^2b + ab^2 + a^2b - ab^2 + b^3
= a^3 + b^3The four middle terms cancel in pairs: -a^2b with +a^2b, and +ab^2 with -ab^2. Only the two cubes remain. The difference formula works the same way with the signs flipped.
This also explains the shape of the trinomial. It is the unique quadratic that cancels every middle term when multiplied by (a + b) or (a - b).
Recognizing a cube
Before applying a formula, check that each term is a perfect cube. Two conditions must hold:
- The coefficient is a perfect cube: 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, and so on.
- Each variable exponent is a multiple of 3: x^3, x^6, x^9, and so on. The cube root of x^6 is x^2, because (x^2)^3 = x^6.
| Term | Cube root | Why |
|---|---|---|
| 8x^3 | 2x | (2x)^3 = 8x^3 |
| 27 | 3 | 3^3 = 27 |
| x^6 | x^2 | (x^2)^3 = x^6 |
| 64y^9 | 4y^3 | (4y^3)^3 = 64y^9 |
| 10x^3 | none | 10 is not a perfect cube |
| x^4 | none | 4 is not a multiple of 3 |
Procedure
- Factor out any GCF first.
- Check that the remaining expression has exactly two terms.
- Check that both terms are perfect cubes, and find a and b (the cube roots).
- Note whether the middle sign is + (sum) or - (difference), then write the matching formula.
- Substitute a and b into the formula. Put parentheses around each substituted value before squaring or multiplying.
- Check whether the trinomial factor can be factored further.
- Verify by expanding.
Worked examples
Example 1: a sum with a numeric cube
Factor x^3 + 125.
Here a = x and b = 5, because 5^3 = 125. The expression is a sum, so use the sum formula.
x^3 + 125 = (x + 5)(x^2 - 5x + 25)The middle term of the trinomial is ab = x5 = 5x, with a minus sign. The last term is b^2 = 25.
Example 2: a difference with coefficients
Factor 8x^3 - 27.
Here a = 2x, because (2x)^3 = 8x^3, and b = 3. Compute each trinomial term separately:
a^2 = (2x)^2 = 4x^2
ab = (2x)(3) = 6x
b^2 = 3^2 = 9
8x^3 - 27 = (2x - 3)(4x^2 + 6x + 9)A frequent mistake is to write a^2 as 2x^2 instead of 4x^2. Substituting 2x in parentheses prevents it.
Example 3: GCF first
Factor 2x^3 + 16.
Neither 2 nor 16 is a perfect cube, so the formula does not apply yet. Factor out the GCF 2 first:
2x^3 + 16 = 2(x^3 + 8)
= 2(x + 2)(x^2 - 2x + 4)Always keep the GCF in front of your final answer. Dropping it is a common mistake.
Example 4: variable cubes with higher exponents
Factor 64y^6 - 1.
The cube roots are a = 4y^2 and b = 1.
a^2 = 16y^4
ab = 4y^2
b^2 = 1
64y^6 - 1 = (4y^2 - 1)(16y^4 + 4y^2 + 1)The binomial 4y^2 - 1 is a difference of squares, so it factors further:
64y^6 - 1 = (2y - 1)(2y + 1)(16y^4 + 4y^2 + 1)The quartic trinomial 16y^4 + 4y^2 + 1 does not factor over the integers. Section "Sixth powers" below returns to this kind of case.
Example 5: two variables
Factor 27a^3 + 8b^3.
Here the cube roots are 3a and 2b.
27a^3 + 8b^3 = (3a + 2b)(9a^2 - 6ab + 4b^2)The middle term is (3a)(2b) = 6ab, and the last term is (2b)^2 = 4b^2.
Check with code
SymPy can factor and verify each example. This script factors three expressions from above and confirms that expanding each result gives back the original.
from sympy import symbols, factor, expand
x = symbols('x')
expressions = [
x**3 + 125,
8*x**3 - 27,
2*x**3 + 16,
]
for expr in expressions:
factored = factor(expr)
print(expr, "->", factored, "| check:", expand(factored) == expr)factor factors over the integers and pulls out the GCF automatically. Each line should print True for the check.
Common errors
- Wrong middle sign. In a^3 + b^3 the trinomial has a minus in the middle. In a^3 - b^3 it has a plus. Use SOAP, and test by expanding.
- Treating the trinomial like a perfect square. a^2 - ab + b^2 is not (a - b)^2, which equals a^2 - 2ab + b^2. The middle coefficient is 1, not 2. Because of this, the trinomial from these formulas almost never factors further.
- Cubing the binomial. (a + b)^3 is not a^3 + b^3. For example, (x + 2)^3 = x^3 + 6x^2 + 12x + 8, but x^3 + 8 = (x + 2)(x^2 - 2x + 4).
- Forgetting parentheses when substituting. Writing 2x^2 instead of (2x)^2 gives the wrong first trinomial term.
- Skipping the GCF. An expression like 3x^3 - 24 is only a difference of cubes after you factor out 3.
- Applying the formula to a sum of squares. x^2 + 9 is not a cube pattern, and it does not factor over the integers.
Sixth powers: squares first or cubes first
An expression such as x^6 - 64 fits two patterns. It is a difference of squares, with (x^3)^2 - 8^2. It is also a difference of cubes, with (x^2)^3 - 4^3.
Starting with the difference of squares gives the full factorization quickly:
x^6 - 64 = (x^3 - 8)(x^3 + 8)
= (x - 2)(x^2 + 2x + 4)(x + 2)(x^2 - 2x + 4)Starting with the difference of cubes gives a different first step:
x^6 - 64 = (x^2 - 4)(x^4 + 4x^2 + 16)Both routes can reach the same complete factorization, but the cubes-first route leaves a quartic factor that is hard to see through. The quartic x^4 + 4x^2 + 16 factors as (x^2 + 2x + 4)(x^2 - 2x + 4). You can find this by writing it as (x^2 + 4)^2 - (2x)^2, which is a difference of squares. That trick is rarely needed if you choose well at the start.
Rule of thumb: when an expression is both a difference of squares and a difference of cubes, use the difference of squares first. A sum of sixth powers, such as x^6 + 64, is not a difference of squares, so use the sum of cubes with a = x^2 and b = 4.
Higher exponents that are multiples of 3
An exponent that is a multiple of 3 means you can treat a power as a single cube. For x^9 + 1, write it as (x^3)^3 + 1^3:
x^9 + 1 = (x^3 + 1)(x^6 - x^3 + 1)
= (x + 1)(x^2 - x + 1)(x^6 - x^3 + 1)The first factor x^3 + 1 is itself a sum of cubes, so it factors again. The sextic x^6 - x^3 + 1 does not factor over the integers. Always check whether the binomial factor from your first step is another cube pattern.
Using cubes to solve equations
Factored form makes the zero product property available. Solve x^3 - 8 = 0:
x^3 - 8 = 0
(x - 2)(x^2 + 2x + 4) = 0
x - 2 = 0 or x^2 + 2x + 4 = 0
x = 2The quadratic x^2 + 2x + 4 has discriminant 2^2 - 4(1)(4) = -12, which is negative. It has no real solutions, so the only real solution is x = 2. This matches the fact that the real cube root of 8 is 2. If the problem asks for all solutions in the complex numbers, the quadratic contributes two more. For real-number answers, report x = 2.
Summary of the strategy
Sum and difference of cubes sits in the middle of the general factoring order:
- Factor out the GCF.
- For two terms, test for a difference of squares, then a sum or difference of cubes.
- For three terms, try the trinomial methods and the perfect square pattern.
- For four terms, try grouping.
- Factor each result completely, then expand to check.
A sum of squares is the only common two-term pattern that does not factor. Sums and differences of cubes do factor, and the trinomial that results does not factor again.
Exercise
Factor 64x^3 + 1 completely.
Show answer
The cube roots are a = 4x and b = 1, and the expression is a sum. Then a^2 = 16x^2, ab = 4x, and b^2 = 1. The result is (4x + 1)(16x^2 - 4x + 1). The trinomial does not factor further.
Exercise
Factor 5x^3 - 40 completely.
Show answer
Factor out the GCF 5 first: 5(x^3 - 8). Then x^3 - 8 is a difference of cubes with a = x and b = 2. The result is 5(x - 2)(x^2 + 2x + 4).
Exercise
Factor x^6 - 1 completely over the integers. Which pattern should you use first, and why?
Show answer
Use the difference of squares first, because x^6 - 1 = (x^3)^2 - 1^2. That gives (x^3 - 1)(x^3 + 1). Each factor is a cube pattern: x^3 - 1 = (x - 1)(x^2 + x + 1) and x^3 + 1 = (x + 1)(x^2 - x + 1). The complete factorization is (x - 1)(x + 1)(x^2 + x + 1)(x^2 - x + 1).
Exercise
A student writes x^3 + 8 = (x + 2)^3. Show that this is wrong and give the correct factorization.
Show answer
Expanding (x + 2)^3 gives x^3 + 6x^2 + 12x + 8, which has extra terms and is not x^3 + 8. The correct factorization uses the sum of cubes with a = x and b = 2: x^3 + 8 = (x + 2)(x^2 - 2x + 4).
Exercise
Find all real solutions of 27x^3 + 1 = 0.
Show answer
Factor as a sum of cubes with a = 3x and b = 1: (3x + 1)(9x^2 - 3x + 1) = 0. The first factor gives x = -1/3. The quadratic has discriminant (-3)^2 - 4(9)(1) = -27, which is negative, so it has no real roots. The only real solution is x = -1/3.