Cubic Equation Solver
This calculator solves any cubic equation of the form ax³ + bx² + cx + d = 0, finding all three roots exactly rather than leaving you to guess or plot the curve by hand. Cubic equations turn up throughout engineering, economics and pure maths whenever a variable is cubed, and while some factorise neatly, most do not, which is where a general method such as Cardano's method becomes useful. You enter the four coefficients a, b, c and d (a cannot be zero, or the equation becomes quadratic), and the tool normalises the equation, converts it to a depressed cubic, and works out the discriminant to determine what kind of roots to expect. The results panel shows all three roots, labelled real or complex, alongside the discriminant, the root type, and the depressed cubic values p and q. A verification panel substitutes each real root back into the original equation to confirm it evaluates to zero, and checks the roots sum to minus b over a as Vieta's formulas require. A working steps panel spells out each stage of the method so you can follow the algebra by hand, and a plain language verdict states whether you have three real roots, a repeated root, or one real root with a complex conjugate pair. Large coefficients may show tiny rounding noise in the last decimal place.
Enter Coefficients
The equation has the form ax³ + bx² + cx + d = 0. Enter each coefficient below. Fractions and decimals are accepted. Coefficient a must not be zero.
Working Steps
How to Solve a Cubic Equation
A cubic equation has the general form ax³ + bx² + cx + d = 0 where a is not zero. Every cubic with real coefficients has exactly three roots (counting multiplicity) over the complex numbers, and at least one root is always real.
The most systematic analytical method is Cardano's formula, developed by Gerolamo Cardano and published in Ars Magna in 1545. It converts the general cubic to a simpler form called the depressed cubic (which has no x² term), then solves that using a substitution that reduces the problem to solving a quadratic.
Step-by-Step Method
- Divide by a to get a monic cubic: x³ + (b/a)x² + (c/a)x + (d/a) = 0. Call these new coefficients B, C, D.
- Substitute x = t - B/3 to eliminate the x² term. This gives the depressed cubic: t³ + pt + q = 0, where p = C - B²/3 and q = D + 2B³/27 - BC/3.
- Compute the discriminant of the depressed cubic: Δ = -4p³ - 27q².
- Apply Cardano's formula:
- If Δ > 0: three distinct real roots (use the trigonometric method with arccos).
- If Δ = 0: repeated root(s); at least two roots are equal.
- If Δ < 0: one real root and two complex conjugate roots.
- Shift back: add -B/3 to each root t to recover x.
The Discriminant
| Discriminant (Δ) | Root types | Description |
|---|---|---|
| Δ > 0 | Three distinct real roots | The cubic crosses the x-axis three times |
| Δ = 0 | Repeated real root(s) | The cubic touches the x-axis at a double or triple root |
| Δ < 0 | One real root, two complex conjugate roots | The cubic crosses the x-axis once |
Worked Example
Solve x³ - 6x² + 11x - 6 = 0 (coefficients a=1, b=-6, c=11, d=-6).
- Already monic. B = -6, C = 11, D = -6.
- Substitute x = t - B/3 = t + 2. Compute p = 11 - 36/3 = 11 - 12 = -1 and q = -6 + 2(-216)/27 - (-6)(11)/3 = -6 - 16 + 22 = 0.
- Discriminant: Δ = -4(-1)³ - 27(0)² = 4 - 0 = 4 > 0. Three distinct real roots.
- Because q = 0, the depressed cubic t³ - t = 0 factors as t(t² - 1) = 0, giving t = 0, t = 1, t = -1.
- Shift back: x = t + 2. The solver reports the roots in the order x₁ = 3, x₂ = 2, x₃ = 1 (the same set {1, 2, 3}).
Verification: (x-1)(x-2)(x-3) = x³ - 6x² + 11x - 6. Confirmed.
Vieta's Formulas (Sum and Product of Roots)
For ax³ + bx² + cx + d = 0 with roots x₁, x₂, x₃:
- x₁ + x₂ + x₃ = -b/a
- x₁x₂ + x₁x₃ + x₂x₃ = c/a
- x₁x₂x₃ = -d/a
These relationships can be used to verify roots without substituting back into the equation.
Related Calculators
- Maths and Stats Calculators: all equation and geometry tools.
- System of Equations Solver: solve simultaneous linear equations.
- Combination (nCr) Calculator: binomial combinations.
- Permutation (nPr) Calculator: ordered arrangements.
- ANOVA Calculator: analysis of variance for statistical testing.
Sources and method: Cardano, G. Ars Magna (1545). Nickalls, R.W.D. "A new approach to solving the cubic: Cardano's solution revealed." The Mathematical Gazette, 77(480), 354-359 (1993). Abramowitz and Stegun, Handbook of Mathematical Functions (1972), Section 3.8.2. Complex root computation uses trigonometric form when Δ > 0 (three real roots, casus irreducibilis avoided).
This solver uses double-precision floating-point arithmetic. For coefficients with very large magnitudes, round-off error may affect the last few decimal places. The verification column shows f(x) evaluated at each root as a check; values very close to zero (e.g. 1e-13) confirm a correct root.