How is this linear 2nd-order ODE solved? 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 .
 A: This is a pretty standard ODE to solve, because it is just a 2nd order linear differential equation. It is inhomogeneous though. By that I mean we are looking at the equation
\begin{align}
\ddot{\phi_2} + \phi_2 = f(\tau).
\end{align}
Here $f(\tau) = -g_2 \phi_1^2 - \omega_1 \ddot{\phi_1}$, whose dependence on $\tau$ we know explicitly. 
Now say that we have a solution $\psi(\tau)$ of this differential equation. Note that because of linearity, a function of the form $\psi(\tau) + \Phi(\tau)$ where $\Phi(\tau)$ satisfies the homogeneous ODE
\begin{align}
\ddot{\Phi} + \Phi = 0
\end{align}
is a solution too. This should be obvious to you.
Now this homogenous ODE is just an ODE of a simple harmonic oscillator. You should know the solution to this. If you don't, then it is time to stop reading these research papers and pick up an introductory book to ODEs....
Next we have to solve for the particular solution of the inhomogeneous ODE $\psi(\tau)$. Look at what $f(\tau)$ is. It has 3 kinds of terms:
\begin{align}
&\sim \cos(\tau + \alpha) \\
&\sim \cos(2(\tau + \alpha)) \\
& \sim constant.
\end{align}
The first term comes from the $\ddot{\phi_1}$ term, while the other two terms comes from $\phi_2^2$ (and using a trignometric identity).
So we are led to consider a particular solution of this form:
\begin{align}
\psi(\tau) = A \cos(\tau + \alpha) + B \sin(\tau + \alpha) + C \cos(2(\tau + \alpha)) + D\sin(2(\tau + \alpha)) + E.
\end{align}
Plugging that into the ODE will give you what $A, B, C, D, E$ should be. Please try it yourself, otherwise, like DaPhil says, you will never learn how to do it.
Cheers.
A: For the sake of convenience, let's say we have guessed the solution of eqn. (11). Now just put your guess into eqn. (11) (together with eqn. (13)) and voila, you see that it is indeed a correct guess! There are ways to derive that the solution has to look like this, but this is a bit more complex. Really, just think of it that you guess a solution (a smart guess though) and you can proof it by inserting.  
EDIT: Full solution for eqn. (11) 
I will not try and explain how to obtain the solution since I think you have to learn the basics first. I will show you how to do it the easy way. But I think the mistake in nervxxx's description is the missing $\tau$ dependence in one of the prefactors.  
Anyway, let's start with the given $\phi_2$.  
$\phi_2=p_2\cos x +q_2 \sin x + \frac{g_2}{6}p_1^2\cos 2x - \frac{g_2}{2}p_1^2+\frac{\omega_1}{2}p_1\tau\sin x + \frac{\omega_1}{4}p_1\cos x\\ x=\tau+\alpha$  
Doing the first and second derivation about $\tau$ gives:  
$\ddot\phi_2=-p_2\cos x -q_2 \sin x - \frac{2g_2}{3}p_1^2\cos 2x+\omega_1p_1\cos x - \frac{\omega_1}{4}p_1\cos x - \frac{\omega_1}{2}p_1\tau\sin x$  
Now we calculate $\ddot\phi_2+\phi_2$:  
$\ddot\phi_2+\phi_2=\omega_1p_1 \cos x+\frac{1}{2}g_2p_1^2\cos 2x - \frac{g_2}{2}p_1^2$  
In eqn. (11) there are two more terms we need to calculate.  
$\omega_1 \ddot\phi_1=-\omega_1 p_1 \cos x \\
g_2\phi_1^2 = g_2p_1^2\cos^2 x
$  
We now need to do something with the $\cos^2 x$. Looking at the addition theorem (hope this is the correct term in english):  
$\cos(x+x)=\cos 2x = \cos^2 x - \sin^2 x \\
\sin^2 x = 1 - \cos^2 x \\
\Rightarrow \cos 2x = 2 \cos^2 x - 1 \\
\Rightarrow \cos^2 x = \frac{1}{2} + \frac{1}{2}\cos 2x
$  
So we get:  
$g_2\phi_1^2=\frac{g_2}{2}p_1^2+\frac{g_2}{2}p_1^2\cos 2x$  
If you now calculate $\ddot\phi_2 + \phi_2 + g_2\phi_q^2 + \omega_1\ddot\phi_1$
it will indeed yield zero! So we have shown that the given ansatz is a solution for eqn. (11).
A: 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?
