Cardano's Formula

Theorem
An algebraic equation of the form $$a x^3 + b x^2 + c x + d = 0$$ is called a cubic equation, or just cubic.

It has solutions:
 * $$x_1 = S + T - \frac {b} {3 a}$$;
 * $$x_2 = - \frac {S + T} 2 - \frac {b} {3 a} + \frac {\imath \sqrt 3} 2 \left({S - T}\right)$$;
 * $$x_3 = - \frac {S + T} 2 - \frac {b} {3 a} - \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 c - b^2} {9 a^2}$$;
 * $$R = \frac {9 a b c - 27 a^2 d - 2 b^3} {54 a^3}$$.

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

Let $$a, b, c, d \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. Also note that this appears in various forms in the literature - this particular form is most convenient for the derivation as given on this page.

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 {b} {3 a}$$;
 * $$x_2 = 2 \sqrt {-Q} \cos \left({\frac \theta 3 + \frac {2 \pi} 3}\right) - \frac {b} {3 a}$$;
 * $$x_3 = 2 \sqrt {-Q} \cos \left({\frac \theta 3 + \frac {4 \pi} 3}\right) - \frac {b} {3 a}$$.

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

Proof
First the cubic is depressed:

$$ $$ $$ $$ $$

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

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

Now let $$y = u + v$$ where $$u v = -Q$$.

Then:

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

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


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

We have from above $$u v = -Q$$ and hence $$v^3 = -\frac {Q^3} {u^3}$$.

Let us try taking the positive root: $$u^3 = R + \sqrt {Q^3 + R^2}$$.

Then:

$$ $$ $$

The same sort of thing happens if you start with $$u^3 = R - \sqrt{Q^3 + R^2}$$: we get $$v^3 = R + \sqrt{Q^3 + R^2}$$.

Thus we see that taking both square roots gives us only one solution; WLOG:
 * $$u^3 = R + \sqrt{Q^3 + R^2}$$;
 * $$v^3 = R - \sqrt{Q^3 + R^2}$$.

Let $$S = \sqrt [3] {R + \sqrt{Q^3 + R^2}}, T = \sqrt [3] {R - \sqrt{Q^3 + R^2}}$$.

From Complex Roots of a Number, we have the three cube roots of $$u^3$$ and $$v^3$$:



u = \begin{cases} S & \\ \left ({-\dfrac 1 2 + \dfrac {\imath \sqrt 3} 2}\right) S & \\ \left ({-\dfrac 1 2 - \dfrac {\imath \sqrt 3} 2}\right) S & \\ \end{cases} $$



v = \begin{cases} T & \\ \left ({-\dfrac 1 2 + \dfrac {\imath \sqrt 3} 2}\right) T & \\ \left ({-\dfrac 1 2 - \dfrac {\imath \sqrt 3} 2}\right) T & \\ \end{cases} $$

Because of our constraint $$u v = -Q$$, there are only three combinations of these which are possible such that $$y = u + v$$:



y = \begin{cases} & S + T \\ \left ({-\dfrac 1 2 + \dfrac {\imath \sqrt 3} 2}\right) S + \left ({-\dfrac 1 2 - \dfrac {\imath \sqrt 3} 2}\right) T = & -\dfrac {S + T} 2 + \dfrac {\imath \sqrt 3} 2 \left({S - T}\right)\\ \left ({-\dfrac 1 2 - \dfrac {\imath \sqrt 3} 2}\right) S + \left ({-\dfrac 1 2 + \dfrac {\imath \sqrt 3} 2}\right) T = & -\dfrac {S + T} 2 - \dfrac {\imath \sqrt 3} 2 \left({S - T}\right)\\ \end{cases} $$

