๐งฎ Cubic Equation Solver: Roots of ax3 + bx2 + cx + d = 0
By Shihab Mia ยท Updated 2026-07-06
Solve ax3 + bx2 + cx + d = 0. Enter the four coefficients below.
Enter coefficients a, b, c and d to solve the equation.
A cubic equation is any equation written as ax3 + bx2 + cx + d = 0 where a is not zero, and this solver finds all of its roots. Enter the four coefficients a, b, c and d, and it returns up to three solutions (real or complex) plus the discriminant that tells you what kind of roots to expect. Every cubic has exactly three roots counted with multiplicity, and at least one of them is always real, so you always get a usable answer.
What is the Cubic Equation Solver?
A cubic, or third-degree polynomial, equation has the general form ax3 + bx2 + cx + d = 0 with a not equal to 0. Unlike a quadratic, which can have no real roots at all, a cubic always crosses the x-axis at least once because its graph runs from negative infinity to positive infinity (or the reverse). That guarantees at least one real root. The remaining two roots are either both real or a pair of complex conjugates, and the discriminant is what decides which case you are in.
This solver follows Cardano's method. First it divides through by a to get a monic equation x3 + px2 + qx + r = 0. Then it removes the squared term with the substitution x = t - p/3, producing a depressed cubic t3 + ft + g = 0 that is far easier to handle. The sign of the discriminant D = g2/4 + f3/27 then decides everything: a positive D means one real root and two complex conjugates, a zero D means all roots are real with at least two of them equal, and a negative D means three distinct real roots.
For the three-distinct-real case, the radical version of Cardano's formula would force you to take cube roots of complex numbers even though the answers are real, the situation known as casus irreducibilis. To avoid that, the tool switches to the trigonometric (Vieta) form t = 2 sqrt(-f/3) cos(theta/3 - 2 pi k/3), which returns all three real roots cleanly. The constant p/3 is then added back to convert each t into the original x.
If you prefer to solve by hand, most textbook cubics factor. The rational root theorem says any rational root has the form p/q where p divides the constant term d and q divides the leading coefficient a. You test those candidates until one gives zero, then use synthetic division to divide out the factor (x - r), which leaves a quadratic you finish with the quadratic formula. This solver uses the general algebraic method instead, so it works even when the roots are irrational or complex and no rational root exists.
Vieta's formulas give a fast sanity check on any answer. For ax3 + bx2 + cx + d = 0 with roots r1, r2 and r3, the sum of the roots equals -b/a, the sum of the products of roots taken two at a time equals c/a, and the product of all three roots equals -d/a. If your three roots do not add up to -b/a and multiply to -d/a, at least one of them is wrong. This is also how you can reconstruct a cubic from its roots by expanding a(x - r1)(x - r2)(x - r3).
Graphically, the roots are exactly the x-intercepts of the curve y = ax3 + bx2 + cx + d. A cubic with three distinct real roots crosses the axis three times; a repeated root shows up as a point where the curve touches or flattens against the axis; and a single real root with two complex roots crosses only once. Reading the discriminant tells you the shape of the graph before you plot a single point.
When to use it
- Finding where a cubic function crosses the x-axis when graphing or analysing a curve.
- Solving for equilibrium points or break-even quantities in economics models that produce a third-degree polynomial.
- Checking algebra, precalculus and calculus homework or exam answers for cubic problems.
- Locating the real root of a cubic that comes out of a physics, engineering or volume calculation.
- Computing roots for chemistry problems such as equilibrium concentrations that reduce to a cubic in x.
- Reconstructing or verifying a polynomial from known roots using Vieta relationships.
How to use the Cubic Equation Solver
- Enter coefficient a, the multiplier of x3. If a is 0 the tool solves the lower-degree equation instead.
- Enter coefficient b, the multiplier of x2. A missing x2 term means b = 0.
- Enter coefficient c, the multiplier of x. A missing x term means c = 0.
- Enter the constant term d.
- Read off the up-to-three roots and the discriminant, which update instantly as you type. Complex roots appear in a + bi form.
Formula & method
Worked examples
Solve x3 - 6x2 + 11x - 6 = 0 (a = 1, b = -6, c = 11, d = -6).
- Already monic, so p = -6, q = 11, r = -6.
- Depress: f = q - p2/3 = 11 - 36/3 = 11 - 12 = -1.
- g = 2p3/27 - pq/3 + r = 2(-216)/27 - (-6)(11)/3 - 6 = -16 + 22 - 6 = 0.
- Discriminant D = g2/4 + f3/27 = 0 + (-1)/27 = -0.037, which is negative, so three distinct real roots.
- Trigonometric form gives t = 2, 1, -1, then x = t - p/3 = t + 2.
- Roots x = 3, 2, 1. Vieta check: 1 + 2 + 3 = 6 = -b/a and 1 * 2 * 3 = 6 = -d/a. Correct.
Result: Three real roots: x = 1, x = 2, x = 3
Solve x3 - 8 = 0 (a = 1, b = 0, c = 0, d = -8).
- Monic already, p = 0, q = 0, r = -8, so the cubic is already depressed: t3 - 8 = 0.
- Here f = 0 and g = -8, so D = g2/4 + f3/27 = 64/4 = 16, which is positive.
- One real root: t = cbrt(-g/2 + sqrt(D)) + cbrt(-g/2 - sqrt(D)) = cbrt(4 + 4) + cbrt(4 - 4) = 2 + 0 = 2.
- The two complex roots have real part -(u+v)/2 = -1 and imaginary part (u-v) * sqrt(3)/2 = 2 * 1.732/2 = 1.732.
Result: One real root x = 2 and two complex roots x = -1 + 1.732i and x = -1 - 1.732i
Solve by factoring: 2x3 - 3x2 - 11x + 6 = 0 (a = 2, b = -3, c = -11, d = 6).
- Rational root theorem: candidates are factors of 6 over factors of 2, so plus/minus 1, 2, 3, 6, 1/2, 3/2.
- Test x = 3: 2(27) - 3(9) - 11(3) + 6 = 54 - 27 - 33 + 6 = 0, so x = 3 is a root.
- Synthetic division by (x - 3) leaves the quadratic 2x2 + 3x - 2 = 0.
- Solve the quadratic: x = (-3 plus/minus sqrt(9 + 16))/4 = (-3 plus/minus 5)/4, giving x = 1/2 and x = -2.
- Vieta check: 3 + 0.5 - 2 = 1.5 = -b/a and 3 * 0.5 * (-2) = -3 = -d/a. Correct.
Result: Three real roots: x = 3, x = 1/2, x = -2
How the cubic discriminant D = g2/4 + f3/27 determines the roots
| Discriminant D | Number of real roots | Nature of the roots |
|---|---|---|
| D > 0 | 1 | One real root and two complex conjugate roots |
| D = 0 (and f = 0) | 3 | A single triple (threefold) real root |
| D = 0 (and f not 0) | 3 | A double real root plus one distinct real root |
| D < 0 | 3 | Three distinct real roots (casus irreducibilis) |
Vieta relationships between roots and coefficients of ax3 + bx2 + cx + d = 0
| Quantity | Formula | Meaning |
|---|---|---|
| Sum of roots | r1 + r2 + r3 = -b/a | Add the three roots |
| Sum of pairwise products | r1r2 + r1r3 + r2r3 = c/a | Products two at a time |
| Product of roots | r1 * r2 * r3 = -d/a | Multiply all three roots |
Sample cubic equations and their roots
| Equation | Roots |
|---|---|
| x3 - 6x2 + 11x - 6 = 0 | x = 1, 2, 3 |
| x3 - 3x2 + 3x - 1 = 0 | x = 1 (triple root) |
| x3 - x = 0 | x = -1, 0, 1 |
| x3 - 8 = 0 | x = 2, -1 plus/minus 1.732i |
| 2x3 - 3x2 - 11x + 6 = 0 | x = 3, 1/2, -2 |
Common mistakes to avoid
- Forgetting that a must not be zero. If a = 0 the equation is no longer cubic, it is a quadratic bx2 + cx + d = 0 (or lower). This solver detects that and falls back to the quadratic, linear or constant case, but the answer is no longer a cubic with three roots.
- Expecting three real roots every time. A cubic always has at least one real root, but it can have only one. When the discriminant is positive the other two roots are complex conjugates, not real numbers.
- Mixing up the coefficient positions. Enter b as the multiplier of x2 and c as the multiplier of x. Swapping them changes the equation entirely. A missing term means a coefficient of 0, so x3 - 8 needs b = 0 and c = 0.
- Reading rounded roots as exact. Roots are shown to a sensible number of decimals. An answer like 1.732 is the rounded value of sqrt(3), and values extremely close to a whole number are snapped to it, so treat the display as an approximation when the true root is irrational.
- Testing the wrong rational-root candidates by hand. The rational root theorem uses factors of the constant term d over factors of the leading coefficient a. Testing only integers, or dividing in the wrong order, makes you miss fractional roots like 1/2 or 3/2.
- Skipping the Vieta check. Roots that do not sum to -b/a and multiply to -d/a are wrong. A quick Vieta check catches sign errors and arithmetic slips before you rely on the answer.
Glossary
- Cubic equation
- A polynomial equation of degree three, of the form ax3 + bx2 + cx + d = 0 with a not equal to 0.
- Root
- A value of x that makes the equation equal to zero, also called a solution or zero of the polynomial.
- Discriminant
- A quantity computed from the coefficients whose sign reveals how many roots are real and whether any repeat.
- Depressed cubic
- The simplified form t3 + ft + g = 0 obtained by removing the x2 term through the substitution x = t - p/3.
- Complex conjugate
- A pair of numbers of the form p + qi and p - qi that arise together as roots when a cubic has only one real root.
- Cardano formula
- The closed-form radical solution for a cubic, derived by depressing the equation and taking cube roots.
- Rational root theorem
- A rule stating any rational root of a polynomial is a factor of the constant term divided by a factor of the leading coefficient.
- Vieta formulas
- Relationships linking the sum and products of the roots to the coefficients: sum = -b/a and product = -d/a for a cubic.
Frequently asked questions
How do I solve a cubic equation with this tool?
Enter the four coefficients a, b, c and d from ax3 + bx2 + cx + d = 0. The solver normalises the equation, depresses it, evaluates the discriminant and returns up to three roots, real or complex, updating as you type.
Does every cubic equation have three roots?
Yes, counted with multiplicity. A cubic always has exactly three roots and at least one of them is real. The other two are either both real or a pair of complex conjugates, depending on the sign of the discriminant.
What does the discriminant tell me?
The sign of the discriminant D = g2/4 + f3/27 sets the case. Positive means one real root and two complex roots, zero means all roots are real with at least two equal, and negative means three distinct real roots.
Can this solver handle complex roots?
Yes. When the discriminant is positive the tool reports the single real root plus the two complex conjugate roots, each shown in a + bi form with its real and imaginary parts.
What if the coefficient a is zero?
If a is 0 the equation is not cubic. The solver automatically falls back to solving the quadratic bx2 + cx + d = 0, or a linear equation if b is also 0, so you still get a valid answer.
Which method does the solver use?
It uses Cardano method on the depressed cubic for one-real-root and repeated-root cases, and the equivalent trigonometric (Vieta) form for three distinct real roots, which avoids cube roots of complex numbers and keeps the real answers exact.
How do I solve a cubic equation by hand?
Use the rational root theorem to list candidate roots (factors of d over factors of a), test them until one gives zero, then use synthetic division to divide out (x - r). This leaves a quadratic you finish with the quadratic formula.
How do I factor a cubic equation?
Once you find one root r by trial, the cubic factors as (x - r) times a quadratic. Divide the cubic by (x - r) using synthetic or long division, then factor or solve the remaining quadratic to get the other two roots.
What are Vieta formulas for a cubic?
For ax3 + bx2 + cx + d = 0 with roots r1, r2, r3, the sum r1 + r2 + r3 = -b/a, the sum of pairwise products = c/a, and the product r1 * r2 * r3 = -d/a. They let you check roots without re-solving.
Can a cubic equation have no real solution?
No. Because a cubic curve runs from negative infinity to positive infinity, it must cross the x-axis at least once, so every cubic has at least one real root. It can never have zero real solutions.