# 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{y_1^3}\sqrt{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{y_1^3}\sqrt{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{y_1^3}$ and $\sqrt{y_2^3}$ are also complex conjugates. Thus $\sqrt{y_1^3}\sqrt{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{y_1^3}$ and $\sqrt{y_2^3}$ are also real. Thus $\sqrt{y_1^3}\sqrt{y_2^3}$ is a real number.