Cubic Equation Calculator: Discriminant, Cardano and Trigonometric Roots
By FindMySum · Last reviewed
A cubic equation calculator solves ax³ + bx² + cx + d = 0 for all three roots, real and complex. Enter the four coefficients and this page gives the discriminant (which says what kind of roots to expect), the roots by Cardano's formula or the trigonometric method, any exact rational roots, the turning points and inflection point, and a graph showing where the curve crosses the x-axis. The default equation, x³ − 6x² + 11x − 6 = 0, has the roots 1, 2 and 3.
Step 1: the discriminant
The discriminant of a cubic is
Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d².
- Δ > 0: three distinct real roots.
- Δ = 0: a repeated root. If also b² = 3ac, all three roots are equal.
- Δ < 0: one real root and a pair of complex-conjugate roots.
For the default, a = 1, b = −6, c = 11, d = −6:
Δ = 18(1)(−6)(11)(−6) − 4(−216)(−6) + (36)(121) − 4(1)(1331) − 27(1)(36) = 7,128 − 5,184 + 4,356 − 5,324 − 972 = 4.
Δ is positive, so there are three distinct real roots.
Step 2: the depressed cubic
Substitute x = t − b/(3a) to remove the x² term. The equation becomes
t³ + pt + q = 0, with p = (3ac − b²)/(3a²) and q = (2b³ − 9abc + 27a²d)/(27a³).
For the default, the shift is −b/(3a) = 2, p = (33 − 36)/3 = −1 and q = (−432 + 594 − 162)/27 = 0. So t³ − t = 0, which factors as t(t − 1)(t + 1): t = −1, 0, 1, and x = t + 2 gives 1, 2 and 3.
Step 3a: one real root (Cardano)
When Δ < 0, the expression q²/4 + p³/27 is positive and Cardano's formula works directly:
t = ∛(−q/2 + √(q²/4 + p³/27)) + ∛(−q/2 − √(q²/4 + p³/27)).
For x³ + x + 1 = 0, p = 1 and q = 1, so q²/4 + p³/27 = 0.287. The cube roots are 0.3295 and −1.0118 (rounded), their sum t ≈ −0.6823 is the real root, and the complex pair is 0.3412 ± 1.1615i. The discriminant is −31.
Step 3b: three real roots (trigonometric method)
When Δ > 0, the square root in Cardano's formula is of a negative number, so the formula needs complex arithmetic to produce real answers, a situation called the casus irreducibilis. François Viète's trigonometric form avoids this:
t_k = 2√(−p/3) · cos(⅓ arccos((3q/(2p))√(−3/p)) − 2πk/3), for k = 0, 1, 2.
For x³ − 3x + 1 = 0 (p = −3, q = 1), this gives 2cos(40°), 2cos(160°) and 2cos(280°), that is 1.5321, −1.8794 and 0.3473. None of them is rational, and none can be written with real radicals alone.
Step 3c: repeated roots
When Δ = 0 and p ≠ 0, the roots of the depressed cubic are 3q/p (simple) and −3q/(2p) (double). For x³ − 3x + 2 = 0, that gives −2 and a double root at 1: the equation is (x − 1)²(x + 2) = 0, and the graph touches the x-axis at x = 1 without crossing it.
Exact rational roots
With integer (or rational) coefficients, the rational root theorem lists every possible rational root as ±p/q, p dividing d and q dividing a. The calculator tests them exactly and shows any that work as fractions. For 2x³ − 3x² − 11x + 6, the roots are −2, 1/2 and 3. If you want the factored form, the factoring calculator shows (2x − 1)(x + 2)(x − 3).
The graph: turning points and inflection
The derivative f′(x) = 3ax² + 2bx + c gives the turning points. For the default, 3x² − 12x + 11 = 0 at x = 2 ± 1/√3, about 1.42 (a local maximum, y ≈ 0.385) and 2.58 (a local minimum, y ≈ −0.385). The inflection point is always at x = −b/(3a), here (2, 0), exactly where the depressed cubic is centred. If 4b² − 12ac ≤ 0 the cubic has no turning points and is monotonic, so it has exactly one real root.
Checking the answer
Vieta's formulas relate the roots r₁, r₂, r₃ to the coefficients:
- r₁ + r₂ + r₃ = −b/a
- r₁r₂ + r₁r₃ + r₂r₃ = c/a
- r₁r₂r₃ = −d/a
For the default: 1 + 2 + 3 = 6, 2 + 3 + 6 = 11 and 1 × 2 × 3 = 6, all matching. The calculator also shows f at each real root, which should be zero to within rounding.
Common mistakes
- Setting a = 0. That is a quadratic; use the equation solver.
- Forgetting missing terms. x³ − 8 = 0 has b = 0 and c = 0.
- Expecting radicals for every root. Three irrational real roots usually have no real-radical form; the trigonometric values are exact in their own way.
- Dropping the complex roots. A cubic always has three roots; when only one is real, the other two are complex conjugates.
More questions
Is there a cubic formula like the quadratic formula?
Yes. Cardano's formula gives every root of a cubic in terms of square and cube roots of the coefficients, just as the quadratic formula does for quadratics. It is long when written out in a, b, c and d, so it is usually applied in two steps: first reduce to the depressed cubic t³ + pt + q = 0, then use the short formula in p and q.
Can a cubic have no real roots?
No. Complex roots of a polynomial with real coefficients come in conjugate pairs, so a cubic can have at most two complex roots, and the third must be real. Graphically, the curve starts at −∞ on one side and ends at +∞ on the other, so it crosses the x-axis at least once.
What is a depressed cubic?
A cubic with no x² term, t³ + pt + q = 0. Every cubic can be turned into one by the substitution x = t − b/(3a), which moves the inflection point to t = 0. The roots of the original equation are the roots of the depressed one, each shifted by −b/(3a).
Where do cubic equations appear outside maths class?
In the volume of a box cut from a sheet, in the van der Waals equation of state for gases, in beam deflection curves, in cubic splines used by graphics and CAD software, and in economics when cost or revenue curves are cubic. Many of these need the real root that makes physical sense.
How accurate are the decimal roots?
The calculator works in double precision and shows 10 significant figures, more than enough for any practical use. When a root is rational it is found exactly with the rational root theorem and shown as a fraction, so x = 1/3 is not reported as 0.3333333333.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.