Cubic Equation Calculator

Solve ax³ + bx² + cx + d = 0. Find all real and complex roots instantly with Cardano's method.

Enter a, b, c, and d for ax³ + bx² + cx + d = 0. The calculator depresses the cubic, computes the discriminant, and solves for all three roots — real or complex — showing the full method used.

Enter ax³ + bx² + cx + d = 0 Cardano's method
x³ (≠ 0)
x
constant

What is a cubic equation?

A cubic equation is a polynomial equation of degree three: ax³ + bx² + cx + d = 0, where a is not zero. Every cubic equation has exactly three roots when complex roots are counted, though how many of those roots are real numbers depends on the specific coefficients.

Unlike quadratics, which always split cleanly into “two real roots, one repeated root, or two complex roots” based on a single discriminant sign, cubics always have at least one real root — a fact that follows from basic calculus (a cubic function goes from −∞ to +∞, or vice versa, and so must cross zero somewhere) even before any algebra is done. The remaining question is whether the other two roots are also real, or form a complex conjugate pair.

Standard formax³ + bx² + cx + d = 0, a ≠ 0

Solving a general cubic exactly, by hand, is significantly more involved than solving a quadratic — the method used here, discovered in the 1500s and generally credited to Gerolamo Cardano (though its history involves several other Italian mathematicians of the period, including Scipione del Ferro and Niccolò Fontana Tartaglia, in a genuinely dramatic priority dispute), is the standard closed-form approach. It remains, to this day, essentially the only general closed-form method — there’s no simpler shortcut analogous to the quadratic formula, though special cases (like a cubic that happens to factor nicely) can sometimes be solved faster by inspection or by the rational root theorem.

Depressing the cubic

The first move in Cardano’s method is to eliminate the x² term through a substitution, producing a simpler “depressed” cubic with no squared term at all.

Substitutionx = t − b/(3a)

After normalizing so the leading coefficient is 1 (dividing every term by a) and applying this substitution, the equation reduces to a depressed cubic in t:

Depressed cubict³ + pt + q = 0

where, using the normalized coefficients (b/a, c/a, d/a in place of b, c, d):

p and qp = c − b²/3     q = 2b³/27 − bc/3 + d

Once t is found, converting back to the original variable is a matter of reversing the substitution: x = t − b/(3a).

The discriminant

The depressed cubic’s discriminant determines which of three qualitatively different root situations applies:

DiscriminantD = q²/4 + p³/27
Value of DRoot situation
D > 0One real root, two complex conjugate roots
D = 0All roots real; at least two are equal (a repeated root)
D < 0Three distinct real roots

This D is specific to the depressed-cubic normalization used here — it’s related to, but not numerically identical to, other “cubic discriminant” formulas that appear elsewhere written directly in terms of a, b, c, d. Both approaches correctly classify the roots; this article and calculator consistently use the p, q-based D throughout.

Case: one real root, two complex (D > 0)

When D is positive, Cardano’s formula produces the roots directly:

Cardano's formulau = ∛(−q/2 + √D)    v = ∛(−q/2 − √D)

The single real root is t = u + v. The two complex conjugate roots come from:

Complex pairt = −(u+v)/2 ± i(u−v)√3/2

All three values then get shifted back with x = t − b/(3a) to give the final roots of the original cubic.

Case: three distinct real roots (D < 0)

This case is historically called the casus irreducibilis (“irreducible case”) because Cardano’s cube-root formula above technically still works here, but only by passing through complex intermediate values before arriving back at a real final answer — an early, unsettling example of complex numbers being mathematically necessary even to describe purely real quantities. In practice, a cleaner trigonometric method avoids complex intermediate steps entirely:

Trigonometric solutiont_k = 2√(−p/3) · cos[(θ + 2πk)/3]   for k = 0, 1, 2

where θ = arccos(−q/2 ÷ √(−p³/27)). This calculator uses this trigonometric form specifically for the three-real-root case, since it’s both simpler to compute and avoids any floating-point round-trip through complex numbers along the way.

Case: a repeated root (D = 0)

At exactly D = 0, two of the three roots coincide. With u = ∛(−q/2):

Repeated-root caset = 2u   (single root)     t = −u   (double root)

In practice, D lands exactly on zero only for specially chosen coefficients — this calculator treats any D extremely close to zero (within floating-point rounding tolerance) as this case, to avoid the trigonometric method’s formula dividing by a near-zero quantity.

Worked example

Solve x³ − 6x² + 11x − 6 = 0.

Since a = 1 already, p = 11 − 36/3 = 11 − 12 = −1, and q = 2(−6)³/27 − (−6)(11)/3 + (−6) = −16 + 22 − 6 = 0. The discriminant D = 0²/4 + (−1)³/27 = −1/27, which is negative — the three-real-root case applies.

Working through the trigonometric formula (or simply verifying by factoring): x³ − 6x² + 11x − 6 factors as (x−1)(x−2)(x−3), giving roots x = 1, 2, and 3 — three distinct real roots, matching the D < 0 classification.

Rootsx = 1, x = 2, x = 3

Worked example: one real root, two complex

Solve x³ − 8 = 0 (equivalently, find the cube roots of 8).

Here a=1, b=0, c=0, d=−8. Since b=0, no depression substitution is actually needed (p=c=0, q=d=−8). D = (−8)²/4 + 0³/27 = 16, which is positive — the one-real-root case applies.

Computing u = ∛(−q/2 + √D) = ∛(4 + 4) = ∛8 = 2, and v = ∛(−q/2 − √D) = ∛(4 − 4) = ∛0 = 0. The real root is t = u + v = 2. The complex pair: re = −(u+v)/2 = −1, im = (u−v)√3/2 = √3.

Rootsx = 2,   x = −1 + i√3,   x = −1 − i√3

