Cubic Equation Solver
A cubic equation has the general form ax³ + bx² + cx + d = 0 and always has three roots over the complex numbers. Enter the four coefficients and the solver returns them using Cardano’s formula: three real roots when the discriminant is non-positive, one real root plus a complex conjugate pair when the discriminant is positive, and a double-root configuration when the discriminant equals zero.
How the solver finds the roots
-
1
Enter coefficients
Four numbers: a, b, c, d. The leading coefficient a must be non-zero: otherwise the equation is quadratic, not cubic.
-
2
Depressed cubic
The solver shifts the equation by -b/(3a) to eliminate the quadratic term, producing the form `t³ + pt + q = 0`.
-
3
Discriminant check
Δ = (q/2)² + (p/3)³ decides the path: Δ > 0 gives one real root, Δ = 0 gives a double root, Δ < 0 gives three real roots via trigonometry.
-
4
Shift back
Each root found in t-space is shifted by -b/(3a) to recover x. The solver returns them in descending order where applicable.
Discriminant cases and what they mean
Cardano’s method routes through one of three branches depending on the sign of the discriminant Δ = (q/2)² + (p/3)³. The geometry of the cubic graph mirrors this exactly.
Case table
| Discriminant | Roots | Graph shape |
|---|---|---|
| Δ > 0 | 1 real, 2 complex conjugates | Crosses x-axis once |
| Δ = 0 | 3 real, at least two equal | Touches x-axis at a double root |
| Δ < 0 | 3 distinct real roots | Crosses x-axis three times |
Worked example
For x³ − 6x² + 11x − 6 = 0 (coefficients 1, −6, 11, −6):
- Shift by −b/(3a) = 2 to get the depressed form: p = −1, q = 0.
- Δ = (q/2)² + (p/3)³ = 0 + (−1/3)³ = −1/27 < 0, so we take the three-real-roots (trigonometric) path.
- The trigonometric formula gives the three distinct real roots x = 1, 2, 3.
Numerical considerations
- Floating-point error creeps in when the three roots are close together (a near-triple root). Displayed roots may differ in the last few decimal places from the exact values.
- Very small a makes b/(3a) large, which dominates the arithmetic and reduces precision. If
|a|is below around 1e-12, solve as a quadratic instead. - Integer coefficients give the cleanest output: rational roots will appear at their exact values up to floating-point rounding.
Related equations
- Quadratic:
ax² + bx + c = 0. Use the Quadratic Equation Solver, closed form and simpler. - Quartic:
ax⁴ + bx³ + cx² + dx + e = 0. Ferrari’s method reduces to a resolvent cubic; not covered here. - Depressed cubic: set b = 0 to skip the shift and feed
x³ + px + q = 0directly.
Frequently Asked Questions
The equation is no longer cubic. The solver refuses to proceed in that case, switch to the Quadratic Equation Solver for bx² + cx + d = 0.
The solver returns the single real root in that case. The other two roots are a complex conjugate pair that Cardano’s formula gives in closed form; compute them as -x1/2 ± (√3/2) × i × modulus if you need them for a symbolic answer.
Numerical implementations of Cardano’s method can produce residuals on the order of 1e-15 due to floating-point rounding. Treat anything below 1e-10 as real; this solver already filters those residuals out for the Δ < 0 branch.
The four coefficients are sent to the server only to compute the roots and are not stored. When you use the step-by-step view, the coefficients also appear in the page link.
Related Tools
BMI Calculator
Calculate body mass index from height and weight. Shows WHO category, healthy-weight range and limitations of BMI.
Social Security Calculator
Estimate a US Social Security retirement benefit from your PIA and claiming age. Compare monthly and annual amounts at 62, FRA 67 and 70.
Age Calculator
Calculate exact age in years, months and days from a birth date, plus total days, hours and the next birthday countdown.
Dog Age Calculator
Convert your dog's age to human years using modern veterinary research. Breed-size aware: small, medium and large dogs age differently.
Amp-Hour Calculator
Work out battery runtime and stored energy from amp-hours, voltage and load current. Get runtime in hours and minutes plus energy in watt-hours and kilowatt-hours.
Scientific Calculator
Evaluate supported real-number expressions with trig, logs, powers and parentheses locally in your browser.
Tool available in other languages
- Lösare för kubiska ekvationer [SV]
- Pemecah Persamaan Kubik [ID]
- เครื่องแก้สมการลูกบาศก์ [TH]
- 三次方程式ソルバー [JA]
- Phương pháp giải phương trình lập phương [VI]
- Resolutor de Ecuaciones Cúbicas [ES]
- Kübik Denklem Çözücü [TR]
- Kubische Gleichungs-Löser [DE]
- Résolveur d'équations cubiques [FR]
- Solução de Equação Cúbica [PT]
- 三次方程求解器 [ZH]
- حل المعادلات التكعيبية [AR]
- 삼차방정식 계산기 [KO]
- Oplosser voor kubische vergelijkingen [NL]
- Kalkulator równań sześciennych [PL]
- Решатель кубических уравнений [RU]
- Risolutore di Equazioni Cubiche [IT]