Sum and Difference of Cubes

The sum and difference of cubes are two factoring patterns. A sum of cubes factors as a^3 + b^3 = (a + b)(a^2 - ab + b^2), and a difference of cubes factors as a^3 - b^3 = (a - b)(a^2 + ab + b^2). To use them, write each term as something cubed, find a and b, and substitute.

Before this lesson: You should know Factoring Out the GCF, Factoring the Difference of Squares, Cube Roots and Multiplying Polynomials.

Spotting a Sum or Difference of Cubes

A perfect cube is something times itself three times, like 8 = 2^3 or 27x^3 = (3x)^3. A sum of cubes is two perfect cubes added. A difference of cubes is one perfect cube minus another.

n12345678910
n^31827641252163435127291000

Variables are cubes when the exponent is a multiple of 3, like x^3 or y^6 = (y^2)^3.

The Formulas

a^3 + b^3 = (a + b)(a^2 - ab + b^2)
a^3 - b^3 = (a - b)(a^2 + ab + b^2)

Both formulas have the same shape: a binomial times a trinomial. Only the signs change. The word SOAP helps you remember them.

The difference of cubes formula a^3 − b^3 = (a − b)(a^2 + ab + b^2) with its three signs labeled. The first sign in the factors matches the original sign and is labeled Same. The second sign is labeled Opposite. The last sign is always plus and is labeled Always Positive. Below, the sum of cubes formula shows the same pattern: plus, minus, plus.
SOAP: the first sign is the Same, the second is Opposite, and the last is Always Positive.

You can check either formula by multiplying. For the difference: (a - b)(a^2 + ab + b^2) = a^3 + a^2b + ab^2 - a^2b - ab^2 - b^3. The middle terms cancel, leaving a^3 - b^3.

Worked Examples

Example 1: A sum of cubes

Factor x^3 + 27.

  1. Write each term as a cube (see cube roots): x^3 + 3^3
  2. Name the parts: a = x and b = 3
  3. Write the sum of cubes formula: (a + b)(a^2 - ab + b^2)
  4. Substitute: (x + 3)(x^2 - x \cdot 3 + 3^2)
  5. Simplify the trinomial: (x + 3)(x^2 - 3x + 9)

Answer: (x + 3)(x^2 - 3x + 9)

Example 2: A difference of cubes with a coefficient

Factor 8y^3 - 125.

  1. Write each term as a cube (see exponent rules): (2y)^3 - 5^3
  2. Name the parts: a = 2y and b = 5
  3. Write the difference of cubes formula: (a - b)(a^2 + ab + b^2)
  4. Substitute: (2y - 5)((2y)^2 + 2y \cdot 5 + 5^2)
  5. Simplify the trinomial: (2y - 5)(4y^2 + 10y + 25)

Answer: (2y - 5)(4y^2 + 10y + 25)

Example 3: Factor out the GCF first

Factor 2x^4 + 54x completely.

  1. Factor out the GCF, 2x (see factoring out the GCF): 2x(x^3 + 27)
  2. Write the sum as cubes: 2x(x^3 + 3^3)
  3. Use the sum of cubes formula with a = x, b = 3: 2x(x + 3)(x^2 - 3x + 9)

Answer: 2x(x + 3)(x^2 - 3x + 9). The trinomial does not factor any further with real numbers.

Example 4: Two variables

Factor 64m^3 - 27n^3.

  1. Write each term as a cube: (4m)^3 - (3n)^3
  2. Name the parts: a = 4m and b = 3n
  3. Substitute into the difference formula: (4m - 3n)((4m)^2 + 4m \cdot 3n + (3n)^2)
  4. Simplify the trinomial: (4m - 3n)(16m^2 + 12mn + 9n^2)

Answer: (4m - 3n)(16m^2 + 12mn + 9n^2)

Example 5: Word problem with a hollowed cube

A wooden cube has edges of x inches. A cube with 2-inch edges is cut out of one corner. Write the remaining volume in factored form, then find it when x = 5.

  1. Subtract the volumes: x^3 - 2^3 = x^3 - 8
  2. Name the parts: a = x and b = 2
  3. Use the difference of cubes formula: (x - 2)(x^2 + 2x + 4)
  4. Substitute x = 5: (5 - 2)(5^2 + 2(5) + 4)
  5. Simplify inside the parentheses: (3)(25 + 10 + 4)
  6. Add: 3(39)
  7. Multiply: 117

Answer: The volume is (x - 2)(x^2 + 2x + 4) cubic inches, which is 117 cubic inches when x = 5. Check: 5^3 - 8 = 125 - 8 = 117.

Common Mistakes

