TITLE: How is this linear 2nd-order ODE solved?
QUESTION [5 upvotes]: In this article, the authors present the inhomogeneous equation
$$\ddot{\phi}_2 + \phi_2 + g_2\phi_1^2 + \omega_1\ddot{\phi}_1 = 0,\tag{11}$$
where
$$ \phi_1 = p_1 \cos(\tau + \alpha), \tag{13}$$
followed by its solution
$$\phi_2 = p_2\cos(\tau + \alpha) + q_2\sin(\tau + \alpha) + \frac{g_2}{6}p_1^2[\cos(2\tau + 2\alpha) - 3] $$
$$+ \frac{\omega_1}{4}p_1[2\tau\sin(\tau + \alpha) + \cos(\tau + \alpha)]. \tag{14}$$
Check my solution .

REPLY [2 votes]: Particular solution can be written in the form\begin{align}
\phi_2 = p_2 \cos(\tau + \alpha) + q_2 \sin(\tau + \alpha) + C \cos(2(\tau + \alpha)) + D\sin(2(\tau + \alpha)) + E.
\end{align}
Now after doing derivative, we get, 
$$\dot{\phi_2}= -p_2 sin(\tau +\alpha)+q_2cos(\tau+ \alpha)-2Csin(2\tau+2\alpha)+2Dcos(2\tau+2\alpha)$$
$$\ddot{\phi_2}= -p_2 cos(\tau +\alpha)-q_2sin(\tau+ \alpha)-4Csin(2\tau+2\alpha)-4Dsin(2\tau+2\alpha)$$
putting these into equation (11), we get,
$$E-3Ccos(2\tau+2\alpha)-3Dsin(2\tau+2\alpha)+\frac{1}{2}g_2p_1^2+\frac{1}{2}g_2p_1^2cos(2\tau+2\alpha)-\omega_1p_1cos(\tau+\alpha)=0$$
$$-3Dsin(2\tau+2\alpha)+cos(2\tau+2\alpha)(-3C-\frac{1}{2}g_2p_1^2)+[E+\frac{1}{2}g_2p_1^2-\omega_1p_1cos(\tau+\alpha)]=0$$
Now, we get,
$$D=0$$, $$-3C-\frac{1}{2}g_2p_1^2=0$$ $$C=\frac{g_2p_1^2}{6}$$ then E becomes
$$E=\omega_1p_1cos(\tau + \alpha)- \frac{1}{2}g_2p_1^2$$
Therefore we get, the require solution,
\begin{align}
\phi_2 = p_2 \cos(\tau + \alpha) + q_2 \sin(\tau + \alpha) + \frac{g_2p_1^2}{6} \cos(2(\tau + \alpha)) + \omega_1p_1cos(\tau+\alpha)-\frac{1}{2}g_2p_1^2
\end{align}
\begin{align}
\phi_2 = p_2 \cos(\tau + \alpha) + q_2 \sin(\tau + \alpha) + \frac{g_2p_1^2}{6} [\cos(2(\tau + \alpha)) -3]+ \omega_1p_1cos(\tau+\alpha)
\end{align}
check the solution of the last term, whats wrong in my calculations?