Skip to content
LoveToCalc

Cubic equation solver

Type the four coefficients and get all three roots — real and complex — with the working.

ax³+bx²+cx+d=0

The four coefficients of ax³ + bx² + cx + d = 0; a must not be 0. Decimals are fine. The pre-filled numbers are an example, not a recommendation.

Try:

Roots and working

Roots

  • x₁=1
  • x₂=2
  • x₃=3

Δ > 0: three different real roots.

Factorised form

x³−6x²+11x−6=(x−1)(x−2)(x−3)

Working

  1. The equation:

    x³−6x²+11x−6=0
  2. Substitute x = t − b/3 (with b divided by a) to remove the x² term:

    x = t + 2
  3. This gives the depressed cubic t³ + pt + q = 0, with p = c − b²/3 and q = 2b³/27 − bc/3 + d (b, c, d after the division):

    p = −1, q = 0t³−t=0
  4. The discriminant Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d² tells how many roots are real:

    Δ = 4Δ > 0: three different real roots.
  5. With three real roots the trigonometric form avoids complex numbers: t_k = 2√(−p/3) · cos(θ/3 − 2πk/3), k = 0, 1, 2, where θ = arccos((3q/2p) · √(−3/p)):

    Amplitude 2√(−p/3) = 1.1547θ = 1.5708t₁ = −1t₂ = 0t₃ = 1
  6. Undo the substitution:

    x = t + 2
  7. Each root is refined with a few Newton steps.

How to use it

The method

  1. Divide by a so that the x³ coefficient is 1.
  2. Remove the x² term. Substituting x = t − b/3 turns the cubic into the depressed cubic t³ + pt + q = 0, with p = c − b²/3 and q = 2b³/27 − bc/3 + d.
  3. Read the discriminant. Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². If Δ > 0 there are three different real roots, if Δ < 0 one real root and a complex pair, and if Δ = 0 a repeated root.
  4. Apply the formula. With one real root, Cardano’s formula gives t = u + v, where u = ∛(−q/2 + √D), v = −p/(3u) and D = q²/4 + p³/27. With three real roots the same formula would pass through complex numbers, so the trigonometric form is used instead: t_k = 2√(−p/3) · cos(⅓ arccos((3q/2p)√(−3/p)) − 2πk/3).
  5. Undo the substitution: x = t − b/3.

Example: x³ − 6x² + 11x − 6

Substituting x = t + 2 gives t³ − t = 0, so p = −1 and q = 0. The discriminant is 4, positive, so there are three real roots: t = −1, 0 and 1. Back in x they are 1, 2 and 3, and the cubic factorises as (x − 1)(x − 2)(x − 3).

Example: x³ + x + 1

Here Δ = −31 < 0: one real root, x ≈ −0.6823, and a complex pair, about 0.3412 ± 1.1615i. The root is irrational, so there is no factorised form with whole numbers.

Not covered

Equations of degree four and higher are not solved here, and neither is partial fraction decomposition. A quadratic is solved by the equation solver; dividing one polynomial by another is the polynomial division calculator.

Last reviewed October 20, 2026 ·How pages are reviewed

All math calculators

Put this calculator on your site

Copy the code into your page where the calculator should appear. It loads from lovetocalc.com, so it stays current on its own — all we ask is that the credit line comes with it.