Cubic Equation Calculator
Test cases replayed : 4 of 4 match · Methodology · No outside source listed
Enter the four coefficients of ax³ + bx² + cx + d = 0 to get its three roots.
Result
Root x₁ (real)
Depressed cubic t³ + pt + q: p
- Depressed cubic: q
- Discriminant test (q/2)² + (p/3)³
- Type of roots
- Root x₂ (real part if complex)
- Root x₃ (real part if complex)
- Imaginary part ± of x₂ and x₃ (0 if real)
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- a (coefficient of x³, not 0): enter a number.
- b (coefficient of x²): enter a number.
- c (coefficient of x): enter a number.
- d (constant term): enter a number.
- Read the result: Root x₁ (real); the panel also shows Depressed cubic t³ + pt + q: p, Depressed cubic: q, Discriminant test (q/2)² + (p/3)³, Type of roots, Root x₂ (real part if complex), Root x₃ (real part if complex) and Imaginary part ± of x₂ and x₃ (0 if real).
How this calculator works
Substituting x = t − b ÷ 3a gives the depressed cubic t³ + pt + q = 0 with p = (3ac − b²) ÷ 3a² and q = (2b³ − 9abc + 27a²d) ÷ 27a³.
If (q/2)² + (p/3)³ > 0 there is one real root, given by Cardano's formula t = ∛(−q/2 + √Δ) + ∛(−q/2 − √Δ), and two complex conjugate roots.
Otherwise the three roots are real and the trigonometric method (Viète) gives them: t_k = 2√(−p/3) cos(⅓ arccos((3q ÷ 2p)√(−3/p)) − 2πk/3), k = 0, 1, 2. Results are rounded to 9 decimal places.
Worked example
| a (coefficient of x³, not 0) | 1 |
|---|---|
| b (coefficient of x²) | -6 |
| c (coefficient of x) | 11 |
| d (constant term) | -6 |
| Depressed cubic t³ + pt + q: p | -1 |
|---|---|
| Depressed cubic: q | 0 |
| Discriminant test (q/2)² + (p/3)³ | -0.037 |
| Type of roots | Three real roots (some may be repeated) |
| Root x₁ (real) | 3 |
| Root x₂ (real part if complex) | 2 |
| Root x₃ (real part if complex) | 1 |
| Imaginary part ± of x₂ and x₃ (0 if real) | 0 |
Frequently asked questions
How many roots does a cubic equation have?
Exactly three, counted with multiplicity, of which at least one is real. The other two are either both real or a pair of complex conjugates.
What are the roots of x³ − 6x² + 11x − 6 = 0?
3, 2 and 1, since it factors as (x − 1)(x − 2)(x − 3).
What does a repeated root look like?
The graph touches the x-axis without crossing it. x³ − 3x + 2 = (x − 1)²(x + 2) has the double root 1 and the root −2.