Algebra
Intermediate

Difference of Cubes

Factoring formula for a difference of two cubes.

Formula

a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a-b)(a^2 + ab + b^2)

Live Calculator

Members

Variables

a,bTerms

Example

27-8 = (3-2)(9+6+4) = 19

How it works

A difference of cubes is a special factoring pattern that rewrites a subtraction like a^3 - b^3 into a product of simpler expressions. It works because expanding (a-b)(a^2+ab+b^2) gives a^3 + a^2b + ab^2 - a^2b - ab^2 - b^3, so the middle terms cancel and only a^3 - b^3 remains. This makes it useful for turning a complicated polynomial into factors that are easier to simplify, solve, or analyze.

When to use it

Use this formula when you see two perfect cubes being subtracted, especially in algebra problems where you need to factor a polynomial. It is also helpful when simplifying rational expressions or solving equations that contain cubic terms.

Worked example, step by step

Factor 64 - 125 64 = 4^3 and 125 = 5^3, so this is a^3 - b^3 with a = 4 and b = 5 Apply the formula: a^3 - b^3 = (a-b)(a^2 + ab + b^2) = (4-5)(4^2 + 4·5 + 5^2) = (-1)(16 + 20 + 25) = (-1)(61) = -61

Common mistakes to avoid

  • Forgetting that the second factor is a^2 + ab + b^2, not a^2 - ab + b^2
  • Using the formula on terms that are not perfect cubes
  • Missing the sign change when a < b, which can make the final product negative

Did You Know?

Difference of cubes factors neatly, but difference of two squares is even simpler — a fact ancient Babylonians exploited to multiply.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026