Cardano's Formula

Theorem
Let $P$ be the cubic equation:
 * $a x^3 + b x^2 + c x + d = 0$ with $a \ne 0$

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

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

Real Coefficients
Let $a, b, c, d \in \R$.

Then:
 * $(1): \quad$ if $D > 0$, then one root is real and two are complex conjugates
 * $(2): \quad$ if $D = 0$, then all roots are real, and at least two are equal
 * $(3): \quad$ 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.

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


 * $x_1 = 2 \sqrt {-Q} \cos \left({\dfrac \theta 3}\right) - \dfrac b {3 a}$
 * $x_2 = 2 \sqrt {-Q} \cos \left({\dfrac \theta 3 + \dfrac {2 \pi} 3}\right) - \dfrac b {3 a}$
 * $x_3 = 2 \sqrt {-Q} \cos \left({\dfrac \theta 3 + \dfrac {4 \pi} 3}\right) - \dfrac b {3 a}$

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

Proof
First the cubic is depressed, by using the Tschirnhaus Transformation:
 * $x \to x + \dfrac b {3 a}$:

Now let:
 * $y = x + \dfrac b {3 a}, Q = \dfrac {3 a c - b^2} {9 a^2}, R = \dfrac {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$.

From Solution to Quadratic Equation:


 * $u^3 = \dfrac {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 = -\dfrac {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 Number, we have the three cube roots of $u^3$ and $v^3$:


 * $u = \begin{cases}

& S \\ \left ({-\dfrac 1 2 + \dfrac {i \sqrt 3} 2}\right) & S \\ \left ({-\dfrac 1 2 - \dfrac {i \sqrt 3} 2}\right) & S \\ \end{cases}$


 * $v = \begin{cases}

& T \\ \left ({-\dfrac 1 2 + \dfrac {i \sqrt 3} 2}\right) & T \\ \left ({-\dfrac 1 2 - \dfrac {i \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 {i \sqrt 3} 2}\right) S + \left ({-\dfrac 1 2 - \dfrac {i \sqrt 3} 2}\right) T = & -\dfrac {S + T} 2 + \dfrac {i \sqrt 3} 2 \left({S - T}\right)\\ \left ({-\dfrac 1 2 - \dfrac {i \sqrt 3} 2}\right) S + \left ({-\dfrac 1 2 + \dfrac {i \sqrt 3} 2}\right) T = & -\dfrac {S + T} 2 - \dfrac {i \sqrt 3} 2 \left({S - T}\right)\\ \end{cases}$

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


 * $(1): \quad x_1 = S + T - \dfrac b {3 a}$
 * $(2): \quad x_2 = - \dfrac {S + T} 2 - \dfrac b {3 a} + \dfrac {i \sqrt 3} 2 \left({S - T}\right)$
 * $(3): \quad x_3 = - \dfrac {S + T} 2 - \dfrac b {3 a} - \dfrac {i \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:


 * $(1): \quad x_1 = 2 \sqrt [3] R - \dfrac b {3 a}$


 * $(2): \quad x_2 = - \sqrt [3] R - \dfrac b {3 a}$


 * $(3): \quad x_3 = - \sqrt [3] R - \dfrac 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:
 * $\dfrac {S + T} 2 - \dfrac b {3 a} + \dfrac {i \sqrt 3} 2 \left({S - T}\right)$

and
 * $\dfrac {S + T} 2 - \dfrac b {3 a} - \dfrac {i \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 $\dfrac b {3 a}$ from the above, we obtain the three distinct real solutions:
 * $(1): \quad x_1 = 2 p - \dfrac b {3 a}$
 * $(2): \quad x_2 = -p - \sqrt 3 q - \dfrac b {3 a}$
 * $(3): \quad x_3 = -p + \sqrt 3 q - \dfrac b {3 a}$

Proof of Trigonometric 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 + i \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 = \dfrac {\sqrt{\left|{Q^3 + R^2}\right|}} R$

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

Similarly for $T^3$.

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

follows after some algebra.

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.

The proof of the trigonometric form of solutions for negative discriminant was devised by François Viète and published in 1591.

Also known as
Cardan's Formula, from the English form of Cardano's name, Jerome Cardan.