Cubic equation

Solution of cubic equation using Vieta's formulae. Created by user request

The canonical form of cubic equation is
ax^3+bx^2+cx+d=0

Vieta's formulae are used to solve equations as
x^3+ax^2+bx+c=0
thus, first step is to divide all coefficients by "a".

Here is the calculator. Description of calculation using Vieta's formulae are below

PLANETCALC, Cubic Equation

Cubic Equation

Digits after the decimal point: 2
x1
 
x2
 
x3
 
Q
 
R
 
S
 

The only place I was able to find Vieta's formulae tailored for cubic equations is here

First we calculate
Q=\frac{a^2-3b}{9}
R=\frac{2a^3-9ab+27c}{54}

Then
S=Q^3-R^2

If S > 0, then
\phi = \frac{1}{3}\arccos\left(\frac{R}{\sqrt{Q^3}}\right)
and we have three real roots:

x_1=-2\sqrt{Q}\cos(\phi)-\frac{a}{3}
x_2=-2\sqrt{Q}\cos\left(\phi+\frac{2}{3}\pi\right)-\frac{a}{3}
x_3=-2\sqrt{Q}\cos\left(\phi-\frac{2}{3}\pi\right)-\frac{a}{3}

If S < 0, trigonometric functions are replaced with hyperbolic. Depending on the sign of Q

Q > 0:
\phi = \frac{1}{3}\,\operatorname{Arch}\left(\frac{|R|}{\sqrt{Q^3}}\right)
x_1=-2sgn(R)\sqrt{Q}\,\operatorname{ch}(\phi)-\frac{a}{3}
(real root)
x_{2,3}=sgn(R)\sqrt{Q}\,\operatorname{ch}(\phi)-\frac{a}{3} \pm i \sqrt{3}\sqrt{Q}\,\operatorname{sh}(\phi)
(two complex roots)

Q < 0:

\phi = \frac{1}{3}\,\operatorname{Arsh}\left(\frac{|R|}{\sqrt{|Q|^3}}\right)
x_1=-2sgn(R)\sqrt{|Q|}\, \operatorname{sh}(\phi)-\frac{a}{3}
(real root)
x_{2,3}=sgn(R)\sqrt{|Q|}\, \operatorname{sh}(\phi)-\frac{a}{3} \pm i \sqrt{3} \sqrt{|Q|}\,\operatorname{ch}(\phi)
(two complex roots)

If S = 0, then it is singular equation and has only two roots:

x_1=-2sgn(R)\sqrt{Q}-\frac{a}{3}=-2\sqrt[3]{R}-\frac{a}{3}
x_2=sgn(R)\sqrt{Q}-\frac{a}{3}=\sqrt[3]{R}-\frac{a}{3}

URL copied to clipboard
PLANETCALC, Cubic equation

Comments