Polynomials & Factoring

Factoring Sum and Difference of Cubes

The sum of cubes factors as a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2), and the difference of cubes factors as a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a - b)(a^2 + ab + b^2).

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

Both patterns turn two cubed terms into a binomial times a trinomial, and the trinomial stops there. The sections below show why the patterns work, which traps cost the most points (a missed common factor, a sixth power, a doubled middle term), and quick ways to verify an answer in seconds.

What are the sum and difference of cubes formulas?

Here are the two patterns side by side:

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

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

The letters aa and bb stand for whatever is being cubed: a number, a variable, or a product like 4xy24xy^2. These belong to the family of special products of binomials, but unlike squares, a cube pattern works for both the sum and the difference.

The signs follow SOAP: Same, Opposite, Always Positive. The binomial keeps the sign of the original expression, the middle sign of the trinomial is the opposite one, and the last sign is always positive. The trinomial’s outer terms are a2a^2 and b2b^2, which can never be negative, so a minus sign in front of b2b^2 is an instant red flag.

Expression Binomial factor Trinomial factor
a3+b3a^3 + b^3 a+ba + b a2−ab+b2a^2 - ab + b^2
a3−b3a^3 - b^3 a−ba - b a2+ab+b2a^2 + ab + b^2

Before using either pattern, confirm that both terms are perfect cubes. The coefficient must be one of 1,8,27,64,125,216,343,512,729,10001, 8, 27, 64, 125, 216, 343, 512, 729, 1000, and every variable exponent must be a multiple of 33. So 8x38x^3 and x9=(x3)3x^9 = (x^3)^3 qualify, but 4x34x^3 and x5x^5 do not.

Quick check

What is the quadratic factor of m3−n3m^3 - n^3?

Why does the cube factoring pattern work?

The quickest proof is to multiply it out. The trinomial is designed so that every middle term cancels:

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

The −a2b-a^2b cancels with +a2b+a^2b, and +ab2+ab^2 cancels with −ab2-ab^2. If you want practice with that expansion, multiplying polynomials covers the distributing step in detail.

There is a second way to see it, and it explains where the trinomial comes from. If a=ba = b, then a3−b3=0a^3 - b^3 = 0, so a−ba - b must be a factor, which is exactly what the factor theorem says. Divide a3−b3a^3 - b^3 by a−ba - b and the quotient is a2+ab+b2a^2 + ab + b^2. The same reasoning with a=−ba = -b gives the factor a+ba + b for the sum.

One formula is enough

Replace bb with −b-b in a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a - b)(a^2 + ab + b^2). Since (−b)3=−b3(-b)^3 = -b^3, you get a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2). Memorize one pattern and the other follows.

How do you factor a sum or difference of cubes?

The test is simple: two terms, both perfect cubes, joined by a plus or minus sign. The process has five steps:

  1. Take out any common factor first.
  2. Rewrite each term as something cubed.
  3. Read off aa and bb, the cube roots.
  4. Substitute into the matching formula, keeping aa and bb inside parentheses.
  5. Simplify, and stop. The trinomial will not factor.

Example 1. Factor 8x3+278x^3 + 27.

Here 8x3=(2x)38x^3 = (2x)^3 and 27=3327 = 3^3, so a=2xa = 2x and b=3b = 3. The plus sign calls for the sum of cubes:

8x3+27=(2x+3)((2x)2−(2x)(3)+32)=(2x+3)(4x2−6x+9)8x^3 + 27 = (2x + 3)\big((2x)^2 - (2x)(3) + 3^2\big) = (2x + 3)(4x^2 - 6x + 9)

The parentheses in step 4 prevent the most common slip: writing (2x)2(2x)^2 as 2x22x^2 instead of 4x24x^2. With two variables the method is identical. For 64x3−125y364x^3 - 125y^3, take a=4xa = 4x and b=5yb = 5y to get (4x−5y)(16x2+20xy+25y2)(4x - 5y)(16x^2 + 20xy + 25y^2), where the middle term is (4x)(5y)=20xy(4x)(5y) = 20xy.

