Toolstia / Cubic equation solver

Cubic equation solver

Enter the four coefficients of a cubic equation and get all three roots, including complex ones, together with the discriminant. If a is zero, the tool solves the quadratic or linear equation that remains.

Solve ax^3 + bx^2 + cx + d = 0

Cubics are solved with Cardano and trigonometric formulas. A cubic always has at least one real root, and any other roots are real or a complex pair. Roots that are repeated may show tiny rounding differences. Complex roots are shown as a + bi.

How it works

  1. Enter a, b, c and d.
  2. Read the roots.
  3. Check the discriminant to see what kind of roots there are.

Method

The equation is reduced to a depressed cubic and solved with Cardano formulas, or with a trigonometric form when there are three real roots.

Roots

A cubic always has at least one real root. The other two are real or a complex pair a plus or minus bi.

Discriminant

Positive means three different real roots, negative means one real and two complex roots, and zero means a repeated root.

Example

x^3 - 6x^2 + 11x - 6 = 0 has the roots 1, 2 and 3.

Questions

Is my equation sent anywhere?

Everything happens in your browser, and nothing you enter is sent anywhere.

What if a is zero?

Then it is not a cubic. The tool solves the quadratic if b is not zero, or the linear equation otherwise.

Why do repeated roots look slightly off?

Repeated roots are very sensitive to rounding, so tiny differences can appear in the last digits.