# Cardano’s formula for solving cubic equations

Let $a_{3}x^{3}+a_{2}x^{2}+a_{1}x+a_{0}=0$, $a_{3}\neq 0$ be the cubic equation. By dividing the equation with $a_3$ we obtain:

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

where $a=\frac{a_{2}}{a_{3}}$, $b=\frac{a_{1}}{a_{3}}$, $c=\frac{a_{0}}{a_{3}}$.

The equation above is called a normalized cubic equation.

The square member we remove by the substitution $x= y – \frac{a}{3}$. Now we have:

$$\left(y- \frac{a}{3}\right)^{3}+ a\left(y- \frac{a}{3}\right)^{2} + b\left (y- \frac{a}{3}\right) + c = 0,$$

that is,

$$y^{3}+ \left(b-\frac{a^{2}}{3}\right)y + \left(\frac{2a^{3}}{27} – \frac{ab}{3} + c\right) = 0.$$

In addition to tags $p = b-\frac{a^{2}}{3}$ and $q = \frac{2a^{3}}{27} – \frac{ab}{3} + c$ we obtain the canonical form of the cubic equation:

$$y^{3} + py +q = 0.$$

It is enough to solve the cubic equation of this type.

Cardano’s formula

The solution of the cubic equation $y^{3} + py +q = 0$ we search in form:

$$x=v+w.$$

These solution must satisfy the initial equation, that is:

$$(v+w)^{3} + p(v+w) +q = 0.$$

After transformation of the previous equation, we obtain:

$$(3vw+p) (v+w) + (v^{3} + w^{3} + q) = 0.$$

We choose  $3vw + p =0$ as an additional requirement, because each number is possible in the infinite way to display in the form of the sum of two numbers.

Therefore, we need to solve the following system of equations:

$$v^{3} + w^{3} = -q$$

$$v w= – \frac{p}{3} \quad (1)$$

that is:

$$v^{3} + w^{3} = -q$$

$$v^{3} w^{3}= – \left( \frac{p}{3} \right ) ^{3} \quad (2)$$

Systems of equations (1) and (2) are not equivalent. The solution of the system (1) is the solution of the system (2), however, the reversal  does not have to be valid. Therefore, we choose solutions which satisfy the equation $v w= – \frac{p}{3}$.

By the Vieta’s formulas, solutions of the system (2) are roots of the quadratic equation

$$m^{2} + qm – \left (\frac{p}{3} \right)^{3}=0.$$

By using the formula for solutions of the quadratic equation, we obtain:

$$m_{1,2}= -\frac{q}{2} \pm \sqrt{\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} }.$$

Therefore, we have

$$v=\sqrt{-\frac{q}{2} + \sqrt{\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} }},$$

and

$$w=\sqrt{-\frac{q}{2} – \sqrt{\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} }}.$$

The solution of the equation $x^{3}+px+q=0$ we write in the following form:

$$x=v+w= \sqrt{-\frac{q}{2} + \sqrt{\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} }} + \sqrt{-\frac{q}{2} – \sqrt{\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} }}.$$

The formula above is called the Cardano’s formula.

The expression $\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3}$ which appears in the Cardano’s formula is called the discriminant of the cubic equation $x^{3}+px+q=0$. The discriminant of the cubic equation we will denote as $\Delta$.

If $\Delta > 0$, then the cubic equation has one real and two complex conjugate roots; if $\Delta = 0$, then the equation has three real roots, whereby at least two roots are equal;  if $\Delta < 0$ then the equation has three distinct real roots.

Modified Cardano’s formula

Let

$$\epsilon=-\frac{1}{2} – \frac{\sqrt{3}}{2} i$$

be third root of 1. Then

$$\epsilon^{2}=-\frac{1}{2} + \frac{\sqrt{3}}{2}i \quad \quad \quad \epsilon^{3}=1.$$

Let

$$v_{1} = \sqrt{-\frac{q}{2} + \sqrt{\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} }}$$

be any value of third root and

$$w_{1}=-\frac{p}{3v_{1}}.$$

Then the solutions of the cubic equation $x^{3}+px+q=0$ we can write in the form:

$$x_{1}=v_{1} + w_{1},$$

$$x_{2}=v_{1} \epsilon + w_{1} \epsilon^{2},$$

$$x_{3}=v_{1} \epsilon^{2} + w_{1} \epsilon.$$

Example 1. Solve the following equation

$$x^{3} – 6x – 9 =0.$$

Solution:

The discriminant of the given equation is equal to:

$$\Delta =\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} = \frac{(-9)^{2}}{4} + \frac{(-6)^{3}}{27}= \frac{81}{4}-\frac{216}{27}= 12.25.$$

Therefore, $\Delta>0$ and equation has one real and two complex conjugate solutions.

By the Cardano’s formula we have:

$$v_{1} =\sqrt{-\frac{q}{2} + \sqrt{\left (\frac{q}{2} \right) ^{2} +\left (\frac{p}{3} \right) ^{3} }}$$

$$= \sqrt{-\frac{(-9)}{2} + \sqrt{ \frac{(-9)^{2}}{4} + \frac{(-6)^{3}}{27}}}$$

$$=\sqrt{8}$$

$$=2.$$

It follows:

$$w_{1}= -\frac{p}{3v_{1}}=-\frac{(-6)}{6}=1.$$

The solutions of the given equation are:

$$x_1 = v_1 + w_1 = 2+1 =3$$,

$$x_2 = v_1 \epsilon + w_1 \epsilon^2$$

$$= 2 \cdot \left (- \frac{1}{2} – \frac{\sqrt{3}}{2}i \right) + 1 \cdot \left ( -\frac{1}{2} + \frac{\sqrt{3}}{2}i \right)$$

