How to use the cubic equation solver
- Rearrange your equation into the form ax³ + bx² + cx + d = 0.
- Enter a (x³), b (x²), c (x) and d (constant). Use 0 for a missing term, and remember the signs.
- Read the Nature of roots and the Discriminant Δ.
- Read the Roots box (x₁, x₂, x₃), then the Method box with the sum and product of the roots.
What it does and when to use it
Cubic equations come up in algebra and calculus classes, in finding where a curve crosses the x-axis, in volume problems (such as a box cut from a sheet, where V = x(l − 2x)(w − 2x)), and in physics and engineering models. Solving them by hand is long, so this tool is a quick way to get the roots or check your factorisation.
For second-degree equations, use the quadratic solver, which also gives exact surd answers. Complex roots can be explored further with the complex number calculator. If a root is a decimal you suspect is a fraction, try decimal to fraction.
How it works
- Discriminant, computed with exact fractions: Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². Decimal coefficients are read exactly as typed, so Δ = 0 is detected reliably.
- Depressed cubic: substituting x = t − b/(3a) gives t³ + pt + q = 0, with p = (3ac − b²)/(3a²) and q = (2b³ − 9abc + 27a²d)/(27a³).
- Roots, by case:
- Δ > 0: the trigonometric method, t = 2√(−p/3) × cos(θ − 2πk/3) for k = 0, 1, 2, where θ = ⅓ × arccos(3q ÷ (p × 2√(−p/3))).
- Δ = 0: a double root at t = −3q/(2p) and a single root at t = 3q/p, or a triple root at x = −b/(3a) when p = 0.
- Δ < 0: Cardano’s formula, with u and v the cube roots of −q/2 ± √(q²/4 + p³/27); the real root is u + v.
- A few steps of Newton’s method then polish each real root.
Worked examples
Three real roots, step by step. Solve 2x³ − 4x² − 22x + 24 = 0, so a = 2, b = −4, c = −22, d = 24.
- Work out the five parts of Δ: 18abcd = 76,032; −4b³d = 6,144; b²c² = 7,744; −4ac³ = 85,184; −27a²d² = −62,208.
- Add them: Δ = 112,896, which is positive, so expect three different real roots.
- The tool uses the trigonometric method and gives x₁ = 4, x₂ = 1 and x₃ = −3.
- Check: the sum 4 + 1 − 3 = 2 matches −b/a = 2, and the product 4 × 1 × (−3) = −12 matches −d/a = −12.
So 2x³ − 4x² − 22x + 24 = 2(x − 4)(x − 1)(x + 3). The tool shows Discriminant Δ: 112,896.
A repeated root. x³ − 3x + 2 = 0 gives Δ = 0 and Three real roots, two of them equal (Δ = 0): x = 1 twice and x = −2.
Complex roots. x³ + x + 1 = 0 gives Δ = −31, one real root x₁ = −0.6823278038, and the pair x₂ = 0.3411639019 + 1.1615414i and x₃ = 0.3411639019 − 1.1615414i.
Limits and tips
- Coefficients must be real numbers; complex coefficients are not supported.
- The coefficients are typed as numbers. For fractions such as ½, enter 0.5, or multiply the whole equation by the denominator first.
- Roots are numerical, shown to 10 significant figures, not exact radicals.
- Everything runs in your browser.
Frequently asked questions
Does every cubic have a real root?
What does the discriminant tell me?
Why does it say a is 0?
How can I check the roots by hand?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.