Cubic Equation Calculator (Solve ax³ + bx² + cx + d = 0)

Every cubic equation has three roots: either three real roots or one real root and a pair of complex conjugates. This cubic equation calculator finds all three from the coefficients a, b, c and d, using Cardano's formula when there is one real root and the trigonometric method when there are three, and shows the discriminant that tells you which case you have.

calculated
calculated
calculated
calculated
Δ > 0 — three distinct real roots
calculated
calculated
calculated
calculated
Type in any field to change it. Press × on a value to calculate that field instead.

How to use the cubic equation calculator

Write your equation in the form ax³ + bx² + cx + d = 0 and enter the four coefficients (use 0 for a missing term — for x³ − 2x − 5 = 0 enter a = 1, b = 0, c = −2, d = −5). The calculator gives the depressed-cubic values p and q, the discriminant, and the three roots. When there is only one real root, x₂ and x₃ show the real part of the complex pair and the last result shows its imaginary part. The coefficient a must not be zero — with a = 0 the equation is a quadratic.

Cubic formula

x = t − b ÷ 3a  ·  t³ + pt + q = 0  ·  p = (3ac − b²) ÷ 3a²  ·  q = (2b³ − 9abc + 27a²d) ÷ 27a³

One real root (Cardano): t = ∛(−q/2 + √D) + ∛(−q/2 − √D),   D = (q/2)² + (p/3)³ > 0

Three real roots: tk = 2√(−p/3) · cos[⅓ arccos((−q/2) ÷ √(−(p/3)³)) − 2πk/3],   k = 0, 1, 2

The trigonometric form avoids the cube roots of complex numbers that Cardano’s formula needs when all three roots are real (the “casus irreducibilis”).

Worked examples

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

  • p = (3 × 11 − 36) ÷ 3 = −1, q = (2 × (−216) − 9 × (−66) + 27 × (−6)) ÷ 27 = 0
  • D = (q/2)² + (p/3)³ = −0.037037 (negative), discriminant Δ = 4 — three distinct real roots
  • Roots: x₁ = 3, x₂ = 2, x₃ = 1 — so the equation factors as (x − 1)(x − 2)(x − 3)

x³ − 2x − 5 = 0 (the equation Newton used to demonstrate his method):

  • p = −2, q = −5, D = 5.953704 (positive), Δ = −643 — one real root
  • x₁ = 2.094551, x₂, x₃ = −1.047276 ± 1.135940i

Example cubic equations

Equation Discriminant Δ Roots Values
x³ − 6x² + 11x − 6 = 0 4 three distinct real 3, 2, 1
x³ − 2x − 5 = 0 −643 one real, two complex 2.095; −1.047 ± 1.136i
x³ − 3x + 2 = 0 0 repeated real root 1, −2
x³ − 1 = 0 −27 one real, two complex 1; −0.5 ± 0.866i
2x³ − 4x² − 22x + 24 = 0 1.129e+05 three distinct real 4, 1, −3
x³ + x + 1 = 0 −31 one real, two complex −0.6823; 0.3412 ± 1.162i
x³ − 15x − 4 = 0 1.307e+04 three distinct real 4, −0.2679, −3.732

Practical notes

  • Results are rounded; a repeated root may show tiny differences such as 0.999999 and 1.000001 because of floating-point arithmetic.
  • To factor a cubic with an integer root r, divide by (x − r) to leave a quadratic — the rational root theorem says any rational root is a factor of d divided by a factor of a.
  • Cubic equations appear in the van der Waals and Peng–Robinson equations of state, beam deflection, box-volume optimisation and interest-rate problems.

Frequently asked questions

How do you solve a cubic equation?

Divide by a and substitute x = t − b/(3a) to get the depressed cubic t³ + pt + q = 0. If (q/2)² + (p/3)³ > 0, Cardano's formula t = ∛(−q/2 + √…) + ∛(−q/2 − √…) gives the one real root; otherwise the three real roots are t = 2√(−p/3) cos[(1/3) arccos((−q/2)/√(−(p/3)³)) − 2πk/3], k = 0, 1, 2.

What does the discriminant of a cubic tell you?

Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². If Δ > 0 there are three distinct real roots, if Δ = 0 at least two roots are equal, and if Δ < 0 there is one real root and two complex conjugate roots.

Does every cubic have a real root?

Yes. A cubic goes to +∞ at one end and −∞ at the other, so its graph must cross the x-axis at least once. Complex roots of a real cubic always come in conjugate pairs.

Can I check the roots?

The roots satisfy x₁ + x₂ + x₃ = −b/a, x₁x₂ + x₁x₃ + x₂x₃ = c/a and x₁x₂x₃ = −d/a (Vieta's formulas). For x³ − 6x² + 11x − 6 the roots 1, 2 and 3 add to 6 and multiply to 6.

Embed this calculator

Free to use on your website or blog. Copy this code: