How to use the cubic formula.

The cubic $$x^3=px+q$$ with $$p,q\in \mathbb{R}$$ has the formula

$$x=\sqrt[3]{\frac{q}{2}+\sqrt{\left(\frac{q}{2}\right)^2-\left(\frac{p}{3}\right)^3}}+\sqrt[3]{\frac{q}{2}-\sqrt{\left(\frac{q}{2}\right)^2-\left(\frac{p}{3}\right)^3}}$$ When $$\left(\frac{q}{2}\right)^2-\left(\frac{p}{3}\right)^3<0$$ we have the cube roots of two complex numbers which are conjugates, so the answer is real. If $$z=\frac{q}{2}+\sqrt{\left(\frac{q}{2}\right)^2-\left(\frac{p}{3}\right)^3}$$ then we want $$2\textrm{Re}\left(z^{1/3}\right)$$. How does one get this last result in real form without solving another cubic?

**Edit. ** To clarify, this is easily done analytically: once we have $$z$$ we can get its polar form $$re^{i\theta}$$ then $$z^{1/3}=r^{1/3}e^{i\theta/3}$$ and then $$2\textrm{Re}\left(z^{1/3}\right)=2r^{1/3}\cos\left(\theta/3\right)$$. However, if one wants $$\cos\left(\theta/3\right)$$ in terms of $$tan^{-1}\left(\theta\right)$$, one finds another cubic. Is there an algebraic way out? i.e. using arithmetic operations and $$n^{\textrm{th}}$$ -roots of reals only?

In general, if $$z=a+bi$$ you can take its cube roots by converting to polar form. Write $$z=re^{i\theta}$$ with $$r=\sqrt{a^2+b^2}, \theta=\pm \arctan \frac ba$$ where you choose the sign to get the correct quadrant. Then $$z^{1/3}=r^{1/3}e^{i\theta/3+2k\pi/3}$$ where $$k$$ is any integer.

• Sorry this is not what I meant, I should've explained: the solution you propose would then give $x=2r^{1/3}\cos\left(\theta /3+2\pi k\right)$. If you can calculate cos and tan, then this works. However, to try to find $\cos\left(\tan^{-1} \left(x\right)/3\right)$ algebraically, one ends up solving a cubic. So I meant an algebraic way out. – Joshua Tilley Oct 11 at 15:27
• @JoshuaTilley no you don’t have to if you invoke trig identities. – Elen Khachatryan Oct 11 at 15:34
• @ElenKhachatryan, the one-third angle formula needed gives rise to a new cubic. – Joshua Tilley Oct 11 at 15:36