Cardano's Formula/Real Coefficients

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

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

Let $D$ be the discriminant of $P$:
 * $D := 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}$

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.

Proof
From Cardano's Formula, the roots of $P$ are:


 * $(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)$

where:
 * $S = \sqrt [3] {R + \sqrt{Q^3 + R^2}}$
 * $T = \sqrt [3] {R - \sqrt{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}$