Factoring cubes with a GCF, negatives or fractions

Many expressions hide their cubes behind a common factor. If the coefficients are not perfect cubes, check for a GCF before giving up. Factoring out the GCF first is also a rule for every cube problem, because it keeps the numbers small.

Example 2. Factor 3x3+1923x^3 + 192.

Neither 33 nor 192192 is a cube, but 192=3⋅64192 = 3 \cdot 64. Pull out the 33:

3x3+192=3(x3+64)=3(x3+43)=3(x+4)(x2−4x+16)3x^3 + 192 = 3(x^3 + 64) = 3(x^3 + 4^3) = 3(x + 4)(x^2 - 4x + 16)

The 33 stays in front of the final answer. Dropping it is one of the most common ways to lose a point. A variable can be a hidden GCF too: x4+x=x(x3+1)=x(x+1)(x2−x+1)x^4 + x = x(x^3 + 1) = x(x + 1)(x^2 - x + 1).

When the cube term comes second, as in 125−8x3125 - 8x^3, treat the expression as 53−(2x)35^3 - (2x)^3. Then a=5a = 5 and b=2xb = 2x:

125−8x3=(5−2x)(25+10x+4x2)125 - 8x^3 = (5 - 2x)(25 + 10x + 4x^2)

For fractions, you can cube the fraction directly or factor out the fraction first. Using the first approach, x38−1=(x2)3−13=(x2−1)(x24+x2+1)\frac{x^3}{8} - 1 = \left(\frac{x}{2}\right)^3 - 1^3 = \left(\frac{x}{2} - 1\right)\left(\frac{x^2}{4} + \frac{x}{2} + 1\right). Using the second, 18(x3−8)=18(x−2)(x2+2x+4)\frac{1}{8}(x^3 - 8) = \frac{1}{8}(x - 2)(x^2 + 2x + 4). Both are the same expression, since x2−1=x−22\frac{x}{2} - 1 = \frac{x - 2}{2} and x24+x2+1=x2+2x+44\frac{x^2}{4} + \frac{x}{2} + 1 = \frac{x^2 + 2x + 4}{4}.

Sixth powers: difference of squares or cubes first?

Comparison of factoring x⁶ − 64 squares first versus cubes first, showing the quartic detour
Squares first splits x⁶ − 64 into two cube patterns, while cubes first leaves a quartic that needs a hidden square trick.

An expression like x6−64x^6 - 64 is both a difference of squares and a difference of cubes, because x6=(x3)2=(x2)3x^6 = (x^3)^2 = (x^2)^3. Both routes are legal, but only one is easy. The rule: squares first.

Example 3. Factor x6−64x^6 - 64 completely.

Using squares first, x6−64=(x3)2−82=(x3−8)(x3+8)x^6 - 64 = (x^3)^2 - 8^2 = (x^3 - 8)(x^3 + 8). Each piece is now a cube pattern:

x6−64=(x−2)(x2+2x+4)(x+2)(x2−2x+4)x^6 - 64 = (x - 2)(x^2 + 2x + 4)(x + 2)(x^2 - 2x + 4)

Using cubes first, x6−64=(x2)3−43=(x2−4)(x4+4x2+16)x^6 - 64 = (x^2)^3 - 4^3 = (x^2 - 4)(x^4 + 4x^2 + 16). The first factor splits as (x−2)(x+2)(x - 2)(x + 2), but the quartic looks stuck. It is not: x4+4x2+16=(x2+4)2−(2x)2=(x2+2x+4)(x2−2x+4)x^4 + 4x^2 + 16 = (x^2 + 4)^2 - (2x)^2 = (x^2 + 2x + 4)(x^2 - 2x + 4). That is the same answer, but you needed a difference of two squares hidden inside a perfect-square rewrite. Starting with squares avoids that detour.

