Cubic Equation Calculator

Solve a cubic equation ax³ + bx² + cx + d = 0. See all three roots (including complex ones), what kind of roots they are, and every step.

Roots1, 2, 3

Must not be 0.

Enter 0 if there is no x² term.

Enter 0 if there is no x term.

Enter 0 if there is no plain number.

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

  1. This is the equation to solve. A root (an answer) is a value of x that makes the left side equal 0. A cubic always has three roots, but some may repeat.ax³ + bx² + cx + d = 0Put in your numbers: x³ − 6x² + 11x − 6 = 0
  2. Swap x for t minus a fixed shift. This removes the x² term and leaves a simpler cubic, t³ + pt + q = 0.x = t − b/(3a)Put in your numbers: t − (−6)/(3 × 1)Answer: t + 2
  3. Work out p, the number in front of t in the simpler cubic.p = (3ac − b²)/(3a²)Put in your numbers: (3 × 1 × 11 − (−6)²)/(3 × 1²)Answer: −1
  4. Work out q, the number on its own in the simpler cubic.q = (2b³ − 9abc + 27a²d)/(27a³)Put in your numbers: (2 × (−6)³ − 9 × 1 × (−6) × 11 + 27 × 1² × (−6))/(27 × 1³)Answer: 0
  5. Find the discriminant Δ (a test number). Above 0 means three different real roots. Exactly 0 means some roots repeat. Below 0 means one real root and two complex roots (roots that use i = √−1).Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d²Put in your numbers: 18 × 1 × (−6) × 11 × (−6) − 4 × (−6)³ × (−6) + (−6)² × 11² − 4 × 1 × 11³ − 27 × 1² × (−6)²Answer: 4 → three distinct real roots
  6. Use the formula that fits this kind of cubic to find t. Then add back the shift to turn t into x.Δ > 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.
  7. These are the roots. Put any of them in place of x and the equation comes out as 0.RootsAnswer: x₁ = 1; x₂ = 2; x₃ = 3
  8. Check the answer: the roots always add up to −b/a and multiply to −d/a (Vieta's rules).Check (Vieta)Put in your numbers: x₁ + x₂ + x₃ = 6 = −b/a = 6; x₁·x₂·x₃ = 6 = −d/a = 6

Cubic equations in simple words

A cubic equation has an x³ (x times x times x) in it, like x³ − 6x² + 11x − 6 = 0. Solving it means finding the values of x that make the left side equal 0. These values are called roots.

A cubic always has three roots. Sometimes two or three of them are the same number. Sometimes only one is a normal (real) number and the other two are complex numbers, which use i, the square root of −1.

Example: try x = 1 in x³ − 6x² + 11x − 6. That is 1 − 6 + 11 − 6 = 0, so 1 is a root. Trying 2 and 3 works too, so the roots are 1, 2 and 3.

You enter a, b, c and d, the numbers in front of x³, x² and x and the number on its own. The calculator does the rest and shows each step.

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.

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.

References

Last updated . Results are estimates for informational purposes only.