Advertisement

Cubic equation calculator

Enter real coefficients with non-zero a. Roots include multiplicity. Numerical conditioning can reduce accuracy for very large or nearly repeated roots.

Calculator

Three roots
1; 2; 3
One real root
1.00000000
Cubic discriminant
4.00000000

Advertisement

How this calculator works

Divide by a and shift x to remove the squared term, leaving t^3 + pt + q = 0. A trigonometric form avoids complex intermediate values when all three roots are real. Cardano's real cube roots handle a single real root and a conjugate pair. Repeated roots are listed more than once.

Formula

p = c/a - b^2/(3a^2); q = 2b^3/(27a^3) - bc/(3a^2) + d/a. Set x = t - b/(3a). The cubic discriminant is -a^4(4p^3 + 27q^2).

Worked example

x^3 - 6x^2 + 11x - 6 factors as (x - 1)(x - 2)(x - 3), so its three roots are 1, 2 and 3. For x^3 - 8 = 0, the real root is 2 and the other roots are -1 +/- sqrt(3)i.

Advertisement

Frequently asked questions

Must a cubic have a real root?

Yes. A real cubic has at least one real root; any non-real roots occur as a conjugate pair.

What does a zero discriminant mean?

At least two roots coincide. Floating-point calculations may not recognise a nearly repeated root as exactly repeated.

Can a be zero?

No. Use the quadratic formula calculator when the cubic term disappears.

Sources

Advertisement