Skip to content
Omnikalc

Cubic equation solver: ax³ + bx² + cx + d = 0

Find the real and complex roots of any cubic equation with Cardano's method, with the discriminant and the number of real roots.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Results

Number of distinct real roots

3

All roots are real

Root x₁

3

Root x₂ (real part if complex)
2
Root x₃ (real part if complex)
1
Imaginary part of x₂ and x₃ (±)
0
Discriminant of the reduced equation (q²/4 + p³/27)
-0.037037

A famous problem of the Renaissance

Solving quadratic equations was known to Babylonian scribes, but the cubic ax³ + bx² + cx + d = 0 resisted for thousands of years. Around 1515, Scipione del Ferro in Bologna found a method and kept it secret. Niccolò Tartaglia rediscovered it in 1535 and shared it with Gerolamo Cardano, who published it in his Ars Magna in 1545. The resulting public dispute is one of the best-known quarrels in the history of mathematics.

How the solution works

  1. Reduce the equation. Substitute x = t − b ÷ (3a). The x² term vanishes and you get t³ + pt + q = 0, with p = (3ac − b²) ÷ (3a²) and q = (2b³ − 9abc + 27a²d) ÷ (27a³).
  2. Compute the discriminant Δ = q²/4 + p³/27.
  3. If Δ > 0, there is one real root: t = ∛(−q/2 + √Δ) + ∛(−q/2 − √Δ). The other two roots are complex conjugates.
  4. If Δ < 0, there are three distinct real roots. Cardano’s formula would need cube roots of complex numbers here, so the calculator uses the trigonometric method from François Viète: t = 2√(−p/3) × cos(θ − 120°k), for k = 0, 1, 2.
  5. If Δ = 0, two or three roots coincide.
  6. Shift back with x = t − b ÷ (3a).

Worked example

Solve x³ − 6x² + 11x − 6 = 0 (a = 1, b = −6, c = 11, d = −6).

  • p = (33 − 36) ÷ 3 = −1, q = (−432 + 594 − 162) ÷ 27 = 0.
  • Δ = 0 + (−1)³ ÷ 27 = −0.037037, which is negative, so there are three real roots.
  • The trigonometric method gives x = 3, 2 and 1.

Check: (x − 1)(x − 2)(x − 3) expands to x³ − 6x² + 11x − 6.

Reading the results

  • When there is one real root, the calculator gives the real part and the ± imaginary part of the two complex roots. For x³ − 1 = 0, the roots are 1 and −0.5 ± 0.86603i.
  • Rounding may show 2.9999999 instead of 3. Results are shown to 8 significant digits.
  • If a = 0, the equation is not a cubic. Use the quadratic equation calculator instead.

Where cubics appear

Cubic equations arise in engineering when finding the depth of a floating object, in chemistry with equations of state for real gases such as van der Waals, in economics with cubic cost curves, and in computer graphics with Bézier curves.

Frequently asked questions

How many roots does a cubic equation have?

Always three, counted with multiplicity, in the complex numbers. At least one of them is real, because the curve of a cubic goes from minus infinity to plus infinity and must cross the x-axis.

What is Cardano's formula?

A formula published by Gerolamo Cardano in 1545, based on work by Scipione del Ferro and Niccolò Tartaglia. It first removes the x² term by substituting x = t − b ÷ 3a, giving t³ + pt + q = 0, then takes cube roots of −q/2 ± √(q²/4 + p³/27).

What does the discriminant tell me?

For the reduced equation, a positive value of q²/4 + p³/27 means one real root and two complex ones. Zero means a repeated root. A negative value means three distinct real roots, which the calculator finds with the trigonometric method.

Why are some answers like 0.99999999?

Floating-point rounding. The calculator shows results to 8 significant digits, so a root of 1 may appear as 1 or 0.99999999. Substitute the value back into the equation to check.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.