Cardano's Formula

Theorem
An algebraic equation of the form $$x^3 + a_1 x^2 + a_2 x + a_3 = 0$$ is called a cubic equation, or just cubic.

It has solutions:
 * $$x_1 = S + T + \frac {a_1} 3$$;
 * $$x_2 = - \frac {S + T} 2 - \frac {a_1} 3 + \frac {\imath \sqrt 3} 2 \left({S - T}\right)$$;
 * $$x_3 = - \frac {S + T} 2 - \frac {a_1} 3 - \frac {\imath \sqrt 3} 2 \left({S - T}\right)$$,

where:
 * $$S = \sqrt [3] {R + \sqrt{Q^3 + R^2}}$$;
 * $$T = \sqrt [3] {R - \sqrt{Q^3 + R^2}}$$,

where:
 * $$Q = \frac {3 a_2 - a_1^2}{9}$$;
 * $$R = \frac {9 a_1 a_2 - 27 a_3 - 2 a_1^3} {54}$$.

Discriminant
The expression $$D = Q^3 + R^2$$ is called the discriminant of the equation.

Let $$a_1, a_2, a^3 \in \R$$.

Then:
 * if $$D > 0$$, then one root is real and two are complex conjugates;
 * if $$D = 0$$, then all roots are real, and at least two are equal;
 * if $$D < 0$$, then all roots are real and unequal.

Note that this is a special case of the general discriminant.

Alternative Form of Solutions
If the discriminant $$D < 0$$, then the solutions can be expressed as:


 * $$x_1 = 2 \sqrt {-Q} \cos \left({\frac \theta 3}\right) - \frac {a_1} 3$$;
 * $$x_2 = 2 \sqrt {-Q} \cos \left({\frac \theta 3 + \frac {2 \pi} 3}\right) - \frac {a_1} 3$$;
 * $$x_3 = 2 \sqrt {-Q} \cos \left({\frac \theta 3 + \frac {4 \pi} 3}\right) - \frac {a_1} 3$$.

where $$\cos \theta = \frac R {\sqrt{-Q^3}}$$.

Proof
First the cubic is depressed:

$$ $$ $$ $$ $$

Now let $$y = x + \frac {a_1} 3, Q = \frac {3 a_2 - a_1^2} 9, R = \frac {9 a_1 a_2 - 27 a^3 - 2 a_1^3 } {54}$$.

Thus we have obtained the depressed cubic $$y^3 + 3 Q y - 2 R = 0$$.

Now let $$y = S + T$$ where $$S T = -Q$$.

Then:

$$ $$ $$ $$ $$ $$

This is a quadratic in $$S^3$$:


 * $$S^3 = \frac {2 R \pm \sqrt {4 Q^3 + 4 R^2}} {2} = R \pm \sqrt {Q^3 + R^2}$$

We have from above $$S T = Q$$ and hence $$T^3 = \frac {Q^3} {S^3}$$.

Now, without delving too deeply, we take the positive root: $$S^3 = R + \sqrt {Q^3 + R^2}$$.

Then:

$$ $$ $$

The same sort of thing happens if you start with $$S^3 = R - \sqrt{Q^3 - R^2}$$.

So $$x + \frac {a_1} 3 = y = S + T = \sqrt [3] {R + \sqrt{Q^3 + R^2}} + \sqrt [3] {R - \sqrt{Q^3 + R^2}}$$.

Hence the first result: $$x = S + T - \frac {a_1} 3$$.

To obtain the other results we need to investigate the various cube roots of $$R + \sqrt{Q^3 + R^2}$$ and $$R - \sqrt{Q^3 + R^2}$$.

Note
The general cubic appears in the form $$a x^3 + b x^2 + c x + d = 0$$.

It can be converted to that above by dividing through by $$a$$, and substituting $$a_1 = \frac b a, a_2 = \frac c a, a_3 = \frac d a$$.

This monic form is of course easier to handle because there are fewer coefficients.