Cubic Equation Calculator


This online cubic equation calculator is a cubic equation formula solver that finds a third-order polynomial equation roots. Enter the coefficients a, b, c, d of the cubic equation in the fields of the calculator (Attention: a must not be equal to 0!). Solutions of cubic equations are usually three different real roots or one real and two complex roots or two real roots.


ax³ + bx² + cx + d = 0

Precision: decimal places

a:
b:
c:
d:
x₁:
x₂:
x₃:


Find roots of cubic equation

The canonical form of cubic equation

$$a{ x }^{ 3 }+b{ x }^{ 2 }+cx+d=0 $$

can be reduced to a simplified form by dividing all the coefficients by “\(a\)“:

$${ x }^{ 3 }+a{ x }^{ 2 }+bx+c=0 $$

and then Vieta’s formulas can be used to solve this equation.

First we need to calculate some auxiliary parameters:
$$Q=\frac { { a }^{ 2 }-3b }{ 9 } ,\quad R=\frac { 2{ a }^{ 3 }-9ab+27c }{ 54 },$$
$$\quad S={ Q }^{ 3 }-{ R }^{ 2 }.$$
Now, if \(S>0\) we can define a new parameter \(\phi \):
$$\\ \phi =\frac { 1 }{ 3 } arccos\left( \frac { R }{ \sqrt { { Q }^{ 3 } } } \right) $$
and the cubic equation in this case has three real roots which can be expressed as follows:
$${ x }_{ 1 }=-2\sqrt { Q } cos(\phi )-\frac { a }{ 3 }, $$
$${ x }_{ 2 }=-2\sqrt { Q } cos(\phi +\frac { 2 }{ 3 } \pi )-\frac { a }{ 3 } ,$$
$${ x }_{ 3 }=-2\sqrt { Q } cos(\phi -\frac { 2 }{ 3 } \pi )-\frac { a }{ 3 } .$$

If \(S<0\) trigonometric functions are to be replaced with hyperbolic functions. In case of \(Q>0\) we have one real and two complex roots:

$$\phi =\frac { 1 }{ 3 } Arch\left(\frac { |R| }{ \sqrt { { Q }^{ 3 } } } \right),$$
$${ x }_{ 1 }=-2sgn(R)\sqrt { Q } ch(\phi )-\frac { a }{ 3 } ,$$
$${ x }_{ 2,3 }=sgn(R)\sqrt { Q } ch(\phi )-\frac { a }{ 3 } \pm i\sqrt { 3Q } sh(\phi ) .$$

In case of \(Q<0\) we also have one real and two complex roots:

$$\phi =\frac { 1 }{ 3 } Arsh\left(\frac { |R| }{ \sqrt { { |Q| }^{ 3 } } } \right),$$
$${ x }_{ 1 }=-2sgn(R)\sqrt { |Q| } sh(\phi )-\frac { a }{ 3 } ,$$
$${ x }_{ 2,3 }=sgn(R)\sqrt { |Q| } sh(\phi )-\frac { a }{ 3 } \pm i\sqrt { 3|Q| } ch(\phi ) .$$

If \(S = 0\), then the equation is degenerate and has less than 3 different solutions (actually only two roots):

$${ x }_{ 1 }=-2sgn(R)\sqrt { Q } -\frac { a }{ 3 } ,$$
$${ x }_{ 2 }=sgn(R)\sqrt { Q } -\frac { a }{ 3 } .$$


Related calculators

Check out our other algebra calculators such as Completing the Square Calculator or Quadratic Formula Calculator.