Cubic Equation Solver

This calculator solves any cubic equation of the form ax³ + bx² + cx + d = 0, finding all three roots exactly rather than leaving you to guess or plot the curve by hand. Cubic equations turn up throughout engineering, economics and pure maths whenever a variable is cubed, and while some factorise neatly, most do not, which is where a general method such as Cardano's method becomes useful. You enter the four coefficients a, b, c and d (a cannot be zero, or the equation becomes quadratic), and the tool normalises the equation, converts it to a depressed cubic, and works out the discriminant to determine what kind of roots to expect. The results panel shows all three roots, labelled real or complex, alongside the discriminant, the root type, and the depressed cubic values p and q. A verification panel substitutes each real root back into the original equation to confirm it evaluates to zero, and checks the roots sum to minus b over a as Vieta's formulas require. A working steps panel spells out each stage of the method so you can follow the algebra by hand, and a plain language verdict states whether you have three real roots, a repeated root, or one real root with a complex conjugate pair. Large coefficients may show tiny rounding noise in the last decimal place.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner: Premium Homes
Verified method  Cardano's formula (Ars Magna, 1545) via the depressed cubic substitution. Results verified against standard algebraic factoring.

Enter Coefficients

The equation has the form ax³ + bx² + cx + d = 0. Enter each coefficient below. Fractions and decimals are accepted. Coefficient a must not be zero.

x³ - 6x² + 11x - 6 = 0

Roots of the Cubic Equation

Root 1 (x₁)
3
Real root
Root 2 (x₂)
2
Real root
Root 3 (x₃)
1
Real root

Discriminant and Root Type

Discriminant (Δ)4
Root typeThree distinct real roots
Depressed cubic (p)-1
Depressed cubic (q)0

Verification (substitution check)

f(x₁)0
f(x₂)0
f(x₃)0
Sum of roots (= -b/a)6 (expected 6)

Working Steps

Enter coefficients above to see working.
Result: Enter coefficients above.

How to Solve a Cubic Equation

A cubic equation has the general form ax³ + bx² + cx + d = 0 where a is not zero. Every cubic with real coefficients has exactly three roots (counting multiplicity) over the complex numbers, and at least one root is always real.

The most systematic analytical method is Cardano's formula, developed by Gerolamo Cardano and published in Ars Magna in 1545. It converts the general cubic to a simpler form called the depressed cubic (which has no x² term), then solves that using a substitution that reduces the problem to solving a quadratic.

Step-by-Step Method

  1. Divide by a to get a monic cubic: x³ + (b/a)x² + (c/a)x + (d/a) = 0. Call these new coefficients B, C, D.
  2. Substitute x = t - B/3 to eliminate the x² term. This gives the depressed cubic: t³ + pt + q = 0, where p = C - B²/3 and q = D + 2B³/27 - BC/3.
  3. Compute the discriminant of the depressed cubic: Δ = -4p³ - 27q².
  4. Apply Cardano's formula:
    • If Δ > 0: three distinct real roots (use the trigonometric method with arccos).
    • If Δ = 0: repeated root(s); at least two roots are equal.
    • If Δ < 0: one real root and two complex conjugate roots.
  5. Shift back: add -B/3 to each root t to recover x.

The Discriminant

Discriminant (Δ)Root typesDescription
Δ > 0Three distinct real rootsThe cubic crosses the x-axis three times
Δ = 0Repeated real root(s)The cubic touches the x-axis at a double or triple root
Δ < 0One real root, two complex conjugate rootsThe cubic crosses the x-axis once

Worked Example

Solve x³ - 6x² + 11x - 6 = 0 (coefficients a=1, b=-6, c=11, d=-6).

  1. Already monic. B = -6, C = 11, D = -6.
  2. Substitute x = t - B/3 = t + 2. Compute p = 11 - 36/3 = 11 - 12 = -1 and q = -6 + 2(-216)/27 - (-6)(11)/3 = -6 - 16 + 22 = 0.
  3. Discriminant: Δ = -4(-1)³ - 27(0)² = 4 - 0 = 4 > 0. Three distinct real roots.
  4. Because q = 0, the depressed cubic t³ - t = 0 factors as t(t² - 1) = 0, giving t = 0, t = 1, t = -1.
  5. Shift back: x = t + 2. The solver reports the roots in the order x₁ = 3, x₂ = 2, x₃ = 1 (the same set {1, 2, 3}).

Verification: (x-1)(x-2)(x-3) = x³ - 6x² + 11x - 6. Confirmed.

Vieta's Formulas (Sum and Product of Roots)

For ax³ + bx² + cx + d = 0 with roots x₁, x₂, x₃:

These relationships can be used to verify roots without substituting back into the equation.

Related Calculators

Sources and method: Cardano, G. Ars Magna (1545). Nickalls, R.W.D. "A new approach to solving the cubic: Cardano's solution revealed." The Mathematical Gazette, 77(480), 354-359 (1993). Abramowitz and Stegun, Handbook of Mathematical Functions (1972), Section 3.8.2. Complex root computation uses trigonometric form when Δ > 0 (three real roots, casus irreducibilis avoided).

This solver uses double-precision floating-point arithmetic. For coefficients with very large magnitudes, round-off error may affect the last few decimal places. The verification column shows f(x) evaluated at each root as a check; values very close to zero (e.g. 1e-13) confirm a correct root.