# Reducing a complex expression to a real expression

I need to find a real root of the cubic equation

$$\frac{-x^3 + 3 x + 2}{4}=p$$

where $0<p<1$

I am only interested in the real root in the interval $[-1;1]$

When I try to solve this equation using wolfram alpha it keeps coming up with a solution that contains imaginary components (denoted with an $i$). However I happen to know that the imaginary components all cancel out, but I am not able to prove this and thus not able to come up with a solution that I can implement in R.

The wolfram alpha solution is

$$x=\frac{-1+i \sqrt{3}}{2 \sqrt[3]{1-2 p+2 \sqrt{-p+p^2}}}-\frac{1+i \sqrt{3}}{2} \sqrt[3]{1-2 p+2 \sqrt{-p+p^2}}$$

How can this be reduced to a real solution?

Any help is much appreciated.

• there would appear to always be three real roots $x$ for this. Even though you are just interested in one of them, en.wikipedia.org/wiki/… means it will always be expressed in cube roots of imaginary numbers. If there is a rational root, that changes things, but it would appear that you want a formula for all $0 <p<1$ – Will Jagy Sep 20 '15 at 19:32

You can have this root with a trigonometric method: set $\;x=A\cos t$, $A>0$. The equation can be written as $$x^3-3x=2-4p\iff A(A^2\cos^3t-3\cos t)=2(1-2p).$$ Note that, as $p\in [0,1]$, $1-2p\in [-1,1]$. If we choose $A=2$, the equation simplifies to $$4\cos^3t-3\cos t=1-2p\iff \cos 3t=1-2p,$$ Its solutions are $3t\equiv \pm \arccos(1-2p)\mod 2\pi\iff t\equiv \pm\dfrac13 \arccos(1-2p)\mod \dfrac{2\pi}3$.
Since we're interested only in $\cos t$, we'll drop the $-$ sign. Thus the solutions are $$x_1=2\cos\Bigl(\frac13\arccos(1-2p)\Bigr),\quad x_2=2\cos\Bigl(\frac13\arccos(1-2p)+\frac{2\pi}3\Bigr), \quad x_3=2\cos\Bigl(\frac13\arccos(1-2p)-\frac{2\pi}3\Bigr).$$ As $\;\dfrac13\arccos(1-2p)\in\Bigl[0,\dfrac\pi3\Bigr]$, $x_1\in[1,2]$. Similarly, one can check $x_2\in[-2,-1]$ and $\;x_3\in[-1,1]$. Furthermore, as $p\ne 0,1$, it is easy to see the roots cannot be $\pm1$. Thus the root in $[-1,1]$ is $$x_3=2\cos\Bigl(\frac13\arccos(1-2p)-\frac{2\pi}3\Bigr).$$