About the Cubic Equation Solver
This cubic equation solver finds every root of a third-degree polynomial equation ax³ + bx² + cx + d = 0. Enter the four coefficients and it returns all three roots — real or complex — along with the discriminant, a plain-English description of the roots, and a graph of y = f(x) so you can see where the curve crosses the x-axis.
It suits algebra and precalculus students checking homework, engineers solving characteristic equations, and anyone who needs the roots of a cubic quickly without working through Cardano’s formula by hand. Every cubic with real coefficients has at least one real root; the other two are either real or a complex conjugate pair.
Roots are computed in closed form (the trigonometric method when all three are real, Cardano’s formula otherwise) and refined with Newton’s method for accuracy. Calculations use standard double precision, so roots that are extremely close together (differing by less than about one millionth of their size) may be shown as a repeated root. If you set a = 0 the tool solves the remaining quadratic or linear equation instead.
How to use the cubic equation solver
- 1Write your equation in the form ax³ + bx² + cx + d = 0.
- 2Enter a, b, c and d (use 0 for missing terms and negative signs where needed).
- 3Read all three roots; complex roots appear as p ± qi.
- 4Check the discriminant and the graph to see how many times the curve crosses zero.
Formula and method
Substituting x = t − b/(3a) removes the x² term and gives the depressed cubic t³ + pt + q = 0 with p = (3ac − b²)/(3a²) and q = (2b³ − 9abc + 27a²d)/(27a³). When (q/2)² + (p/3)³ > 0 there is one real root, found with Cardano’s formula t = ∛(−q/2 + √D) + ∛(−q/2 − √D); the other two roots come from the remaining quadratic and are complex conjugates.
When that quantity is negative all three roots are real and distinct, and the trigonometric form t = 2√(−p/3)·cos[⅓·arccos((3q/2p)√(−3/p)) − 2πk/3] for k = 0, 1, 2 avoids complex arithmetic. When it is zero, roots repeat. Because the coefficients are handled in double-precision floating point, “zero” means zero to within about 12 significant digits of rounding error: two genuinely distinct roots closer together than roughly one part in a million of their size may be reported as a double root (and a near-triple as a triple). In that case rescale x (for example substitute x = y/1000) or check the discriminant by exact arithmetic. The sign of the discriminant Δ tells the same story: Δ > 0 three distinct real roots, Δ = 0 a repeated root, Δ < 0 one real and two complex roots.
- a, b, c, d
- Coefficients of ax³ + bx² + cx + d
- Δ
- Discriminant of the cubic
- p, q
- Coefficients of the depressed cubic t³ + pt + q
Worked examples
x³ − 6x² + 11x − 6 = 0
This factors as (x − 1)(x − 2)(x − 3), so the roots are 1, 2 and 3. The discriminant is 4 (positive), confirming three distinct real roots.
x³ − 1 = 0 (cube roots of unity)
The only real root is 1. Dividing out (x − 1) leaves x² + x + 1 = 0, whose roots are −0.5 ± 0.866i. Δ = −27 < 0 signals one real and two complex roots.
2x³ − 4x² − 22x + 24 = 0
Dividing by 2 gives x³ − 2x² − 11x + 12 = (x − 1)(x − 4)(x + 3), so the roots in order are −3, 1 and 4.
x³ − 3x + 2 = 0 (repeated root)
This factors as (x − 1)²(x + 2). The discriminant is 0, so a root repeats: x = 1 is a double root and x = −2 a single root.
Frequently asked questions
How many roots does a cubic equation have?+
Exactly three, counting repeated and complex roots (by the fundamental theorem of algebra). With real coefficients at least one root is always real, because the graph goes from −∞ to +∞ and must cross the x-axis.
What does the discriminant of a cubic tell you?+
For ax³ + bx² + cx + d, Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². If Δ > 0 there are three distinct real roots, if Δ = 0 at least two roots are equal, and if Δ < 0 there is one real root and two complex conjugate roots.
Is there a cubic formula like the quadratic formula?+
Yes — Cardano’s formula, published in 1545, gives the roots using cube roots and square roots. It is long and, when all three roots are real, requires complex intermediate values, so the trigonometric method is usually used in that case.
How can I solve a cubic by factoring?+
Use the rational root theorem: try factors of d divided by factors of a. When f(r) = 0, divide by (x − r) using synthetic division to get a quadratic, then solve that with the quadratic formula.
Why do complex roots come in pairs?+
When all coefficients are real, taking the complex conjugate of the equation leaves it unchanged, so if p + qi is a root then p − qi must be as well. That is why a real cubic has either three real roots or one real root and one conjugate pair.