<s>[INST] Using trig identity to solve a cubic equation I need to use the identity $\cos(3\theta)=4\cos^3(\theta)-3\cos(\theta) $ to solve the cubic equation $t^3+pt+q=0$ when $27q^2+4p^3<0$. 
I believe I need to let $t=Acos(\phi)$ when $A=2\sqrt{\frac{-p}{3}}$, so that my equation looks more like the identity and I have $A^3\cos(\theta)^3+Ap\cos(\theta)+q=0$. Next I multiply by $\frac{4}{A^3}$ to get $4\cos(\theta)^3+\frac{4p}{A^2}cos(\theta)+\frac{4q}{A^3}=0$. 
So then $4\cos(\theta)^3-3\cos(\theta)-\frac{3q}{Ap}=0$. 
Now I am stuck and not sure what my next step is. 
 [/INST] For a general cubic, 
$$ax^{3}+bx^{2}+cx+d=0$$
use what is known as the Tschirnhaus-Vieta approach: let $x=t+B$, then the cubic becomes
$$t^3+\left(3B+\frac{b}{a}\right)t^2+\left(3B^2+\frac{c+2bB}{a}\right)t+\left(B^3+\frac{bB^2+cB+d}{a}\right)=0$$
By setting $B=-\frac{b}{3a}$, the coefficient of  $t^2$  becomes zero and we obtain the depressed cubic
$$t^3+pt+q=0  \tag{1}$$
where
$$p=\frac{3ac-b^{2}}{3a^2},\qquad q=\frac{2b^3-9abc+27a^{2}d}{27a^3}$$
The quantity $\Delta=-4p^3-27q^2$ is called the discriminant of the cubic (1).


*

*If $\Delta<0$, one root is real and two complex conjugate roots; 

*If $\Delta=0$ at least two roots coincide, and they are all real; 

*If $\Delta>0$ there are three unequal real roots. 


Here we have $-\Delta=4p^3+27q^2<0$ and so $\Delta>0$ and we have three unequal real roots, also since $4p^3<-27q^2$ this implies $p<0$, and $p^3<0$, which is an equivalent condition for the three real roots. 
Now using the trigonometric identity:
$$4\cos^3(\theta)-3\cos(\theta)-\cos(3\theta)=0 \tag{2}$$
transform the reduced cubic (1) to match (2). To do this let $t=A\cos(\theta)$ and substitute in to get 
$$A^3\cos^3(\theta)+Ap\cos(\theta)+q=0\tag{3}$$
Now multiply (3) by $\frac{4}{A^3}$ to give:
\begin{align*}
4\cos^3(\theta)&+\frac{4p}{A^2}\cos(\theta)+\frac{4q}{A^3}=0\tag{4}
\end{align*}
To match (4) with (2) we need $\frac{4p}{A^2}=-3$, and so $A=2\sqrt{\frac{-p}{3}}$, hence we need $p<0$ for $A$ to be real, which we already have. Thus
\begin{align*}
4\cos^3(\theta)&-3\cos(\theta)-\frac{3q}{Ap}=0
\end{align*}
And so using (2)
\begin{align*}
\cos(3\theta)=\frac{3q}{2p}\sqrt{\frac{-3}{p}}=\frac{3q}{Ap}\tag{5}
\end{align*}
Now solve the trigonometric equation (5) as
\begin{align*}
\phi&=\arccos\left(\frac{3q}{Ap}\right)
\end{align*}
where $\phi$ is one angle that satisfies (5). The solutions for $3\theta$ are then
$$3\theta=\pm \phi +2k\pi,\quad k\in\mathbb{Z},\,\,\, \phi\in[0,\pi]$$
from which the solutions for $\theta$ follow
$$\theta=\frac{2k\pi\pm\phi}{3},\quad k\in\mathbb{Z},\,\,\, \phi\in[0,\pi]\tag{6}$$
We now find three distinct values for $\theta$ which relate to the roots, and are due to periodicity of the cosine function: so putting $k=0$, $1$, and $2$ into (6), and appealing to the fact that $\cos$ is an even function gives the three roots for (1) given by $t=A\cos(\theta)$ as:
\begin{align*}
t_1&=A\cos\left(\frac{\phi}{3}\right)\\
t_1&=A\cos\left(\frac{\phi+2\pi}{3}\right)\\
t_1&=A\cos\left(\frac{\phi+4\pi}{3}\right)
\end{align*}
Remark 1: If $p>0$, then $\Delta=-4p^3-27q^2<0$, and there are two complex conjugate roots, with the real root given by:
\begin{align*}
\bar{A}&=2\sqrt{\frac{p}{3}}\\
\bar{\phi}&=\operatorname{arcsinh}\left(\frac{3q}{Ap}\right)\\
x_1&=-\bar{A}\sinh\left(\frac{\bar{\phi}}{3}\right)
\end{align*}
Remark 2: To transform back to $(\star)$ to find the solution for $x$, we initially set $x=t+B=A\cos(\theta)+B$, and so our roots for $(\star)$ are: 
\begin{align*}
x_1&=A\cos(\theta_1)+B=A\cos\left(\frac{\phi}{3}\right)+B\\
x_2&=A\cos(\theta_2)+B=A\cos\left(\frac{\phi+2\pi}{3}\right)+B\\
x_3&=A\cos(\theta_3)+B=A\cos\left(\frac{\phi+4\pi}{3}\right)+B
\end{align*}
</s>