Cubic Equation Calculator
Solve a cubic equation of the form ax3 + bx2 + cx + d = 0. Enter the four coefficients a, b, c, and d to get all three roots (real and complex), the discriminant, the sum and product of roots via Vieta formulas, and a full step-by-step solution using Cardano formula and the trigonometric method.
Formula
Worked example
For x3 - 6x2 + 11x - 6 = 0: the Vieta discriminant is 18(1)(-6)(11)(-6) - 4(-6)3(-6) + (-6)2(11)2 - 4(1)(11)3 - 27(1)2(-6)2 = 7128 - 864 + 4356 - 5324 - 972 = 4324 > 0, so three distinct real roots. Depressing gives p = 11 - 36/3 = -1/3 and q values near zero, yielding roots x = 1, x = 2, x = 3. Vieta check: 1 + 2 + 3 = 6 = -(-6)/1. Confirmed.
What a cubic equation is and how it is solved
A cubic equation has the form ax3 + bx2 + cx + d = 0, where a is not zero. Because the leading term dominates at large magnitudes, the graph stretches from negative infinity on one side to positive infinity on the other, crossing the x-axis at least once. This guarantees every cubic has at least one real root. There are always exactly three roots when complex numbers are allowed. This calculator finds all three by depressing the cubic into the simpler form t3 + pt + q = 0 via a Tschirnhaus substitution, then applying Cardano formula for one-real-root cases and the numerically stable trigonometric method for three-real-root cases.
The discriminant and what it tells you
The discriminant of the general cubic, Delta = 18abcd - 4b3d + b2c2 - 4ac3 - 27a2d2, fully determines the root structure. When Delta > 0 there are three distinct real roots. When Delta < 0 there is one real root and two complex-conjugate roots of the form p + qi and p - qi. When Delta = 0 at least two roots coincide: if additionally the intermediate quantities p and q of the depressed cubic are both zero, all three roots are equal (a triple root); otherwise there is one simple root and one double root. This calculator computes Delta with your coefficients and reports the case so you know what to expect before looking at the numbers.
Complex roots in a + bi form
When the discriminant is negative, the two non-real roots form a complex-conjugate pair a + bi and a - bi, where i is the imaginary unit. Toggle "Show complex roots" to display them alongside the single real root. The real parts of all three roots still satisfy Vieta formulas: their sum equals -b/a and their product equals -d/a, regardless of whether some roots are complex. Complex roots arise naturally from Cardano formula and appear in many applied fields including control systems, signal processing, and fluid mechanics.
Vieta formulas and cross-checking your answer
Vieta formulas connect the roots x1, x2, x3 directly to the coefficients without solving the equation: x1 + x2 + x3 = -b/a, x1x2 + x1x3 + x2x3 = c/a, and x1 x2 x3 = -d/a. These give quick sanity checks. For the default example x3 - 6x2 + 11x - 6 = 0, the three roots are 1, 2, and 3, which sum to 6 = -(-6)/1, and multiply to 6 = -(-6)/1. If your computed roots fail these checks significantly, rounding or coefficient entry error is likely. Substituting each root into the original polynomial should also return approximately zero.
Degenerate cases: a = 0
If you enter a = 0 the equation is no longer cubic. The calculator silently degrades: with a non-zero b it solves the quadratic bx2 + cx + d = 0 using the quadratic formula, which may yield zero, one, or two real roots (plus a complex pair when the discriminant is negative). If b is also zero it solves the linear equation cx + d = 0, which has exactly one root unless c is also zero. Vieta formulas are not reported for degenerate cases because they apply specifically to three-root polynomials.
Discriminant cases for ax3 + bx2 + cx + d = 0
| Condition | Root type | Real roots | Notes |
|---|---|---|---|
| Delta > 0 | Three distinct real roots | 3 | Graph crosses x-axis three times |
| Delta = 0, not triple | One simple + one double root | 2 | Two roots coincide; graph is tangent to x-axis |
| Delta = 0, p = q = 0 | One triple root (x = -b/3a) | 1 | Graph inflects exactly on the x-axis |
| Delta < 0 | One real + two complex-conjugate roots | 1 | Complex pair shown in a+bi form |
The Vieta discriminant Delta = 18abcd - 4b3d + b2c2 - 4ac3 - 27a2d2 fully determines root structure.
Frequently asked questions
Why does a cubic always have at least one real root?
As x increases without bound the cubic term ax3 dominates and the function goes to positive infinity (if a > 0) or negative infinity (if a < 0). The opposite end goes the other way. A continuous function that goes from one sign to the opposite must cross zero somewhere, guaranteeing at least one real root.
How do I read the complex roots shown as a + bi?
When the discriminant is negative, two roots are complex conjugates. The notation a + bi means the real part is a and the imaginary part is b, where i squared equals -1. The conjugate a - bi is always paired with it. These roots appear in complex-conjugate pairs whenever coefficients are real.
What are Vieta formulas and how do I use them?
For ax3 + bx2 + cx + d = 0, Vieta formulas state: the sum of all roots equals -b/a, the sum of all pairwise products equals c/a, and the product of all roots equals -d/a. They hold even when two or more roots are complex. Use them to verify computed roots: if the roots do not satisfy these three identities, recheck your coefficients or look for rounding.
What is the discriminant of a cubic?
The discriminant Delta = 18abcd - 4b3d + b2c2 - 4ac3 - 27a2d2 determines root structure without solving the equation. Delta > 0 gives three distinct real roots, Delta = 0 gives a repeated root, and Delta < 0 gives one real root and two complex-conjugate roots. This calculator computes it and labels the case for you.
What if I set a to zero?
With a = 0 the equation is not cubic. The calculator degrades gracefully: it solves the quadratic bx2 + cx + d = 0 (possibly yielding complex roots if its discriminant is negative) or, if b is also zero, the linear equation cx + d = 0. Vieta outputs are hidden for these cases since they apply only to three-root polynomials.
How can I verify my answer?
Substitute each real root back into the original expression ax3 + bx2 + cx + d. A correct root evaluates to approximately zero (small rounding errors are normal from floating-point arithmetic). Also check that the sum of the three roots equals -b/a and their product equals -d/a using Vieta formulas.