# Find cubic equation roots: what choice to make for cube root to avoid circularly permuting the roots?

My work involves solving a cubic equation similar to this $a x^3+b x^2+c x +d$ which has three roots, $x_1, x_2, x_3$ (as given in https://en.wikipedia.org/wiki/Cubic_function.) $$x_k=-\frac{1}{3a}(b+u_k C+ \frac{\Delta_0}{u_k C}) \;\; k \in {1,2,3}$$ where $u_1=1$, $u_2=\frac{(-1+ i\sqrt{3})}{2}$, $u_3=\frac{(-1- i\sqrt{3})}{2}$ and $C=\sqrt[3]\frac{\Delta_1+\sqrt{\Delta_1^2-4 \Delta_0^3}}{2}$ and $\Delta_0$ and $\Delta_1$ are function of $a, b, c, d$. As given in the above link, changing of choice for the cube root $\sqrt[3]{}$ when calculating $C$ amounts to circularly permuting the roots. For my problem there is only one root in the desired solution set (since the problem is convex). Note that the value inside $\sqrt[3]{}$ when calculating $C$ can be real or complex. According to Matlab's choice of root (i.e., when I write $\sqrt[3]{}$ in the Matlab script to find $C$), $x_1$ is the desired solution always. However if the choice $\sqrt[3]{}$ is changed $x_2$ or $x_3$ may be the desired solution. So if I want to write specifically one of the three roots (let say $x_1$) as my desired solution, do I need to write a rule for choice of cube root (to calculate $C$)? Please help me to understand how can I write a specific solution to my problem.

Since your problem has a unique real solution, the radicand inside the cubic root is always real, because $\Delta_1^2 - 4 \Delta_0^3 \geq 0$, and you can take either plus or minus sign for the square root. Thus you just need to define the cubic root to be the unique real one, and take $x_1$, that is, $u_1 = 1$. Note that in this case, changing the sign of the square root inside the cube root is equivalent to interchanging $u_1 C$ and $\frac{\Delta_0}{u_1 C}$.