How to Factor the Difference of Cubes: Formula & Practice Problems

Instructor: Joshua White

Josh has worked as a high school math teacher for seven years and has undergraduate degrees in Applied Mathematics (BS) & Economics/Physics (BA).

Learn how to determine if an expression can be factored as a difference of cubes and also how to use the difference of cubes formula to factor these types of expressions.


Occasionally, you may come across expressions with only two terms of opposite signs that can't be factored as a difference of squares. An example might be x^3 - 27 or 2y^3 - 16. However, it is possible that these expressions may be factored as a difference of cubes, which is a two-term expression where the terms have opposite signs and are each cubes. A special formula is used to factor a difference of cubes.

Difference of Cubes formula

Is an Expression a Difference of Cubes?

To be factored as a difference of cubes, the expression must have only two terms with opposite signs. In other words, one term must be positive and one term must be negative. If both signs are the same, you might try to factor it as a sum of cubes. Additionally, each term must be a cube or the result of multiplying the same expression by itself three times. For example, x^3 is a cube since if you multiply x by itself 3 times, i.e. x*x*x or (x)^3, you end up with x^3. Similarly, 64 is a cube since it is equal to 4*4*4 or (4)^3. Cubes can also have both numbers and variables. 8y^6 is a cube because the expression (2y^2) (2y^2) (2y^2) will yield 8y^6. For example, 5x^3 and 27y^4 are not cubes because 5 is not a cube and y^4 is not a cube. Note that every part of a term must be a cube. If those two criteria are met, then it's time to take a look at how the difference of cubes formula is used to factor the expression.

How to Factor a Difference of Cubes

To factor an expression as a difference of cubes you will use the formula mentioned earlier:

Difference of Cubes formula


Can the following expressions be factored as a difference of cubes?

Example 1: x^3 - 27. Yes, the terms have opposite signs and we can easily think of expressions that will cube to give x^3 (x) and 27 (3). Since you now have a=x and b=3, you can rewrite the original problem as (x)^3 - (3)^3. Plugging these values into the formula gives (x - 3) (x^2 + (x)(3) + 3^2). Simplifying (x)(3) to 3x and 3^2 to 9 gives a final answer of (x - 3) (x^2 + 3x +9).

Example 2: x^4 - 8. While both terms do have opposite signs, x^4 is not a perfect cube. Therefore, this expression cannot be factored as a difference of cubes.

Example 3: -y^3 + 1. The terms do have opposite signs and you should be able to recognize y^3 and 1 as cubes of y and 1, respectively. However, notice that the terms appear out of order with the '-' sign in the front, instead of between the terms. That's fine; we can simply change the order of the terms to 1 - y^3 and then use the difference of cubes formula to factor it. 1 - y^3 = (1)^3 - (y)^3 = (1 - y) (1^2 + (1)(y) + y^2) = (1 - y) (1 + y + y^2).

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create An Account