Cubic Equation Calculator

Solve any cubic equation ax³ + bx² + cx + d = 0. See all three roots, including complex ones, the discriminant, what kind of roots it has, and the full working.

Roots1, 2, 3

Must not be 0.

-1000000000 – 1000000000

-1000000000 – 1000000000

-1000000000 – 1000000000

Roots

1, 2, 3

  • x₁1
  • x₂2
  • x₃3
  • Discriminant Δ4
  • Nature of rootsThree distinct real roots
  • Depressed cubic p−1
  • Depressed cubic q0

Roots are computed in double precision and shown to 10 significant digits; real roots are refined with Newton's method. A discriminant within 10⁻¹² of the size of its terms is treated as exactly 0, so near-repeated roots are reported as repeated.

How this was calculated

Equation: x³ − 6x² + 11x − 6 = 0.

Substitute x = t − b/(3a) = t − (−6)/(3 × 1) = t + 2 to get t³ + pt + q = 0.

p = (3ac − b²)/(3a²) = (3 × 1 × 11 − (−6)²)/(3 × 1²) = −1.

q = (2b³ − 9abc + 27a²d)/(27a³) = (2 × (−6)³ − 9 × 1 × (−6) × 11 + 27 × 1² × (−6))/(27 × 1³) = 0.

Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² = 4 → three distinct real roots.

Δ > 0, trigonometric form: t_k = 2√(−p/3)·cos[⅓·arccos((3q/(2p))·√(−3/p)) − 2πk/3], k = 0, 1, 2; 2√(−p/3) = 1.154700538.

x₁ = 1

x₂ = 2

x₃ = 3

Check (Vieta): x₁ + x₂ + x₃ = 6 = −b/a = 6; x₁·x₂·x₃ = 6 = −d/a = 6.

Method: depressed cubic and discriminant

Substituting x = t − b/(3a) removes the x² term and gives the depressed cubic t³ + pt + q = 0, with p = (3ac − b²)/(3a²) and q = (2b³ − 9abc + 27a²d)/(27a³).

The discriminant Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² tells you the kind of roots before you solve: Δ > 0 gives three different real roots, Δ = 0 gives a repeated root, and Δ < 0 gives one real root and a complex-conjugate pair.

For Δ > 0 the calculator uses the trigonometric form t = 2√(−p/3)·cos[⅓·arccos((3q/(2p))·√(−3/p)) − 2πk/3]. This avoids the complex cube roots that Cardano's formula needs in that case. For Δ < 0 it uses the matching hyperbolic form, then divides out the real root to find the complex pair. Newton's method then refines each real root.

What the discriminant tells you
DiscriminantRoots
Δ > 0Three distinct real roots
Δ = 0A repeated real root (double or triple)
Δ < 0One real root and two complex-conjugate roots

Worked examples

x³ − 6x² + 11x − 6 = 0: x = t + 2 gives p = −1 and q = 0, Δ = 4 > 0, and the roots are 1, 2 and 3. Check: 1 + 2 + 3 = 6 = −b/a, and 1 × 2 × 3 = 6 = −d/a.

x³ − 1 = 0: Δ = −27 < 0, so there is one real root x = 1 and a complex pair x = −0.5 ± 0.8660254038i.

Precision

The roots are calculated in double precision and shown to 10 significant digits. If Δ is smaller than about 10⁻¹² of the size of its own terms, it is treated as exactly zero. That means two roots closer together than the precision can resolve are reported as a repeated root.

How to use the Cubic Equation Calculator

Enter the four coefficients.

  1. Enter a, b, c and d

    Type the coefficients of ax³ + bx² + cx + d = 0. Use 0 for any missing term.

  2. Read the roots

    See x₁, x₂ and x₃, with any complex pair written as p ± qi.

  3. Review the steps

    Check the depressed cubic, the discriminant and the Vieta check.

References

Frequently asked questions

Why can't a be zero?

With a = 0 there is no x³ term, so the equation is quadratic. Use the quadratic formula calculator instead.

Does every cubic have a real root?

Yes. With real coefficients, a cubic always has at least one real root, because the curve goes from −∞ to +∞. Complex roots, when there are any, come in conjugate pairs.

How can I check the roots?

By Vieta's formulas, the roots add up to −b/a and multiply to −d/a. The calculator shows both checks. You can also substitute each root back into the equation.

Last updated . Results are estimates for informational purposes only.