MistakeExample of the errorFix
Treating it like a cube of a sumx^3 + 8 = (x + 2)^3(x + 2)^3 = x^3 + 6x^2 + 12x + 8. Use the formula: (x + 2)(x^2 - 2x + 4).
Wrong middle signx^3 - 8 = (x - 2)(x^2 - 2x + 4)SOAP: the middle sign is the opposite: (x - 2)(x^2 + 2x + 4).
Doubling the middle termx^3 - 8 = (x - 2)(x^2 + 4x + 4)The middle term is ab = 2x, not 2ab.
Forgetting to cube the coefficient8y^3 = (8y)^38y^3 = (2y)^3, since 2^3 = 8.
Factoring the trinomial againTrying to factor x^2 + 2x + 4This trinomial never factors with real numbers. Its discriminant is negative.

Practice Problems

  1. Factor x^3 + 8.
  2. Factor y^3 - 64.
  3. Factor 27x^3 + 1.
  4. Factor 125 - t^3.
  5. Factor 8a^3 + 27b^3.
  6. Factor 3x^3 - 24 completely.
  7. Factor x^4 + 1000x completely.
  8. Factor 216p^3 - 343.
  9. Factor x^6 - 64 completely.
  10. A cube-shaped planter holds 343 cubic inches. Write the equation x^3 - 343 = 0, factor it, and find the edge length x.
Show answers
  1. Cubes: x^3 + 2^3, so a = x and b = 2
    Substitute: (x + 2)(x^2 - x \cdot 2 + 2^2)
    Simplify: (x + 2)(x^2 - 2x + 4)
  2. Cubes: y^3 - 4^3, so a = y and b = 4
    Substitute: (y - 4)(y^2 + y \cdot 4 + 4^2)
    Simplify: (y - 4)(y^2 + 4y + 16)
  3. Cubes: (3x)^3 + 1^3, so a = 3x and b = 1
    Substitute: (3x + 1)((3x)^2 - 3x \cdot 1 + 1^2)
    Simplify: (3x + 1)(9x^2 - 3x + 1)
  4. Cubes: 5^3 - t^3, so a = 5 and b = t
    Substitute: (5 - t)(5^2 + 5 \cdot t + t^2)
    Simplify: (5 - t)(25 + 5t + t^2)
  5. Cubes: (2a)^3 + (3b)^3
    Substitute: (2a + 3b)((2a)^2 - 2a \cdot 3b + (3b)^2)
    Simplify: (2a + 3b)(4a^2 - 6ab + 9b^2)
  6. Factor out 3: 3(x^3 - 8)
    Cubes: 3(x^3 - 2^3)
    Formula: 3(x - 2)(x^2 + 2x + 4)
  7. Factor out x: x(x^3 + 1000)
    Cubes: x(x^3 + 10^3)
    Formula: x(x + 10)(x^2 - 10x + 100)
  8. Cubes: (6p)^3 - 7^3
    Substitute: (6p - 7)((6p)^2 + 6p \cdot 7 + 7^2)
    Simplify: (6p - 7)(36p^2 + 42p + 49)
  9. Write as a difference of squares (see factoring the difference of squares): (x^3)^2 - 8^2 = (x^3 - 8)(x^3 + 8)
    Factor the difference of cubes: x^3 - 8 = (x - 2)(x^2 + 2x + 4)
    Factor the sum of cubes: x^3 + 8 = (x + 2)(x^2 - 2x + 4)
    Answer: (x - 2)(x^2 + 2x + 4)(x + 2)(x^2 - 2x + 4)
  10. Cubes: x^3 - 7^3 = 0
    Factor: (x - 7)(x^2 + 7x + 49) = 0
    First factor: x - 7 = 0, so x = 7
    Second factor: discriminant 7^2 - 4(1)(49)
    Square and multiply: 49 - 196
    Subtract: -147, which is negative, so no real solutions (see the discriminant)
    Answer: the edge is 7 inches

FAQ

What is the formula for the sum of cubes?

a^3 + b^3 = (a + b)(a^2 - ab + b^2). For example, x^3 + 27 = (x + 3)(x^2 - 3x + 9).

What is the formula for the difference of cubes?

a^3 - b^3 = (a - b)(a^2 + ab + b^2). For example, x^3 - 8 = (x - 2)(x^2 + 2x + 4).

What does SOAP stand for?

Same, Opposite, Always Positive. The binomial factor keeps the same sign as the original, the middle term of the trinomial has the opposite sign, and the last term is always positive.

Can the trinomial factor be factored again?

Not with real numbers. Trinomials like x^2 + 2x + 4 have a negative discriminant, so their zeros are complex (see complex solutions of quadratic equations).

Summary

  • Sum of cubes: a^3 + b^3 = (a + b)(a^2 - ab + b^2).
  • Difference of cubes: a^3 - b^3 = (a - b)(a^2 + ab + b^2).
  • Use SOAP for the signs: Same, Opposite, Always Positive.
  • Write each term as a cube first, and factor out any GCF before you start.
  • The middle term is ab, not 2ab, and the trinomial never factors further over the reals.

Previous lesson: Remainder and Factor Theorems

Next lesson: Solving Polynomial Equations

Back to the Algebra 2 Index