Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← Algebra formulas

Sum and difference of cubes

Factor a sum or difference of perfect cubes.

Algebra · Factoring
$$a^3\pm b^3=(a\pm b)(a^2\mp ab+b^2)$$

Sum and difference of cubes is one of 2 factoring formulas in the algebra section of this library, and it is used at high school level.

Why sum and difference of cubes works

Multiplying the binomial by the three-term factor produces six products, and four of them cancel in two pairs. That only happens because the middle term carries a single ab rather than 2ab, and because the sign in front of it is opposite the sign in the binomial. Change either detail and the cancellation stops.

What each symbol means

$a,b$ are the cube roots of the original terms.

Sum and difference of cubes: when it holds

The sign in the quadratic factor is opposite the first sign; its final term is positive.

When it stops applying

Do not try to break the three-term factor down further over the reals. Treated as a quadratic its discriminant works out to -3b squared, which is negative for every nonzero b, so it has no real roots and is already fully factored.

Sum and difference of cubes: a worked example

$x^3-8=(x-2)(x^2+2x+4)$.

The mistake to avoid

What people do: Using the perfect-square trinomial and writing a cubed minus b cubed as (a - b)(a squared - 2ab + b squared).

Why it goes wrong: That product is really (a - b) cubed, an entirely different expression. The extra 2 leaves leftovers where the cancellation was supposed to be clean.

Do this instead: Remember the three-term factor has no coefficient on the middle term, and its sign is the opposite of the binomial's, while its last term is always added.

Sum and difference of cubes: step by step

  1. Name the unknown, and the unit the answer has to come out in.
  2. Match the symbols to your values. $a,b$ are the cube roots of the original terms.
  3. Check the conditions before substituting. The sign in the quadratic factor is opposite the first sign; its final term is positive.
  4. Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most algebra slips.

Where this formula fits

Subject
Algebra formulas — 28 entries in this library
Topic
Factoring
Level
High school

Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where sum and difference of cubes comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.

Questions about sum and difference of cubes

How do I keep the signs straight?

Copy the sign of the original problem into the binomial, flip it for the middle term of the trinomial, and always make the last term positive. So x cubed - 8 becomes (x - 2)(x squared + 2x + 4).

Does a sum of cubes really factor, when a sum of squares does not?

Yes, and that surprises most students. Expanding (x + 2)(x squared - 2x + 4) returns x cubed + 8 exactly, because a cube keeps the sign of its base while a square does not.

What do I do with something that is both a square and a cube, like x to the sixth minus 64?

Split it as a difference of squares first. That gives (x cubed - 8)(x cubed + 8), and each bracket then splits again, ending at (x - 2)(x + 2)(x squared - 2x + 4)(x squared + 2x + 4).

Why is there no 2 in front of the ab term?

Because this trinomial is not a perfect square. Its job is to supply terms that cancel against the binomial's expansion, and a coefficient of 2 would leave one copy of a squared b uncancelled.

Stuck on a problem?

Work a sum and difference of cubes problem step by step

Type your own problem, or upload a photo of it. You get the method, the answer, and a check you can repeat yourself.