Free Online Cubic Equation Solver With All Three Roots
Solve a cubic equation of the form ax cubed plus bx squared plus cx plus d and get all three roots, real and complex. Repeated roots are reported as repeated instead of as two slightly different numbers, every root is substituted back into your own equation as a check, and the Cardano working is shown step by step.
The sum runs in your browser. Nothing you type is sent anywhere.
π The equation
Four coefficients, read as ax³ + bx² + cx + d = 0. Leave a as zero and it is solved as a quadratic instead of being refused.
A cubic is solved by removing the squared term first, which turns it into t³ + pt + q = 0. The sign of the discriminant then decides which formula applies.
| Step | Value | What it means |
|---|
Every root put back into the equation you typed. A root makes the left side zero, so this column is the real test of the answer.
| Root | Value | The equation at that value |
|---|
| When | Calculation | Actions |
|---|
Number formatting
Rounding only changes what you see. The sum itself always runs at full precision, so a rounded number never feeds into the next step.
Display
Full screen hides the page around the tool. Press Escape, or the button in the bar, to come back.
History
Your data
Settings, history and saved setups live in this browser and nowhere else. There is no account and no server, which also means clearing them here is final.
Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.
How to Solve a Cubic Equation
Three steps, and the third is the one that proves it.
What to Know About Cubic Equations
Three roots always, and the one place other solvers go wrong.
2x³ - 11x² + 12x + 9 the roots are 3, 3 and minus a half. Cardanoβs formula produces two nearly equal numbers there, and a solver that prints them gives you 2.99999994 and 3.00000006, which is not an answer, it is noise. Here the discriminant is examined first and the repeated case uses its own formula, which gives exactly 3.
Key Features & Capabilities
What it does, and what it deliberately does not.
About Cubic Equations
A cubic equation is one in which the highest power of the unknown is three. Unlike a quadratic it always has at least one real root, because the curve runs from minus infinity to plus infinity and has to cross zero somewhere, and counted properly it always has exactly three. Those three may be three separate real numbers, or one real number and a pair of complex ones, or the same number appearing twice or three times over.
There is a formula, published by Cardano in 1545, and it works. The method is to remove the squared term by a substitution, which turns the equation into the simpler shape t cubed plus pt plus q, and then to solve that. What the formula is not is numerically well behaved in every case, and the case where it misbehaves is a common one: the repeated root.
At a repeated root the formula subtracts two quantities that are nearly equal, and the digits that survive are the ones that carry the error rather than the answer. The published roots of two x cubed minus eleven x squared plus twelve x plus nine are three, three and minus one half, and a straightforward implementation returns 2.99999994 and 3.00000006 for the first two. Numpy does exactly this. Printing those two numbers is worse than useless, because it reports a single root as two distinct ones and invites you to believe the curve crosses the axis twice near three when it touches it once.
The fix is to look at the discriminant before choosing a formula. When it is zero within the tolerance that the size of the coefficients implies, the repeated case has its own closed form, derived by writing the cubic as t minus alpha squared times t minus beta and reading off the coefficients, and that form gives exactly three. The other correctness decision is to switch off the usual Newton cleanup there, because the derivative vanishes at a repeated root and the cleanup divides by it. Everywhere else one Newton step is applied, bounded so that it can tidy a root but never move it.
Whichever branch runs, the answer is then checked the same way: each root is substituted into the coefficients you typed and the value of the left hand side is printed. A root makes it zero. That check uses your equation rather than the derived one, so it catches an error anywhere in the chain, and it is shown rather than merely performed.
Frequently Asked Questions
Complex roots, repeated roots, and what the discriminant tells you.