🧮
🧮 Math & statistics

Cubic Equation Solver (ax³ + bx² + cx + d = 0)

Results update as you type.

Your numbers

Understanding the cubic equation solver — concept and principle

A cubic equation has the form ax³ + bx² + cx + d = 0 with a ≠ 0. Every cubic with real coefficients has at least one real root, because its graph runs from −∞ to +∞; it has either three real roots or one real root and a pair of complex conjugate roots. Cubics appear in volume problems, equations of state and interpolation curves. This solver returns all three roots in closed form.

Cubic with roots 1, 2 and 3x³ − 6x² + 11x − 6 factors as (x − 1)(x − 2)(x − 3), so the curve crosses zero at 1, 2 and 3.x³ − 6x² + 11x − 6 = 0(x − 1)×(x − 2)×(x − 3)x = 1x = 2x = 3Check with the coefficients1 + 2 + 3 = 6= −b/a2 + 3 + 6 = 11pairs = c/a1 × 2 × 3 = 6= −d/a
Three crossings, three roots; their sum, pair-products and product match the coefficients.

How it is calculated

  1. Divide by a: x³ + Bx² + Cx + D = 0 with B = b/a, C = c/a, D = d/a.
  2. Substitute x = t − B/3 to remove the squared term, giving the depressed cubic t³ + Pt + Q = 0 with P = C − B²/3 and Q = 2B³/27 − BC/3 + D.
  3. Compute Δ = Q²/4 + P³/27.
  1. Shift back: x = t − B/3. Real roots are sorted from smallest to largest.

The principle

The substitution x = t − B/3 centres the cubic on its point of inflection, which removes the x² term. Cardano's idea is to write t = u + v; then t³ = u³ + v³ + 3uv(u + v), and choosing 3uv = −P turns the cubic into a quadratic in u³. Δ is the discriminant of that quadratic, which is why its sign decides the root pattern. When Δ < 0 Cardano's square root is imaginary even though all roots are real (the "casus irreducibilis"), so the solver uses the identity cos 3θ = 4cos³θ − 3cosθ instead.

Worked example

  1. Inputs: a = 1, b = −6, c = 11, d = −6.
  2. B = −6, C = 11, D = −6; shift −B/3 = 2.
  3. P = 11 − 36/3 = −1 and Q = 2(−216)/27 − (−66)/3 − 6 = −16 + 22 − 6 = 0.
  4. Δ = 0 + (−1)/27 ≈ −0.037 < 0, so there are three real roots.
  5. 2√(1/3) ≈ 1.1547 and θ = ⅓·arccos(0) = π/6, so t = 1.1547·cos 30° = 1, 1.1547·cos(−90°) = 0 and 1.1547·cos(−210°) = −1.
  6. x = t + 2 gives 3, 2, 1. Result: 1, 2, 3. Check: (x − 1)(x − 2)(x − 3) = x³ − 6x² + 11x − 6.

How to read the result

Vieta's formulas let you check any answer: the roots add up to −b/a (here 6), their pairwise products add up to c/a (11) and their product is −d/a (6).

Common mistakes

Keep in mind: Closed-form formulas can lose accuracy when roots are nearly equal or coefficients differ greatly in size. Substitute critical roots back to check them.

Frequently asked questions

Does every cubic have a real root?

Yes, if the coefficients are real. The graph must cross the x-axis at least once.

Can I factor a cubic instead?

If it has a rational root p/q, p divides d and q divides a (rational root theorem). Divide that factor out and solve the remaining quadratic.

Who discovered the cubic formula?

Scipione del Ferro and Niccolò Tartaglia solved it in the early 16th century; Gerolamo Cardano published it in Ars Magna (1545).

Sources: M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions, NBS Applied Mathematics Series 55, §3.8.2 · W. H. Press et al., Numerical Recipes, Cambridge University Press, §5.6 Quadratic and Cubic Equations

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →