Particular solution of $\sin^2(x)$ I have the differential equation:
$$y'' + y = \sin^2(x)$$ 
and to solve it I need to use variation of parameters and therefore I need to find the form of the particular solution. 
What is your way of finding the form of the solution?
Any suggestions on how to do this would be appreciated.
 A: My way: Use the fact that $\sin^2 x=\frac{1-\cos 2x}{2}$. For the  $-\frac{\cos(2x)}{2}$ part, use $a\cos(2x)$ for suitable $a$. And for the $\frac{1}{2}$ part, use $\frac{1}{2}$.
A: The right-hand side can be reduced to standard form: $\sin^2x=\dfrac{1-\cos 2x}2$. $\cos 2x$ is not a solution of the homogeneous equation, and we know in such a case there's a particular solution of the form:
$$A\sin 2x+B\cos 2x.$$
The simplest way to compute it to use the fact that $\cos 2x$ is the real part of $\mathrm e^{2\mkern1mu\mathrm i x}$. So you first solve for right-hand side $=\mathrm e^{2\mkern1mu\mathrm i x}$, then take the real part of the solution. You'll find
$$y_0=\frac x2+\frac16\,\cos 2x.$$
A: I believe you mentioned you want to use the method of "variation of parameters"! So solution of the homogeneous differential equation gives the solutions $y_1 =\cos x $, $ y_2 =\sin x  $ with ronskian $W(y_1,y_2) =1 $. The particular solution is given by
$$ y_p = -y_1\int \frac{y_2 \sin^2(x) } {W(y_1,y_2)}+ y_2\int \frac{y_1 \sin^2(x) } {W(y_1,y_2)}$$
$$ = -\cos x\int { \sin x \sin^2(x) } + \sin x\int { \cos x \sin^2(x) }  .$$
You should finish evaluating the above integrals.
A: Using the technique here:
$$Y_p=y_h\int y_h^{-2} W_0 \left(\int y_h W_0^{-1} g \ dt\right) \ dt$$
where 
$$W_{0}=\exp\left(-{\int p \ dt}\right).$$
So $W_{0}=\exp\left(-{\int 0 \ dt}\right)=1$. Using $y_h=\cos t$ will make the integral easier, hence:
$$
\begin{aligned}
Y_p&=\cos (t) \int \frac{1}{\cos^2(t)} \left(\int \cos (t) \sin^2(t) \ dt\right) \ dt \\
&=\cos (t) \int \frac{1}{\cos^2(t)} \frac{\sin^3(t)}{3}\ dt \\
&=\cos (t) \int \frac{\sin^3(t)}{3\cos^2(t)} \ dt \\
&=\cos (t) \int \frac{1-\cos^2(t)}{3\cos^2(t)} \sin(t)\ dt \\
&= \frac{\cos (t)}{3} \left(\int \frac{\sin (t)}{\cos^2(t)}\ dt-\int\sin(t)\ dt \right) \\
&=\frac{\cos (t)}{3}\left(\frac{1}{\cos(t)}+ \cos(t)\right) \\
&=\frac{1}{3}\left(1+ \cos^2(t)\right)
\end{aligned}
$$
Alternatively, I would prefer to write the solution as
$$Y_p=\frac{1}{3}\left(2- \sin^2(t)\right).$$
One could also find the solution by the integral:
$$
Y_p=\sin (t) \int \frac{1}{\sin^2(t)} \left(\int \sin^3(t) \ dt\right) \ dt.
$$
However, I think this one takes a little more work.
