Cubic Equation Solver
Solve equations of the form ax3 + bx2 + cx + d = 0
A cubic equation can bend, flatten, and turn in ways that a linear or quadratic equation cannot. That extra shape makes cubic equations useful in algebra, curve modeling, engineering approximations, optimization problems, and many physics formulas. It also makes them harder to solve by inspection. This calculator is designed to take the four coefficients of a cubic polynomial and return the roots clearly, including complex roots when the graph does not cross the x-axis three times.
When people say they want to “solve a cubic,” they usually mean they want the values of x that make the polynomial equal to zero. Those values are the roots, zeros, or x-intercepts of the function. Sometimes all three roots are real numbers. Sometimes one is real and the other two form a complex conjugate pair. Sometimes a root is repeated, which means the graph touches the axis and turns, or flattens as it crosses.
Use the form below exactly as written: enter the coefficient on the x3 term as a, the coefficient on the x2 term as b, the coefficient on the x term as c, and the constant term as d. If your equation is missing a term, enter 0 for that coefficient. For example, the equation x3 - 7x + 6 = 0 has a = 1, b = 0, c = -7, and d = 6.
How to use the solver without second-guessing yourself
The quickest way to make a mistake with polynomial solvers is not the algebra. It is putting the coefficients into the wrong slots. Read your equation from left to right and line it up with the standard form. If the original problem is written as 2x3 + 5 = 9x, rearrange it first: 2x3 - 9x + 5 = 0. Then enter a = 2, b = 0, c = -9, and d = 5. The calculator expects everything to be on one side of the equals sign.
After you click Solve Cubic, the result box lists each root. Real roots appear as ordinary decimals. Complex roots are shown in the form u + iv and u - iv. That pair always comes together because cubic equations with real coefficients produce complex roots in conjugate pairs. If the equation is actually quadratic or linear because a = 0, the solver automatically falls back to the simpler case and returns the appropriate result.
Unlike some calculators, this one does not require units because algebraic roots are often dimensionless. Still, if your variable x represents a physical quantity such as seconds, meters, or liters, then the roots inherit that same unit. A root of 2.5 means x = 2.5 in whatever unit your original variable uses.
What each input means
Coefficient a: the multiplier on the cubic term. This coefficient controls the overall orientation and scaling of the graph. If a is positive, the right side of the graph rises. If a is negative, the right side falls. When a is zero, the equation stops being cubic.
Coefficient b: the multiplier on the squared term. This affects the symmetry shift and helps determine where turning points appear. It also plays a major role in the substitution that simplifies the cubic into a depressed cubic.
Coefficient c: the multiplier on the linear term. It influences slope behavior and root placement, especially near the middle of the graph.
Coefficient d: the constant term. This is the value of the polynomial when x = 0. On a graph, it is the y-intercept. Changing d often shifts the curve upward or downward and can change how many times it crosses the x-axis.
How the formula works: Cardano's method in plain language
The JavaScript behind this calculator uses the standard reduction of a cubic to a simpler form. First, it removes the squared term by shifting the variable. That is the key move that turns the original cubic into a depressed cubic, which is easier to solve analytically. The substitution is:
After that substitution, the equation becomes:
with
The crucial quantity is the Cardano discriminant:
This sign tells you what kind of roots to expect. If Δ > 0, the cubic has one real root and two complex roots. If Δ = 0, at least two roots coincide, so the cubic has a repeated root. If Δ < 0, the cubic has three distinct real roots. The solver uses these cases directly, which is why the output changes format depending on the equation you enter.
How to interpret the answer
The most important thing to remember is that a root is not automatically “the best” root. It is simply a value of x that makes the polynomial equal zero. In an abstract algebra problem, every root matters equally. In an applied problem, only some roots may be physically meaningful. For example, a negative time or a complex concentration may not make sense in a real-world model, even though it is a correct mathematical solution. The calculator gives you the mathematics; you still decide which roots fit the context of your problem.
It is also useful to connect the roots to the graph. Every real root corresponds to a point where the cubic meets the x-axis. A repeated root is usually where the curve touches and turns, while a simple root is where it crosses cleanly. When the calculator returns complex roots, that does not mean the equation failed. It means the graph did not have enough real x-intercepts to supply all three solutions as real numbers.
Worked example: three real roots
Take the equation x3 - 6x2 + 11x - 6 = 0. Enter a = 1, b = -6, c = 11, and d = -6. This cubic factors neatly as (x - 1)(x - 2)(x - 3), so you already know the answers should be 1, 2, and 3. The solver should return those three real roots, up to ordinary decimal rounding.
This example is useful because it shows what “three real roots” looks like numerically. The graph crosses the x-axis three separate times, and the discriminant case falls into the three-real-root branch. If your calculator output comes back with three decimals near 1.000000, 2.000000, and 3.000000, that is a good sign that your coefficient order is correct.
Worked example: one real root and two complex roots
Now consider x3 + x + 1 = 0. Here the coefficients are a = 1, b = 0, c = 1, and d = 1. This equation has only one real intercept on the graph, so the calculator returns one real number and one complex conjugate pair. That pair is not extra decoration. It completes the algebraic requirement that a cubic has three roots when multiplicity is counted.
If you are checking your own work, a useful sanity check comes from Vieta's formulas: for a true cubic with a ≠ 0, the sum of the three roots should equal -b/a. When b = 0, the roots should add to zero. Complex conjugates make this work because their imaginary parts cancel in the sum.
Edge cases, assumptions, and numerical details
This solver is built for practical use, so it also handles near-degenerate cases. If a is extremely small, the code treats the equation as quadratic rather than pretending that a tiny cubic term is meaningful. If both a and b are effectively zero, it falls back again to the linear case. That behavior is intentional because real data often contains rounded coefficients that are almost, but not exactly, zero.
Results are displayed to six decimal places. That is a readability choice, not a claim that every input supports six meaningful digits. If you work with very large or very small coefficients, numerical rounding can make repeated roots look slightly separated or make a theoretical zero appear as a tiny decimal. In most normal use cases, this is expected and harmless. If you need symbolic exactness, factorization software or a computer algebra system is the better tool.
The calculator assumes the coefficients are real numbers. It does not accept symbolic expressions, fractions written with slashes, or coefficients that are themselves complex. Enter decimals instead, such as 0.5 for one-half. You can also use negative values. If a term is missing, do not leave the field empty; enter 0 so the polynomial is defined correctly.
A broader note on formulas and calculator design
This page is specifically about cubic equations, but the general design pattern behind calculators is still worth understanding. A calculator turns a set of inputs into an output according to a fixed function. In its most generic form, that idea looks like this:
Some calculators also combine contributions from several components, weights, or sub-models. A generic weighted total can be written as:
Those formulas are more general than a cubic solver, but they show the same underlying principle: clean inputs, a defined rule, and an output that you can inspect. In this page, the rule happens to be Cardano's method plus a fallback for quadratic and linear equations. The better you understand that structure, the easier it becomes to trust correct results and spot incorrect inputs.
Mini-game: Root Radar
This optional mini-game turns root finding into a fast graph-reading challenge. Each round shows a new cubic curve on the canvas. Your job is to aim a vertical solver beam and click or tap exactly where the graph crosses the x-axis. Some rounds have three real roots, some have only one, and the HUD tells you how many real intercepts are still needed. It is a playful way to build intuition for the same idea the calculator uses: roots are the x-values where the polynomial becomes zero.
Wave equation: ready to generate a cubic.
Takeaway: on a graph, every real root is an x-axis crossing. Complex roots still count algebraically, but they do not appear as extra x-intercepts.
