Cubic Equation Solver
Solve ax³ + bx² + cx + d = 0 for all three roots, real or complex, with the discriminant, the nature of the roots and the factored form.
Solve any cubic equation ax³ + bx² + cx + d = 0. A cubic with real coefficients always has at least one real root; the other two are either real as well or a pair of complex conjugates. The solver lists all three roots, the discriminant that tells you which case you have, and the polynomial in factored form.
How to use this tool
- Enter the coefficients a, b, c and d. Use 0 for a missing term and keep the minus signs.
- Read the roots: real roots are listed from smallest to largest, complex roots as p + qi.
- Check the discriminant and the nature of the roots.
- Use the factored form to verify the answer or to factor the polynomial.
Formula
Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d²
Δ > 0 means three distinct real roots, Δ = 0 a repeated root, and Δ < 0 one real root plus two complex conjugates. The roots come from the depressed cubic t³ + pt + q = 0 (with x = t − b/3a): the trigonometric formula when Δ > 0, Cardano’s formula when Δ < 0, and the exact repeated-root formulas when Δ = 0, each refined with Newton’s method.
Example
2x³ − 4x² − 22x + 24 = 0. The discriminant is Δ = 112,896, which is positive, so there are three distinct real roots: x = −3, x = 1 and x = 4. In factored form the equation is 2(x + 3)(x − 1)(x − 4) = 0. Substituting x = 1 checks out: 2 − 4 − 22 + 24 = 0.
Frequently asked questions
Does every cubic have a real root?
Yes. With real coefficients the graph runs from −∞ to +∞ (or the other way), so it must cross the x-axis at least once.
What do complex roots mean here?
They come as a conjugate pair p ± qi, and the graph crosses the x-axis only once. The pair matches the quadratic factor x² − 2px + (p² + q²) shown in the factored form.
How accurate are the roots?
They are computed in double precision, refined with Newton’s method and shown to six decimal places. A value within a billionth of a nonzero whole number is displayed as that whole number. Very small nonzero roots are retained.
Why can’t a be 0?
Without the x³ term the equation is a quadratic, which has at most two roots. Use the quadratic equation solver for that case.
Last updated: 2026-10-30