As $$y = x + \frac {b} {3a}$$, it follows that the three roots are therefore:


 * $$x_1 = S + T - \frac {b} {3 a}$$;
 * $$x_2 = - \frac {S + T} 2 - \frac {b} {3 a} + \frac {\imath \sqrt 3} 2 \left({S - T}\right)$$;
 * $$x_3 = - \frac {S + T} 2 - \frac {b} {3 a} - \frac {\imath \sqrt 3} 2 \left({S - T}\right)$$.

Different Signs of Discriminant
Let $$a, b, c, d \in \R$$. Then $$Q, R \in \R$$.

We have from above that $$D = Q^3 + R^2$$.

Zero Discriminant

 * First the easy case: $$D = 0$$.

Hence $$S = T = \sqrt [3] R$$, and so $$S + T = 2 \sqrt [3] R, S - T = 0$$.

From the above, this gives us:


 * $$x_1 = 2 \sqrt [3] R - \frac {b} {3 a}$$;
 * $$x_2 = - \sqrt [3] R - \frac {b} {3 a}$$;
 * $$x_3 = - \sqrt [3] R - \frac {b} {3 a}$$.

Thus the roots $$x_2$$ and $$x_3$$ are equal, and all three roots are real; they are all equal when $$R = 0$$.

Positive Discriminant
Let $$D = Q^3 + R^2 > 0$$.

Then $$S = R + \sqrt{Q^3 + R^2}$$ and $$T = R - \sqrt{Q^3 + R^2}$$ are wholly real and distinct.

Therefore, so are $$S + T$$ and $$S - T$$.

Hence $$- \frac {S + T} 2 - \frac {b} {3 a} + \frac {\imath \sqrt 3} 2 \left({S - T}\right)$$ and $$- \frac {S + T} 2 - \frac {b} {3 a} - \frac {\imath \sqrt 3} 2 \left({S - T}\right)$$ are complex conjugates.

Negative Discriminant
Let $$D = Q^3 + R^2 < 0$$.

Then $$\sqrt D = \pm i \left|{Q^3 + R^2}\right| = \pm i E$$, say, where $$E > 0$$.

Thus $$S^3 = R + i E, T^3 = R - i E$$.

Let $$\sqrt [3] {R + i E} = p + i q$$, and so $$\sqrt [3] {R - i E} = p - i q$$.

Hence $$S + T = 2 p, S - T = 2 i q$$.

So:

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

Subtracting $$\frac {b} {3 a}$$ from the above, we obtain the three distinct real solutions:
 * $$x_1 = 2p - \frac {b} {3 a}$$;
 * $$x_2 = -p - \sqrt 3 q - \frac {b} {3 a}$$;
 * $$x_3 = -p + \sqrt 3 q - \frac {b} {3 a}$$.

Proof of Alternative Form of Solutions for Negative Discriminant
Let $$D = Q^3 + R^2 < 0$$.

Then $$S^3 = R + i \sqrt{\left|{Q^3 + R^2}\right|}$$.

We can express this in polar form: $$S^3 = r \left({\cos \theta + \imath \sin \theta}\right)$$ where:
 * $$r = \sqrt {R^2 + \left({\sqrt{Q^3 + R^2}}\right)^2} = \sqrt {R^2 - \left({Q^3 + R^2}\right)} = \sqrt {-Q^3}$$;
 * $$\tan \theta = \frac {\left|{Q^3 + R^2}\right|} R$$.

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

Similarly for $$T^3$$.

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

follows after some algebra.

Historical Note
This method (in an incomplete form) was first published by Gerolamo Cardano in 1545. He learned the technique from Niccolò Fontana Tartaglia, who had sworn him to secrecy. However, as Cardano learned in 1543, the technique had in fact first been discovered by Scipione del Ferro, so he no longer felt bound by his oath to Tartaglia. The latter did not see the matter in the same light, and entered into a feud with Cardano that lasted a decade.

The method detailed here was not actually analyzed in depth until the work of Rafael Bombelli, who was the first one to solve the problem of what to do about the "imaginary numbers" that inevitably arose when using this formula.