A cubic equation has the general form ax³ + bx² + cx + d = 0, where a is non-zero. Unlike quadratics, a cubic always has at least one real root — its graph must cross the x-axis at least once. The tool above solves any such equation immediately in your browser, showing not only the roots but every algebraic step that leads to them.
How it works
Step 1 — Depress the cubic
The first move is to eliminate the x² term using the substitution x = t − b / (3a). After this shift the equation becomes the depressed cubic t³ + pt + q = 0, where
p = (3ac − b²) / (3a²)
q = (2b³ − 9abc + 27a²d) / (27a³)
Working in the depressed form is far cleaner because it has only two free parameters instead of four.
Step 2 — Evaluate the discriminant
The discriminant of the depressed cubic is
Δ = −4p³ − 27q²
This single number classifies the roots completely:
| Δ | Root structure |
|---|---|
| Δ > 0 | Three distinct real roots |
| Δ = 0 | A double root and a simple root (or a triple root when p = q = 0) |
| Δ (negative) | One real root plus two complex conjugates |
Step 3 — Solve by the right method
Three real roots (Δ > 0): The tool uses the trigonometric de Moivre method. Setting m = 2·sqrt(−p / 3) and computing θ = (1/3)·arccos(3q / (pm)), the three roots are t_k = m·cos(θ − 2kπ/3) for k = 0, 1, 2. This avoids complex arithmetic even though the intermediate expressions might look imaginary with other approaches — an issue historically known as casus irreducibilis.
One real root (Δ negative): Cardano’s formula gives the real root as u + v, where u = cbrt(−q/2 + sqrt(D)) and v = cbrt(−q/2 − sqrt(D)) with D = (q/2)² + (p/3)³ > 0. The complex conjugate pair follows from Vieta’s formulas.
Repeated root (Δ = 0): The double root of the depressed cubic is t = ∛(q/2) and the simple root is t = −2·∛(q/2), giving x = t − shift for each.
Step 4 — Shift back
Every root t of the depressed cubic maps back to a root of the original via x = t − b / (3a).
Worked example
Solve x³ − 6x² + 11x − 6 = 0.
Here a = 1, b = −6, c = 11, d = −6. The depressed coefficients are p = −1, q = 0. Because p is negative and q is zero, the discriminant Δ = −4(−1)³ − 27(0)² = 4 > 0, so there are three distinct real roots. The trigonometric method gives t₁ = 2, t₂ = −1, t₃ = −1 (roughly, before shifting). Shifting back by −b/(3a) = 2 yields x₁ = 1, x₂ = 2, x₃ = 3 — which you can verify directly by substitution: 1 − 6 + 11 − 6 = 0.
For comparison, x³ + x + 2 = 0 (p = 1, q = 2, Δ = −4 − 108 = −112, negative) has one real root x = −1 and two complex conjugate roots.
Formula note
Cardano published his formula in Ars Magna in 1545, making it one of the first explicit solutions for a polynomial of degree higher than two. The trigonometric form used here for three real roots was refined over the following century. The discriminant Δ = −4p³ − 27q² is the standard expression for a monic depressed cubic; it factors as the square of the Vandermonde product (r₁ − r₂)(r₁ − r₃)(r₂ − r₃) times a² (the squared leading coefficient), which is why Δ = 0 forces at least two roots to coincide.