Math & Geometry
Cubic Equation Solver (ax³ + bx² + cx + d = 0)
Find all the roots of a cubic equation. A cubic equation has the form ax³ + bx² + cx + d = 0, with a not equal to zero, and always has three roots when complex numbers are counted: either three real roots, some of which may be equal, or one real root and a pair of complex conjugate roots. Cubic equations appear in many areas: volumes of boxes and tanks, the equations of state of real gases in chemistry and engineering, beam and spring problems, economics and computer graphics, where Bézier curves are cubic polynomials. The general solution was one of the great achievements of Renaissance mathematics, published by Gerolamo Cardano in 1545 from work by Scipione del Ferro and Niccolò Tartaglia. The calculator first removes the squared term with a change of variable, turning the equation into a depressed cubic, then uses the discriminant to decide which method to apply: the trigonometric form when there are three distinct real roots, which avoids complex arithmetic, and Cardano’s formula when there is one real root, giving the complex pair as well. Enter the four coefficients, and the calculator gives the real roots in order, any complex roots, the discriminant, the nature of the roots and the sum and product of the roots from Vieta’s formulas as a check. For x³ − 6x² + 11x − 6 = 0, the roots are 1, 2 and 3, and for x³ − 1 = 0 the real root is 1 with complex roots −0.5 ± 0.866i.
How to use this calculator
- Write your equation as ax³ + bx² + cx + d = 0.
- Enter the coefficients a, b, c and d.
- Use 0 for any missing term.
- Read the real roots and any complex roots.
- Check the sum and product of the roots.
Real and complex roots
The graph of a cubic always crosses the x-axis at least once, because it goes to opposite infinities at each end. It can cross three times, touch the axis at a repeated root, or cross only once.
Complex roots of polynomials with real coefficients always come in conjugate pairs, a ± bi.
Numerical methods
In practice, engineers often solve cubics numerically with Newton’s method, especially when the coefficients come from measurements. The closed-form solution remains useful for exact analysis.
For equations of degree five or more, no general formula using radicals exists, as Abel and Galois showed in the nineteenth century.
Formula & method
Substitute x = t − b ÷ (3a) to get t³ + pt + q = 0p = (3ac − b²) ÷ (3a²); q = (2b³ − 9abc + 27a²d) ÷ (27a³)Δ = −(4p³ + 27q²): Δ > 0 three distinct real roots, Δ = 0 repeated roots, Δ < 0 one real and two complex rootsThree real roots use the trigonometric form; otherwise Cardano’s formulaSubstituting x = t − b ÷ (3a) gives the depressed cubic t³ + pt + q = 0, with p = (3ac − b²) ÷ (3a²) and q = (2b³ − 9abc + 27a²d) ÷ (27a³). Discriminant Δ = −(4p³ + 27q²). If Δ > 0: three distinct real roots, t_k = 2√(−p/3) cos[⅓ arccos((3q ÷ 2p)√(−3/p)) − 2πk/3], k = 0, 1, 2. If Δ = 0: repeated real roots. If Δ < 0: one real root by Cardano, t = ∛(−q/2 + √(q²/4 + p³/27)) + ∛(−q/2 − √(q²/4 + p³/27)), and two complex roots. Vieta’s formulas: sum of roots = −b ÷ a, product = −d ÷ a. Results are rounded to six decimal places.
Worked example
x³ − 6x² + 11x − 6 = 0
- Shift x = t + 2: the depressed cubic is t³ − t = 0.
- Δ = −(4 × (−1)³ + 0) = 4 > 0: three real roots t = −1, 0, 1.
- x = t + 2 gives 1, 2, 3; sum 6 = −b ÷ a, product 6 = −d ÷ a.
Answer: Roots 1, 2 and 3.
Frequently asked questions
How many roots does a cubic have?
Three, counting complex and repeated roots.
Does a cubic always have a real root?
Yes, at least one.
What does the discriminant show?
Whether the roots are three distinct real, repeated or one real and two complex.
What if a = 0?
The equation is quadratic, not cubic.
Who discovered the cubic formula?
Del Ferro and Tartaglia; Cardano published it in 1545.
How can I check the roots?
Their sum equals −b ÷ a and their product −d ÷ a.