A sum of sixth powers behaves differently. x6+64x^6 + 64 is not a difference of squares, so only the cube route exists: (x2)3+43=(x2+4)(x4−4x2+16)(x^2)^3 + 4^3 = (x^2 + 4)(x^4 - 4x^2 + 16). That quartic equals (x2+4)2−12x2(x^2 + 4)^2 - 12x^2, and since 1212 is not a perfect square, it does not factor over the integers. Stop there.

Quick check

Factor x6−1x^6 - 1 completely over the integers.

Why the trinomial in a sum of cubes never factors

Treat a2−ab+b2a^2 - ab + b^2 as a quadratic in aa. Its discriminant is (−b)2−4(1)(b2)=−3b2(-b)^2 - 4(1)(b^2) = -3b^2, which is negative for every real bb except 00. A negative discriminant means no real roots, so no real linear factors. The same calculation works for a2+ab+b2a^2 + ab + b^2.

A hidden identity

Expanding (a+b)3(a + b)^3 and subtracting 3ab(a+b)3ab(a + b) leaves a3+b3a^3 + b^3. So a3+b3=(a+b)3−3ab(a+b)a^3 + b^3 = (a + b)^3 - 3ab(a + b), which shows why a3+b3a^3 + b^3 is not simply (a+b)3(a + b)^3.

Students often waste time hunting for factors of the trinomial anyway. For x2−3x+9x^2 - 3x + 9, you would need two numbers that multiply to 99 and add to −3-3, and none exist. If you want to see how the discriminant decides this, quadratic formula practice problems work through that test, and factoring trinomials shows what a trinomial that does split looks like.

Two look-alikes cause most of the confusion. A perfect square trinomial has a middle coefficient of 22, as in a2−2ab+b2=(a−b)2a^2 - 2ab + b^2 = (a - b)^2. The cube trinomial has a middle coefficient of 11, so it is never a perfect square. And (a+b)3=a3+3a2b+3ab2+b3(a + b)^3 = a^3 + 3a^2b + 3ab^2 + b^3 comes from the binomial theorem, not from the sum of cubes pattern.

Solving equations and simplifying fractions with cubes

Factoring turns a cubic equation into a product that equals zero. To solve x3−27=0x^3 - 27 = 0:

x3−27=(x−3)(x2+3x+9)=0x^3 - 27 = (x - 3)(x^2 + 3x + 9) = 0

The first factor gives x=3x = 3. The quadratic has discriminant 9−36=−279 - 36 = -27, so the other two solutions are complex: x=−3±3i32x = \frac{-3 \pm 3i\sqrt{3}}{2}. Every nonzero number has exactly one real cube root and two complex ones, and the trinomial is where the complex pair lives. The rational root theorem would find x=3x = 3 from a list of candidates, but the formula gives you the full factorization without any trial and error.

Cube patterns also simplify rational expressions. Factor the top and bottom, then cancel:

x3−8x2−4=(x−2)(x2+2x+4)(x−2)(x+2)=x2+2x+4x+2,x≠±2\frac{x^3 - 8}{x^2 - 4} = \frac{(x - 2)(x^2 + 2x + 4)}{(x - 2)(x + 2)} = \frac{x^2 + 2x + 4}{x + 2}, \quad x \neq \pm 2

Test at x=1x = 1: the original gives −7−3=73\frac{-7}{-3} = \frac{7}{3}, and the simplified form gives 73\frac{7}{3}. This cancellation is exactly the step used in calculus limits like x→2x \to 2, where the simplified form shows the limit is 124=3\frac{12}{4} = 3.

Real use: the volume of a hollow cube

Area model showing s³ − t³ as three slabs of height s − t with bases s², st, t²
With s = 3 and t = 1, the three slab bases 9, 3 and 1 each stand 2 tall, giving 26 exactly as 27 − 1 does.

Picture a cube with side ss and a cube-shaped cavity of side tt cut out of one corner. The material left has volume s3−t3s^3 - t^3, and the formula gives it in a more useful shape:

s3−t3=(s−t)(s2+st+t2)s^3 - t^3 = (s - t)(s^2 + st + t^2)

The three terms in the trinomial are areas of three slabs. Each slab has height s−ts - t, and their bases are s×ss \times s, s×ts \times t and t×tt \times t. Together they make up the whole shell, with no overlap.

