Cubic Equation Solver
Solve ax³ + bx² + cx + d = 0 — all three roots, complex ones included, and whole ones written as whole numbers.
Runs entirely in your browser. Nothing is uploaded, logged or stored.
Roots
1 ; 2 ; 3
- What kind of solution
- three distinct real roots
- Discriminant
- 4
- How it was solved
- exactly, by factorising out a rational root
- Inflection point
- (2, 0)
Every cubic has three roots and at least one of them is real, which is the first thing that makes it unlike a quadratic: a curve that goes from minus infinity to plus infinity has to cross the axis somewhere. This gives all three, says which are repeated, and writes a whole root as a whole number.
How it works
Rational roots are looked for first. If a cubic with whole coefficients has a root p/q in lowest terms, then p divides the constant term and q divides the leading coefficient — so there is a short list of candidates and each one can be tested in whole numbers, with no rounding anywhere. A root found this way is divided out, and what remains is a quadratic.
That is not a shortcut, it is the difference between right and right-looking. The closed-form solution of a cubic runs into the casus irreducibilis: exactly when all three roots are real, the formula passes through cube roots of complex numbers, so in practice the trigonometric form is used — and it answers x³ − 6x² + 11x − 6 = 0 with 0.9999999998 instead of 1. Rounding the display would hide that, but not the real damage: with floating point the discriminant is never exactly zero, so a triple root looks like three separate roots that happen to print the same.
What has no rational root is solved numerically: the substitution x = t − b/3a removes the square term, and then either the trigonometric form or Cardano answers depending on the sign of the discriminant. The page says which of the two routes was taken, because one of them gives exact values and the other gives six decimal places.
Examples
| Case | Input | Result |
|---|---|---|
| Three whole roots | x³ − 6x² + 11x − 6 | 1, 2 and 3 |
| A triple root | x³ − 3x² + 3x − 1 | 1, three times |
| A fractional root | 2x³ − 3x² − 3x + 2 | −1, ½ and 2 |
| One real, two complex | x³ − 8 | 2, −1 ± i√3 |
Frequently asked questions
Can every cubic be solved by a formula?
Yes, and it is the last degree for which that is true in a useful sense. The quartic has one too, but from the fifth degree on there is no general solution in radicals at all — Abel and Ruffini proved it, and Galois explained why. Equations of higher degree are solved numerically, not by substituting into anything.
Why does it say a root is double or triple?
Because a cubic always has three roots once they are counted with multiplicity, and knowing that two of them have come together tells you the shape of the curve: at a double root it touches the axis and turns back instead of crossing. Printing the same number twice would not say that.
What is the inflection point for?
It is the centre of symmetry of the curve — every cubic is symmetric about it — and it is what the standard substitution moves to the origin in order to get rid of the square term. It plays the part the vertex plays for a parabola.
Good to know
- The exact route needs whole coefficients, or decimals that scale to whole ones, up to ten thousand. Past that the numeric route answers instead, which is accurate but cannot certify that a root is repeated.