Cubic Equation Calculator
The three roots of ax³ + bx² + cx + d = 0, real or complex, with the discriminant that says which kind to expect, by the trigonometric and Cardano methods.
Result
First root: 3
Roots shown to ten significant figures.
- Second root
- 2
- Third root
- 1
- The roots are
- Three distinct real roots: the discriminant is positive.
- Discriminant, Δ
- 4
https://calcgallery.com/algebra-numbers/cubic-equation-calculator/
Results follow the mathematical operation and values shown. Check that you selected the intended operation, convention and dataset type before relying on the result. Read the full disclaimer
How to use the Cubic Equation Calculator
- Write the equation as ax³ + bx² + cx + d = 0, moving every term to one side.
- Enter a, b, c and d, with minus signs, and 0 for any missing power.
- Read the three roots, largest real root first, and whether they are real or complex.
The method
Dividing by a and substituting x = t − b ÷ 3a removes the x² term and leaves the depressed cubic
t³ + pt + q = 0p = (3ac − b²) ÷ 3a² q = (2b³ − 9abc + 27a²d) ÷ 27a³
With three real roots, t = A sin α, A sin(α + 120°) and A sin(α + 240°), where A = √(−4p ÷ 3) and sin 3α = 4q ÷ A³. With one real root, Cardano’s formula gives it as the sum of two cube roots, t = u + v, and the complex pair as −t ÷ 2 ± i(√3 ÷ 2)(u − v).
Repeated roots
The page decides which case applies from the discriminant, worked out in exact arithmetic from the coefficients exactly as you typed them, decimals included. Ordinary computer arithmetic cannot hold 0.03 or 0.001 exactly, and its rounding can tip a discriminant of 0 a hair either side. Worked exactly, x³ − 3x + 2 has discriminant 0 and is reported as the repeated root 1 and the root −2, and x³ − 0.3x² + 0.03x − 0.001, which is (x − 0.1)³, as 0.1 three times. A repeated root is then found from a formula in the coefficients, since it is also a root of the derivative 3ax² + 2bx + c.
For other cubics, the trigonometric or Cardano form gives a first estimate, which is refined with Newton’s method on your original equation. That matters when a is small next to the other coefficients: for 0.000000001x³ + x² − 1 the substitution alone loses every digit of the two roots near 1 and −1, and the refined roots are 0.9999999995 and −1.000000001.
Checking a root
Put a root back into the equation: 3³ − 6 × 3² + 11 × 3 − 6 = 0. Roots are shown to ten significant figures, so an irrational root such as −0.2679491924 leaves a tiny remainder when substituted. For a quadratic, the quadratic formula calculator gives the same kind of answer, and the graphing calculator shows where the curve crosses zero.
With your numbers
- Δ > 0: three real roots, by the trigonometric method
- t = A sin α, A sin(α + 2π/3), A sin(α + 4π/3), then x = t − b ÷ 3a
- Each root is then refined by Newton’s method on the original equation
Quick reference
Roots shown to ten significant figures.
| Example | First root |
|---|---|
| x³ − 6x² + 11x − 6 | 3 |
| x³ − 1 | 1 |
| x³ + x + 1 | −0.6823278038 |
| x³ − 3x + 2 | 1 |
| x³ − 3x² + 3x − 1 | 1 |
| 2x³ − 4x² − 22x + 24 | 4 |
| x³ − 15x − 4 | 4 |
Common questions about the Cubic Equation Calculator
- How many roots does a cubic have?
- Always three, counted with repeats, and at least one of them is real, because the graph of a cubic runs from minus infinity to plus infinity and must cross the x-axis. The other two are either both real or a complex pair of the form p + qi and p − qi.
- What does the discriminant tell me?
- Which kind of roots to expect. Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². If it is positive there are three different real roots; if it is zero, real roots with at least one repeated; if it is negative, one real root and a complex pair. For x³ − 6x² + 11x − 6 it is 4, and the roots are 3, 2 and 1.
- Why not just use Cardano’s formula?
- When all three roots are real, Cardano’s formula takes cube roots of complex numbers even though the answers are real. The trigonometric method avoids that, so the page uses it for three real roots and Cardano’s formula only when there is one.
- What if a is zero?
- Then there is no x³ term and the equation is really a quadratic, bx² + cx + d = 0, or a linear one if b is zero too. The page solves whichever it is and says so, rather than dividing by zero.