What this calculator does
This tool solves any cubic equation of the form \(ax^3 + bx^2 + cx + d = 0\), returning all three roots. Depending on the equation the roots may be three distinct real numbers, a repeated real root, or one real root paired with two complex-conjugate roots. It is pure mathematics and works identically anywhere.
How to use it
Enter the four coefficients a, b, c and d. The leading coefficient a must be non-zero (otherwise the equation is not cubic). Choose how many significant digits to display, then read the three roots, the discriminant and the root classification.
The formula explained
We first normalize by dividing through by a, giving \(x^3 + Bx^2 + Cx + D = 0\). The substitution \(x = t - B/3\) removes the quadratic term and produces a depressed cubic \(t^3 + pt + q = 0\) with $$p = C - \frac{B^2}{3},\quad q = \frac{2B^3}{27} - \frac{BC}{3} + D.$$ The discriminant $$\Delta = \left(\frac{q}{2}\right)^2 + \left(\frac{p}{3}\right)^3$$ then tells us the case. When \(\Delta > 0\) there is one real and two complex roots (Cardano's radical form); when \(\Delta = 0\) there is a repeated real root; when \(\Delta < 0\) all three roots are real and we use the trigonometric form \(t_k = m\cdot\cos(\theta - 2\pi k/3)\). Finally each root is shifted back by \(-B/3\).
Worked example
For \(x^3 - 2x^2 - 11x + 12 = 0\) we get \(p = -37/3\), \(q = 4.07407\) and \(\Delta \approx -65.33 < 0\), so there are three real roots. The trigonometric form yields \(x = 4\), \(x = 1\) and \(x = -3\), which indeed factor as \((x-4)(x-1)(x+3)\).
FAQ
Why must a be non-zero? If \(a = 0\) the highest-degree term vanishes and the equation is at most quadratic, so Cardano's method does not apply.
What does the discriminant mean? Its sign classifies the roots: positive gives one real and two complex roots, zero gives a repeated real root, negative gives three distinct real roots.
How are complex roots shown? When present they appear as a conjugate pair \(re + im\cdot i\) and \(re - im\cdot i\); purely real roots have a zero imaginary part.