The Cubic Formula using Modified Principal Roots

The derivation of the cubic formula required a non-standard selection of cube roots at one point, and I wanted a version which only used principal cube roots. However, it is easier to compromise and use a modified principal root function instead; the modified function uses real roots if possible and principal roots otherwise (the only case in which this makes a difference is when the input is a negative real number). With this choice of cube roots the cubic function always gives correct answers, at least when the cubic has real coefficients.

The derivation of the cubic formula required that cube roots were chosen so that the identity $\sqrt[3]{y_1^3}\sqrt[3]{y_2^3}=b^2-3ac$ is satisfied. Since $a$, $b$, and $c$ were assumed to be real, the roots need to be chosen so that $\sqrt[3]{y_1^3}\sqrt[3]{y_2^3}$ is real.

Recall that $y_1^3$, $y_2^3$ are the roots of a quadratic with real coefficients, so there are two cases to consider: either they are both real or they are complex conjugates.

Case 1: Neither $y_i^3$ Real

Since $y_1^3$ and $y_2^3$ are nonreal complex conjugates, $\sqrt[3]{y_1^3}$ and $\sqrt[3]{y_2^3}$ are also complex conjugates. Thus $\sqrt[3]{y_1^3}\sqrt[3]{y_2^3}$ is a real number.

Case 2: Both $y_i^3$ Real

Since $y_1^3$ and $y_2^3$ are real and real cube roots are used when possible, $\sqrt[3]{y_1^3}$ and $\sqrt[3]{y_2^3}$ are also real. Thus $\sqrt[3]{y_1^3}\sqrt[3]{y_2^3}$ is a real number.