Try s=10s = 10 and t=4t = 4. Direct subtraction gives 1000−64=9361000 - 64 = 936. The factored form gives (10−4)(100+40+16)=6⋅156=936(10 - 4)(100 + 40 + 16) = 6 \cdot 156 = 936. The two methods agree, and the factored form is the one engineers use when s−ts - t is a known wall thickness.

The sum pattern has a neat numeric use as well. Since 1001=103+11001 = 10^3 + 1, it factors as (10+1)(100−10+1)=11⋅91=7⋅11⋅13(10 + 1)(100 - 10 + 1) = 11 \cdot 91 = 7 \cdot 11 \cdot 13. Any number just above or below a perfect cube can often be split this way.

Quick check

A solid cube of side 99 cm has a cube of side 55 cm cut out of it. Use (s−t)(s2+st+t2)(s - t)(s^2 + st + t^2) to find the remaining volume.

How do you check a sum or difference of cubes answer?

Three quick checks catch nearly every error:

  • Substitute an easy number such as x=1x = 1 into both the original and your answer. They must match. For Example 1, 8+27=358 + 27 = 35 and (2+3)(4−6+9)=5⋅7=35(2 + 3)(4 - 6 + 9) = 5 \cdot 7 = 35.
  • Scan the signs. The trinomial’s outer terms must be positive, and its middle term must be the product of the two binomial pieces, with the opposite sign from the binomial.
  • Test the root. The binomial factor gives a root of the original expression, so x=3x = 3 should make x3−27x^3 - 27 equal to zero. Synthetic division by x−3x - 3 gives the coefficients 1,3,91, 3, 9 with remainder 00, which is exactly the trinomial x2+3x+9x^2 + 3x + 9.

Avoid x=0x = 0 as your test value. It only checks the constant term, so a wrong sign in the middle of the trinomial would slip through. Use x=1x = 1, then x=−1x = -1 if you want a second confirmation.

Try this: Factor x3+1000x^3 + 1000, then check your answer at x=1x = 1. The left side should equal 10011001, which is 11⋅9111 \cdot 91.

For mixed sets that combine cubes with grouping, trinomials and squares, work through factoring practice problems and decide which pattern fits before you start.

Practice problems

0 of 5 solved

  1. Factor x3+27x^3 + 27.

  2. Factor y3−125y^3 - 125.

  3. Factor 64x3+164x^3 + 1.

  4. Factor 2x3+2502x^3 + 250.

  5. Factor 16x4−54x16x^4 - 54x completely.

Common questions

What is the formula for the sum and difference of cubes?

The sum of cubes is a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2) and the difference of cubes is a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a - b)(a^2 + ab + b^2). Each one turns a two-term expression into a binomial times a trinomial.

How do you remember the signs in the cubes formulas?

Use SOAP: the binomial has the Same sign as the original expression, the trinomial's middle sign is Opposite, and its last term is Always Positive. The pattern works because the cross terms must cancel when you multiply back.

Can you factor a sum of squares like a2+b2a^2 + b^2?

Not over the real numbers. A sum of cubes does factor, but a sum of squares stays prime unless you allow complex numbers, where a2+b2=(a+bi)(a−bi)a^2 + b^2 = (a + bi)(a - bi).

Can the trinomial in a sum or difference of cubes be factored further?

Not with real numbers. Treated as a quadratic, its discriminant is −3b2-3b^2, which is negative for every real bb other than 00, so it has no real roots and no real linear factors.

How do you factor x6−y6x^6 - y^6?

Start with the difference of squares: (x3−y3)(x3+y3)(x^3 - y^3)(x^3 + y^3). Then factor each piece as a difference and a sum of cubes, which gives four factors in total.

What if the coefficients are not perfect cubes?

Look for a common factor first. In 3x3+1923x^3 + 192, neither 33 nor 192192 is a cube, but 3(x3+64)3(x^3 + 64) leaves a perfect cube inside the parentheses.

Up next