<s>[INST] Solve the equation $(D^2+4)y=x\sin^2 x$. It is given that $D=\frac {d}{dx}$ Solve the equation $(D^2+4)y=x\sin^2 x$. It is given that $D=\frac {d}{dx}$
My Attempt:
The given equation is 
$$(D^2+4)y=x\sin^2 x$$
It's auxiliary equation is
$$m^2+4=0$$
$$m^2=-4$$
$$m=\pm 2i$$
$$\textrm {Complementary Function (C.F)}=c_1 \cos (2x) + c_2 \sin (2x)$$
Now, the particular integral is given by
$$\textrm {P.I.}=\frac {x\sin^2 x}{D^2+4}$$
$$=\frac {x}{D^2+4}\cdot \frac {1-\cos (2x)}{2}$$
$$=\frac {x}{2(D^2+4)} - \frac {x\cdot \cos (2x)}{2(D^2+4)}$$
$$=\frac {1}{2} \cdot \frac {1}{4} \cdot (1+\frac {D^2}{4})^{-1} \cdot x - \frac {1}{2}(x\cdot \frac {\cos (2x)}{D^2+4} - \frac {2D \cos (2x)}{(D^2+4)^2})$$
$$=\frac {x}{8} - \frac {1}{2} (x\cdot \frac {x \cos (2x)}{2D} - \frac {2D \cos (2x)}{(D^2+4)^2} )$$
How do I solve further?
 [/INST] Starting from here:
$$y_p=\frac {x\sin^2 x}{D^2+4}$$
$$2y_p=\frac {x(1-\cos (2 x))}{D^2+4}$$
$$2y_p=\frac {x }{D^2+4}-\frac {x\cos (2 x)}{D^2+4}$$
$$2y_p=\dfrac x 4-(x-\dfrac {2D}{D^2+4})\frac {\cos(2 x)}{D^2+4}$$
More simply:
$$2y_p=\dfrac x 4-x\frac {\cos(2 x)}{D^2+4}$$
$$2y_p=\dfrac x 4-\Re \{x\frac {e^{2 ix}}{D^2+4}\}$$
$$2y_p=\dfrac x 4-\Re \{xe^{2 ix}\frac {1}{D(D+4i)}\}$$
$$2y_p=\dfrac x 4-\Re \{ \dfrac {xe^{2 ix}}{4i}({\frac 1D -\dfrac 1{D+4i}})\}$$
$$2y_p=\dfrac x 4-\Re \{\dfrac {xe^{2 ix}}{4i}({x -\dfrac 1{4i}})\}$$
Now apply Euler's formula to get the final result:
$$\boxed {y_p=\dfrac x 8-\frac {x^2}{16}\sin (2x)-\dfrac {x}{32} \cos(2x)}$$
</s>