‹ Back to Xavier's Dig Site

Difference of Cubes

How to factor a³ − b³, why the formula works, and how to use it to solve equations.

1. The formula

a³ − b³ = (a − b)(a² + ab + b²)

To remember the signs, use SOAP:

LetterMeaningIn the formula
SSame sign(a − b) uses the same sign as the original
OOpposite signa² + ab is the opposite of the original
APAlways positive+ b² is always plus

2. Step by step

  1. Pull out a GCF first if the terms share one.
  2. Check that both terms are perfect cubes and that there's a minus between them.
  3. Find a and b by taking the cube root of each term.
  4. Write the binomial (a − b).
  5. Write the trinomial (a² + ab + b²): square a, multiply a times b, square b.
  6. Check by multiplying the factors back out.
  7. To solve an equation (= 0), set each factor equal to 0.

Perfect cubes worth memorizing

n123456710
n³1827641252163431000

For variables, the exponent has to be a multiple of 3: x³ = (x)³, x⁶ = (x²)³, x⁹ = (x³)³.

3. Examples

Example 1: x³ − 8

  1. No GCF.
  2. x³ is a cube, and 8 = 2³.
  3. a = x, b = 2
  4. Binomial: (x − 2)
  5. Trinomial: x² + (x)(2) + 2² = x² + 2x + 4
  6. x³ − 8 = (x − 2)(x² + 2x + 4)

Check by multiplying. Each box is one term times one term.

×x²+2x+4
xx³2x²4x
−2−2x²−4x−8

Same colors cancel: 2x² − 2x² = 0 and 4x − 4x = 0. Only x³ − 8 is left ✓

Example 2: 27x³ − 64

  1. No GCF.
  2. 27x³ = (3x)³ and 64 = 4³
  3. a = 3x, b = 4
  4. Binomial: (3x − 4)
  5. Trinomial: (3x)² + (3x)(4) + 4² = 9x² + 12x + 16
  6. 27x³ − 64 = (3x − 4)(9x² + 12x + 16)
Common mistakeWriting 3x² instead of (3x)² = 9x². Square the whole a, coefficient included.

Example 3: 2x³ − 54 (GCF first)

  1. GCF is 2: 2(x³ − 27)
  2. x³ and 27 = 3³ are both cubes.
  3. a = x, b = 3
  4. x³ − 27 = (x − 3)(x² + 3x + 9)
  5. 2x³ − 54 = 2(x − 3)(x² + 3x + 9)
Why the GCF matters54 isn't a perfect cube, so without pulling out the 2 first you'd get stuck.

Example 4: 8y³ − 125z³ (two variables)

  1. 8y³ = (2y)³ and 125z³ = (5z)³
  2. a = 2y, b = 5z
  3. Trinomial: (2y)² + (2y)(5z) + (5z)² = 4y² + 10yz + 25z²
  4. (2y − 5z)(4y² + 10yz + 25z²)
Not a difference of cubes?x³ − 10 can't use this formula because 10 isn't a perfect cube. x² − 8 can't either, because x² isn't a cube.

4. Why it works (picture)

Start with a big cube with side a. Its volume is a³. Cut out a small cube with side b from one corner. What's left has volume a³ − b³.

That leftover solid can be sliced into three boxes, each with thickness (a − b):

  • a box of a × a × (a − b) = a²(a − b)
  • a box of a × b × (a − b) = ab(a − b)
  • a box of b × b × (a − b) = b²(a − b)

Add them and factor out (a − b):

a³ − b³ = (a − b)(a² + ab + b²)

A cube of side a with a corner cube of side b removed (the orange hollow is the missing b³)

5. Solving an equation: x³ − 8 = 0

  1. Factor: (x − 2)(x² + 2x + 4) = 0
  2. Set the binomial to 0: x − 2 = 0, so x = 2
  3. Set the trinomial to 0 and use the quadratic formula:
    x = (−2 ± √(4 − 16)) / 2 = (−2 ± √−12) / 2 = −1 ± i√3
  4. Answer: the real solution is x = 2. The other two are complex.
Good to knowThe trinomial from a difference of cubes never factors further over the real numbers (when a and b have no common factor). Its discriminant is always negative, so don't spend time trying to factor it.

6. Related: sum of cubes

SOAP works the same way with a plus sign:

a³ + b³ = (a + b)(a² − ab + b²)

Example: x³ + 125 = (x + 5)(x² − 5x + 25)

7. Try it yourself

Pick the parts of the expression and see each factoring step.