This matches the well-known fact that the three cube roots of a positive real number are the real cube root itself, plus two complex roots spaced evenly around a circle in the complex plane — a pattern that generalizes to the nth roots of any nonzero number.

Checking your answer

The most direct check for any claimed root is substitution: plug it back into the original equation and confirm the result is zero (or extremely close to zero, allowing for floating-point rounding). For the example above, 1³ − 6(1)² + 11(1) − 6 = 1 − 6 + 11 − 6 = 0, confirming x = 1 is genuinely a root.

A second useful check, when all three roots are known, comes from Vieta’s formulas: the sum of the roots should equal −b/a, and the product of the roots should equal −d/a. For the example above: 1 + 2 + 3 = 6, and −b/a = −(−6)/1 = 6 — matches. The product 1×2×3 = 6, and −d/a = −(−6)/1 = 6 — also matches.

These same two checks work even when two of the roots are complex: complex conjugate pairs always sum to a real number (twice their shared real part) and multiply to a real number too (the sum of the squares of their real and imaginary parts), so the full three-root sum and product both come out real, exactly matching −b/a and −d/a, even though two of the individual roots aren’t real numbers on their own.

Common mistakes to avoid

Forgetting to normalize before depressing the cubic. The p and q formulas above assume the leading coefficient has already been divided out (a = 1). Applying them directly to un-normalized b, c, d values from a cubic where a ≠ 1 produces an entirely different, incorrect depressed cubic.

Mixing up which discriminant convention is in use. Several different but related “discriminant” formulas exist for cubics in the wider literature, with different sign conventions for which range corresponds to three real roots versus one. This article and calculator consistently use D = q²/4 + p³/27 with D < 0 meaning three real roots — worth double-checking against whichever source a formula was pulled from if cross-referencing outside material.

Applying the D > 0 (Cardano radical) formula directly in the D < 0 case. While mathematically valid in principle, doing so requires working with complex cube roots and carefully selecting the correct branch — a process prone to sign and branch-selection errors when done by hand. The trigonometric method exists specifically to sidestep this difficulty.

Forgetting to shift back with x = t − b/(3a). All three formulas above solve for t, the depressed cubic’s variable — every value must be shifted back to get the actual roots of the original ax³+bx²+cx+d=0 equation in terms of x.

Assuming a cubic must have an “ugly” closed-form answer. Many cubics that appear in textbook problems are deliberately constructed to factor nicely — it’s always worth checking a handful of small integer values (using the rational root theorem as a guide, if the leading and constant coefficients are integers) before reaching for the full Cardano machinery. The worked examples in this article were chosen specifically because they factor cleanly, but plenty of real-world cubics genuinely don’t, and Cardano’s method (or this calculator) is the reliable fallback either way.

Real-world applications

Engineering: beam deflection and structural analysis. Some structural engineering problems involving beam deflection under combined loads reduce to cubic equations, where the real roots correspond to physically meaningful deflection or stress values — and where the D < 0 (three real roots) case often matters most, since a structure can genuinely have multiple physically valid equilibrium states.

Chemistry: equations of state. The van der Waals equation of state, used to model real (non-ideal) gas behavior more accurately than the ideal gas law, is cubic in molar volume for a given pressure and temperature — solving it is a direct application of exactly the methods in this article. Near a substance’s critical point, this cubic can have three real roots, corresponding physically to coexisting liquid and vapor phases plus an unstable intermediate state.

Finance: yield and rate-of-return problems. Certain multi-period interest and yield calculations, particularly those involving three cash-flow periods, reduce algebraically to a cubic equation in the unknown rate. Only real, and usually only positive, roots correspond to economically meaningful interest rates, which is why financial software solving these often discards complex or negative roots even when the underlying cubic technically has them.

Geometry and physics: volume and optimization problems. Problems that ask for a dimension given a fixed volume — such as finding the side length of a box with a specified volume and other constrained dimensions — often produce a cubic equation in the unknown length, especially once the constraint is substituted into the volume formula. As with the finance case, only positive real roots typically correspond to physically sensible dimensions, even when the cubic itself has complex or negative roots as well.

Frequently asked questions
What method does this calculator use to solve cubic equations?
Cardano's method: the cubic is first normalized and depressed (the x² term eliminated) via substitution, then solved using either the direct cube-root formula (when there's one real and two complex roots) or a trigonometric formula (when there are three distinct real roots).
How many roots does a cubic equation have?
Always exactly three, counting complex roots and any repeated roots. At least one of those three is always a real number — a cubic function's graph must cross the x-axis somewhere, since it extends to +∞ on one side and −∞ on the other.
What determines whether a cubic has one or three real roots?
The discriminant D = q²/4 + p³/27, computed from the depressed cubic's p and q. D > 0 means one real root and two complex conjugate roots; D < 0 means three distinct real roots; D = 0 means all roots are real with at least two equal.
What is the casus irreducibilis?
It's the historical name for the three-real-roots case (D < 0), so called because Cardano's direct cube-root formula technically still applies there but requires passing through complex intermediate values to reach a real final answer. A trigonometric formula avoids this and is used instead.
How can I check that a cubic's roots are correct?
Substitute each root back into the original equation and confirm it evaluates to zero (or very close to zero, allowing for rounding). You can also check that the roots' sum equals −b/a and their product equals −d/a, using Vieta's formulas.
Can a cubic equation have no real roots?
No. Every cubic with real coefficients has at least one real root — this follows from the fact that a cubic function is continuous and goes to +∞ in one direction and −∞ in the other, so it must cross zero at least once.
What happens if a = 0?
The equation is no longer cubic — it becomes a quadratic (or lower). This calculator requires a ≠ 0 and will show an error if a is entered as zero.