A cubic equation, ax³ + bx² + cx + d = 0, always has exactly three roots once you count repeated roots and complex roots — but unlike a quadratic, you can't always see at a glance whether those roots are real numbers you can plot on a graph or complex numbers that only exist in the complex plane. This calculator solves for all three roots directly and uses the discriminant to explain, in plain language, what kind of roots you're looking at.

How the solver works

The calculator first substitutes x = t − b/(3a) to remove the x² term, turning the general cubic into a simpler "depressed" cubic t³ + pt + q = 0. From there, the path depends on the sign of an internal discriminant-like quantity built from p and q: when it's negative, the equation has three distinct real roots, and the calculator uses a trigonometric formula (built from arccos and cosine) that stays entirely within real numbers. When it's positive, the equation has one real root and a complex conjugate pair, and the calculator uses Cardano's formula with a cube-root function that correctly handles negative inputs — avoiding the branch-selection pitfalls that trip up naive implementations of Cardano's formula in this case. When it's zero (or very close to it), the equation has a repeated real root, which the calculator detects and labels as either a double root or a triple root.

Reading the discriminant

The discriminant, Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d², is computed directly from the four coefficients — no need to solve the equation first. Its sign alone tells you the nature of the roots: Δ > 0 means three distinct real roots (the equation's graph crosses the x-axis three separate times); Δ = 0 means at least two of the roots coincide (the graph touches the x-axis without crossing at that point); Δ < 0 means only one root is real and the other two form a complex conjugate pair (the graph crosses the x-axis exactly once). This mirrors the more familiar b² − 4ac discriminant from the quadratic formula, just extended to one more degree.

Why complex roots always come in pairs, and what a = 0 means

Whenever a cubic equation has real coefficients (a, b, c, and d are all ordinary real numbers, not complex themselves), any complex roots it has are guaranteed to occur in conjugate pairs — a + bi and a − bi — because the imaginary parts have to cancel out for the polynomial to evaluate to a real coefficient equation. That's why this calculator, and every correct cubic solver, only ever reports 0 or 2 complex roots, never 1. Separately, if you enter a = 0, the x³ term disappears and the equation is no longer a true cubic — it's a quadratic, bx² + cx + d = 0, so the calculator automatically falls back to the quadratic formula (and further to a linear solver if b is also 0) rather than dividing by zero.