$$= -1 – \sqrt{3}i – \frac{1}{2} + \frac{\sqrt{3}}{2}i$$

$$= -\frac{3}{2} – \frac{\sqrt{3}}{2} i,$$

$$x_3 =v_1 \epsilon^2 +w_1 \epsilon = 2 \cdot \left ( -\frac{1}{2} + \frac{\sqrt{3}}{2}i \right) + 1 \cdot \left (- \frac{1}{2} – \frac{\sqrt{3}}{2}i \right) = – \frac{3}{2} + \frac{\sqrt{3}}{2} i.$$

We can use formulas above when $\Delta > 0$ and $\Delta =0$. When $\Delta < 0$, we have a different situation, because in the Cardano’s formula appears the square root of a negative number, that is, we have complex numbers.

For example, how to solve the equation $x^{3}-15x-4=0$?

By using the Cardano’s formula, we obtain:

$$x=\sqrt{2+ \sqrt{-121}}+ \sqrt{2- \sqrt{-121}},$$

what we can write as

$$x=\sqrt{2+ 11i}+ \sqrt{2- 11i},$$

where

$$(2+11i)\cdot (2-11i) = 5.$$

If $z=2+11i$ and $w=2-11i$, then

$$z=\sqrt{125}(\cos\varphi + i \sin \varphi), \quad \quad w=\sqrt{125}\left[\cos(2\pi – \varphi) + i \sin (2\pi – \varphi)\right],$$

because $z$ and $w$ are complex conjugate numbers and they have the same modulus.

Now we have, $\sqrt{2+ 11i} =\{z_1, z_2, z_3\}$, that is:

$$z_1=\sqrt{\sqrt{125}}\left[ \cos \left(\frac{\varphi}{3}\right) + i \sin \left(\frac{\varphi}{3}\right)\right],$$

$$z_2=\sqrt{\sqrt{125}}\left[ \cos \left(\frac{\varphi}{3}+\frac{2 \pi}{3}\right) + i \sin \left(\frac{\varphi}{3} + \frac{2 \pi}{3}\right)\right],$$

$$z_3=\sqrt{\sqrt{125}}\left[ \cos \left(\frac{\varphi}{3} + \frac{4\pi}{3}\right) + i \sin \left(\frac{\varphi}{3} + \frac{4 \pi}{3}\right)\right].$$

Similar, $\sqrt{2- 11i}=\{w_{1}, w_{2}, w_{3}\}$:

$$w_1=\sqrt{\sqrt{125}}\left[ \cos\left(\frac{2\pi}{3}-\frac{\varphi}{3}\right) + i \sin \left(\frac{2\pi}{3} – \frac{\varphi}{3}\right)\right],$$

$$w_2=\sqrt{\sqrt{125}}\left[ \cos \left(\frac{4\pi}{3}-\frac{\varphi}{3}\right) + i \sin \left(\frac{4\pi}{3} – \frac{\varphi}{3}\right)\right],$$

$$w_3=\sqrt{\sqrt{125}}\left[ \cos \left(2\pi-\frac{\varphi}{3}\right) + i \sin \left(2\pi – \frac{\varphi}{3}\right)\right].$$

It is valid: $z_1 w_3=z_2 w_2= z_3 w_1=5$ and solutions of the equation $x^{3}-15x-4=0$ are real numbers:

$$x_{1}=z_{1}+w_{3}=2\sqrt{\sqrt{125}} \cdot \cos \left(\frac{\varphi}{3}\right),$$

$$x_{2}=z_{2}+w_{2}=2\sqrt{\sqrt{125}} \cdot \cos \left(\frac{\varphi}{3} + \frac{2 \pi}{3}\right),$$

$$x_{1}=z_{1}+w_{3}=2\sqrt{\sqrt{125}} \cdot \cos \left(\frac{\varphi}{3}+ \frac{4 \pi}{3}\right).$$

The angle $\varphi$ we can eliminate in the following way. We know that

$$\varphi= \arctan (\tan \varphi),$$

and $\tan \varphi$ we can obtain from the coefficients of the equation:

$$\tan \varphi= – \frac{2\sqrt{-\Delta}}{q},$$

where, if $\varphi<0$ then the solutions are changing the sign.

In our case:

$$\tan \varphi= \frac{2\sqrt{121}}{4} =\frac{22}{4}=5.5 \Longrightarrow \varphi = \arctan (5.5) = 1.3909428270 \ldots rad.$$

Therefore, the one solution of the given equation is

$$x_1 = 2 \sqrt{\sqrt{125}} \cdot cos\left(\frac{ \arctan(5.5)}{3}\right)$$

$$= 2 \cdot 2.2360679774 \cdot 0.8944271909$$

$$=3.9999999999 ≈ 4.$$

Similar, we obtain

$$x_2=-2-\sqrt{3},$$

$$x_{3}=-2 + \sqrt{3}.$$

In general, the solutions of the cubic equation $x^3 + px +q=0$, where $\Delta < 0$ and $z=-\frac{q}{2}+\sqrt{\Delta}i$, are:

$$x_{1}=z_{1}+w_{3}=2 \sqrt{r} \cdot \cos \left ( \frac{\varphi}{3}\right),$$

$$x_{2}=z_{2}+w_{2}=2 \sqrt{r} \cdot \cos \left ( \frac{\varphi + 2\pi}{3}\right),$$

$$x_{3}=z_{3}+w_{1}=2 \sqrt{r} \cdot \cos \left ( \frac{\varphi + 4\pi}{3}\right),$$

where $\varphi= \arctan \left[\tan \left(-\frac{2\sqrt{-\Delta}}{q}\right)\right]$ and if  $\tan \left(-\frac{2\sqrt{-\Delta}}{q}\right) < 0$, then solutions are changing the sign.