Cubic Equation Calculator

Enter a, b, c and d. The discriminant decides the method: three real roots by the trigonometric formula, one real root by Cardano’s formula, or exact repeated roots when it is zero.

Also called: Cubic formula calculator · Cubic solver

  • Last updated
  • Formula tested against reference values

Your numbers

Result

Roots
—

Calculating…

x₁
—
x₂
—
x₃
—
Discriminant Δ
—
Nature of the roots
—
Depressed cubic
—
Method used
—

How to use this calculator

  1. Enter or choose a (x³ coefficient).
  2. Enter or choose b (x² coefficient).
  3. Enter or choose c (x coefficient).
  4. Enter or choose d (constant).
  5. The roots updates as you type. Use Copy result or Share to keep it.

Method

Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d²; x = t − b/3a gives t³ + pt + q = 0; Δ > 0: t = 2√(−p/3)·cos(⅓·arccos((3q/2p)√(−3/p)) − 2πk/3); Δ < 0: t = ∛(−q/2 + √D) + ∛(−q/2 − √D), D = q²/4 + p³/27

a, b, c, d
the coefficients (a ≠ 0)
Δ
the discriminant
p, q
coefficients of the depressed cubic
k
0, 1, 2

Worked example

  1. Δ = 18(1)(−6)(11)(−6) − 4(−216)(−6) + (36)(121) − 4(1331) − 27(36) = 7128 − 5184 + 4356 − 5324 − 972 = 4 > 0, so there are three distinct real roots.
  2. Substituting x = t + 2 gives the depressed cubic t³ − t = 0, so p = −1 and q = 0.
  3. Trigonometric formula: t = 2√(1/3)·cos(30° − 120°k) gives t = 1, −1 and 0, so x = 3, 1 and 2.

x³ − 6x² + 11x − 6 = 0 has the roots x = 1, 2 and 3.

What the result means

Δ > 0 means three distinct real roots, Δ < 0 one real root and a complex-conjugate pair, Δ = 0 a repeated root. Every cubic with real coefficients has at least one real root.

Assumptions and limits

  • Coefficients are real; a must not be 0.
  • Roots are shown to 10 significant figures; exact radical forms are not written out.

Questions

Why use cosines when all three roots are real?

In that case Cardano’s formula needs cube roots of complex numbers even though the answers are real (the “casus irreducibilis”). The trigonometric form gives the same roots using only real arithmetic.

How is accuracy protected?

The discriminant is computed exactly from your coefficients, so the case is never misjudged by rounding. Cardano’s formula takes the larger cube root first to avoid cancellation, and every root is refined with Newton’s method.