Saved

Press the star next to a tool's name to save it.

All my tools

Cubic Equation Calculator

Use this cubic equation calculator to solve ax³ + bx² + cx + d = 0, with all three roots, real or complex, the discriminant and the depressed cubic.

Restored your last values ·

Enter the coefficients of ax³ + bx² + cx + d = 0, with a not equal to 0. Blank values of b, c and d count as 0. The calculator finds all three roots, real or complex, and the discriminant.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Enter the coefficients a, b, c and d, then press Solve the cubic.

See full result

A cubic equation calculator finds all three roots of ax³ + bx² + cx + d = 0, real or complex, and tells you how many of them are real by the discriminant. Enter the four coefficients and press the button. It uses the discriminant and the depressed cubic on Wikipedia's page on the cubic equation, and it works in your browser.

How to use the cubic equation calculator

  1. Enter a, the coefficient of x cubed. It must not be zero.
  2. Enter b, c and d. Leave a box empty for zero.
  3. Press Solve the cubic.
  4. Read the three roots, the discriminant and the kind of roots.

The discriminant

The Wikipedia page on the cubic equation gives the discriminant as 18abcd minus 4b cubed d plus b squared c squared minus 4a c cubed minus 27 a squared d squared. For a cubic with real coefficients, if the discriminant is positive, the equation has three different real roots. If it is negative, it has one real root and two complex roots that are conjugates of each other. If it is zero, there is a repeated root, and all the roots are real. For x cubed minus 6x squared plus 11x minus 6, the discriminant is 4, so there are three different real roots: 1, 2 and 3.

The depressed cubic

The first step in solving a cubic is to remove the x squared term by the substitution x equals t minus b over 3a. This gives a depressed cubic, t cubed plus p t plus q equals 0, with p equal to 3ac minus b squared, over 3 a squared, and q equal to 2 b cubed minus 9abc plus 27 a squared d, over 27 a cubed. The calculator shows p and q. The discriminant of the depressed cubic is minus 4 p cubed minus 27 q squared, and it has the same sign as the discriminant of the original equation, since the shift does not change the roots' differences.

Cardano's formula

For the depressed cubic, Cardano's formula writes a root as the cube root of minus q over 2 plus the square root of q squared over 4 plus p cubed over 27, plus the cube root of minus q over 2 minus that square root. When the square root has a positive argument, which happens with one real root, the formula gives the real root, and the other two come from multiplying the cube roots by the complex cube roots of unity. The calculator uses this approach in that case. The page describes the method, and the form used here is the standard one.

The trigonometric method

When there are three real roots, Cardano's formula needs the cube root of a complex number, even though the answers are real. The trigonometric method avoids this. It writes the roots as 2 times the square root of minus p over 3, times the cosine of a third of an arc cosine, minus 2 pi k over 3, for k equal to 0, 1 and 2, and it is the method that the calculator uses when the discriminant is positive. For the example, the depressed cubic is t cubed minus t, with p equal to minus 1 and q equal to 0, and the formula gives t equal to 1, 0 and minus 1. Adding back the shift of 2 gives the roots 3, 2 and 1.

Examples

The equation x cubed plus 3x minus 4 equals zero has one real root, x equals 1, and two complex roots with the real part minus 0.5 and the imaginary part of plus or minus 1.93649. The equation x cubed minus 3x squared plus 3x minus 1 equals zero has the triple root 1, since it is x minus 1, cubed. The equation 2x cubed minus 4x squared minus 22x plus 24 equals zero has the roots 4, 1 and minus 3. You can try these in the calculator to see the three cases.

Where cubics appear

Cubic equations arise in volume problems, such as a box whose size is unknown, in the study of curves, and in physics and engineering, for instance in equations of state. They were solved in the sixteenth century, which was a landmark in the history of algebra. A cubic with real coefficients always has at least one real root, which is why a cubic graph crosses the x axis at least once.

Checking your roots

You can check the roots in two ways. Put each root in the equation and see if the result is close to zero. Or use the relations between the roots and the coefficients: the sum of the three roots is minus b over a, and the product is minus d over a. For the equation with the roots 1, 2 and 3, the sum is 6 and the product is 6, which match minus the b of minus 6 and minus the d of minus 6.

Common mistakes

  • Setting a to zero. The equation is then a quadratic.
  • Forgetting the signs of the coefficients. Enter them as they appear.
  • Expecting all roots to be real. Many cubics have complex roots.
  • Rounding too early. Keep the full numbers until the end.

What next

Use this often? Add Cubic Equati to your Home screen.

Frequently asked questions

What is a cubic equation calculator?

A tool that finds all three roots of ax³ + bx² + cx + d = 0, real or complex, and the discriminant.

How do you know how many roots are real?

From the discriminant Δ = 18abcd − 4b³d + b²c² − 4ac³ − 27a²d². Positive: three real roots. Negative: one real root. Zero: a repeated root.

What is a depressed cubic?

A cubic without the x² term, t³ + pt + q = 0, found with x = t − b ÷ 3a.

What is Cardano's formula?

A formula for the roots of the depressed cubic with cube roots and a square root. For three real roots the trigonometric form is used instead.

Does every cubic have a real root?

Yes. A cubic with real coefficients always has at least one real root.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools