Cubic Equation Calculator
The real roots of ax³ + bx² + cx + d = 0, by Cardano or the trigonometric form, with each root checked.
Results
What this tool does
A cubic always has at least one real root — the curve has to cross the axis somewhere — and may have three. Finding them exactly took mathematicians until the sixteenth century and produced one of the strangest episodes in the history of algebra: the formula that works for three real roots demands a detour through imaginary numbers. This page takes the shorter way, using Cardano's method where it behaves and the trigonometric form where it does not, and substitutes every root back into your equation so you can see it really is a root.
Formula
x = y − b ÷ 3a ⟹ y³ + p y + q = 0 · Δ = (q ÷ 2)² + (p ÷ 3)³
Variables
| Symbol | Meaning | Unit |
|---|---|---|
a | a | — |
b | b | — |
c | c | — |
d | d | — |
R1 | Root x₁ | — |
R2 | Root x₂ | — |
R3 | Third root | — |
KD | What kind of roots | — |
TB | Root · what the equation gives there | — |
NR | Real roots found | — |
RS | Largest mismatch when substituted back | — |
DS | The discriminant | — |
SR | The roots added up | — |
PP | p, after removing the square term | — |
PQ | q, after removing the square term | — |
Worked example
- a1
- b-6
- c11
- d-6
- Root x₁1.0000000000
- Root x₂2.0000000000
- Third root3.0000000000
- What kind of rootsThree different real roots
- Root · what the equation gives there1 0 2 0 3 0
- Real roots found3
- Largest mismatch when substituted back8.88178e-16
- The discriminant-0.0370370370
- The roots added up6.0000000000
- p, after removing the square term-1.0000000000
- q, after removing the square term0.0000000000
Frequently asked questions
Why are there two different methods?
Because Cardano's formula, for all its fame, breaks down in the one case people care about most. When a cubic has three distinct real roots, the discriminant is negative and Cardano's method asks for the cube root of a complex number — the three real answers are reachable only by travelling through imaginary numbers and back. That situation was historically called the irreducible case and it embarrassed sixteenth-century mathematicians considerably. The trigonometric form avoids it entirely: it writes the roots as cosines of a third of an angle and stays in the real numbers throughout. This page uses Cardano when there is one real root and the trigonometric form when there are three.
What is the residual column for?
It substitutes each root back into the original equation and shows what comes out, which should be zero. Cubic formulas involve cube roots and cancellations that can lose precision badly, so this is not a formality — a residual of 1e-15 means the root is as good as floating point allows, while a residual of 1e-4 means the answer is only approximate and you should refine it with Newton's method. Showing it lets you judge rather than trust.