particular solution of $(D^2+4)y=4x^2\cos 2x$ 
Find a particular solution to the equation $$(D^2+4)y=4x^2\cos 2x$$

\begin{align}
y_p&=\frac{1}{D^2+4}(4x^2\cos 2x)\\
&=\frac{1}{D^2+4}\left[2x^2(e^{2ix}+e^{-2ix})\right]\\
&=2\left[e^{2ix}\frac{1}{(D+2i)^2+4}x^2+e^{-2ix}\frac{1}{(D-2i)^2+4}x^2\right]\\
&=2\left[e^{2ix}\frac{1}{D(D+4i)}x^2+e^{-2ix}\frac{1}{D(D-4i)}x^2\right]\\
\end{align}
But I stuck at this point because how to solve $\frac{1}{D(D+4i)}x^2?$ The solution provided this

\begin{align}
&=2\left[e^{2ix}\frac{1}{D(D+4i)}x^2+e^{-2ix}\frac{1}{D(D-4i)}x^2\right]\\&=\frac{1}{4i}\left[e^{2ix}D^{-1}\left(2x^2+ix-\frac{1}{4}\right)-e^{-2ix}D^{-1}\left(2x^2-ix-\frac{1}{4}\right)\right]\\
&=\frac{1}{24}[6x^2\cos 2x+x(8x^2-3)\sin 2x]
\end{align}

I still can't figure out how they do this. Any help will be appreciated.
Update: Using @Isham answer I tired 
\begin{align}
&=\frac{1}{4i}\left[e^{2ix}D^{-1}\left(2x^2+ix-\frac{1}{4}\right)-e^{-2ix}D^{-1}\left(2x^2-ix-\frac{1}{4}\right)\right]\\
&=\frac{1}{4i}\left[e^{2ix}\left(2\frac{x^3}{3}+i\frac{x^2}{2}-\frac{x}{4}\right)-e^{-2ix}\left(2\frac{x^3}{3}-i\frac{x^2}{2}-\frac{x}{4}\right)\right]\\
&=\frac{1}{4i}\left[\frac{2x^3}{3}(e^{2ix}-e^{-2ix})+\frac{x^2i}{2}(e^{2ix}-e^{-2ix})-\frac{x}{4}(e^{2ix}-e^{-2ix})\right]\\
&=\frac{1}{4i}\left[\frac{2x^3}{3}2\cos 2x+\frac{x^2i}{2}2\cos 2x-\frac{x}{4}2\cos 2x\right]
\end{align}
But I think I am again Lost.
 A: $$E=\frac 1 {D+4i}=\frac 1 {4i}\frac 1 {(1+D/4i)}$$
$$E=\frac 1 {4i}({1+D/4i})^{-1}$$
Now you can use this ( after a certain number the derivative is zero for $x^2$:
$$\frac 1 {1-x}=\sum_{n=0}^{\infty} x^n$$
So we have that:
$$E=\frac 1 {4i}(1-\frac D {4i}-\frac {D^2}{16}+........)$$
Apply the operator on $x^2$
A: Hint:  $$\dfrac{1}{1+D} = 1-D+D^2-\cdots$$
A: A way to do basically the same thing with less weird operator manipulation is to think of the procedure as using the integrating factor method on two first order ODEs. If you have say
$$y''+4y=x^2 e^{2ix}$$
then you can write it as 
$$(D+2i)(D-2i)y=x^2 e^{2ix}.$$
Then you can let $u=(D-2i)y$ and solve $(D+2i)u=x^2 e^{2ix}$ for $u$ by the integrating factor method. So you have
$$e^{2ix} u = \int x^2 e^{4ix} dx$$
which can be evaluated by integrating by parts. Since you just want a particular solution you can set the constant of integration here equal to zero. You wind up with $u$ being some quadratic polynomial times $e^{2ix}$.
Then with $u$ in hand you just solve
$$(D-2i)y=u$$
and get
$$e^{-2ix}y = \int e^{-2ix} u$$
where now the integral winds up being the integral of just a polynomial, because of the "resonance" in the equation. Setting the constant of integration equal to zero again, you wind up with some cubic polynomial with no constant term times $e^{2ix}$.
That said, if you understand how to do this operator shifting trick that you did to pull the $e^{2ix}$ out (I guess $P(D)^{-1} f = e^{ax} P(D+a)^{-1} e^{-ax} f$?), then you can evaluate $\frac{1}{D+4i} x^2$ by just using the geometric series, expanding in powers of $D$. Thus $\frac{1}{D+4i}=\frac{1}{4i} \frac{1}{1+D/4i}=\frac{1}{4i} \sum_{n=0}^\infty (-D/4i)^n$. But now the point is that when you apply this to $x^2$ you get $0$ as soon as $n>2$, so $\frac{1}{D+4i} x^2=\frac{1}{4i} \left ( x^2 - \frac{2x}{4i} + \frac{2}{(4i)^2} \right )$. Then you just apply $D^{-1}$ to that which is just integration.
A: Given differential equation is$$(D^2+4)y=4x^2\cos 2x$$
We have to find the particular integral (P.I.).
\begin{equation}
\text{P.I.}~=4\dfrac{1}{D^2+4}~x^2\cos 2x\\
=\text{R.P. of }~\left(4\dfrac{1}{D^2+4}~x^2~e^{2ix}\right)\\
=4~\cdot~\left[\text{R.P. of }~\left\{e^{2ix}~\dfrac{1}{(D+2i)^2+4}~x^2\right\}\right]\\
=4~\cdot~\left[\text{R.P. of }~\left\{e^{2ix}~\dfrac{1}{D^2+4iD}~x^2\right\}\right]\\
=4~\cdot~\left[\text{R.P. of }~\left\{e^{2ix}~\dfrac{1}{4iD}\left(1+\dfrac{D}{4i}\right)^{-1}~x^2\right\}\right]\\
=4~\cdot~\left[\text{R.P. of }~\left\{e^{2ix}~\dfrac{1}{4iD}\left(1+i\dfrac{D}{4}-\dfrac{D^2}{16}+\cdots\right)~x^2\right\}\right]\\
=4~\cdot~\left[\text{R.P. of }~\left\{e^{2ix}~\dfrac{1}{4iD}\left(x^2+i~\dfrac{x}{2}-\dfrac{1}{8}\right)\right\}\right]\\
=-~\left[\text{R.P. of }~\left\{i~e^{2ix}~\dfrac{1}{D}\left(x^2+i~\dfrac{x}{2}-\dfrac{1}{8}\right)\right\}\right]\\
=-~\left[\text{R.P. of }~\left\{i~e^{2ix}~\left(\dfrac{x^3}{3}+i~\dfrac{x^2}{4}-\dfrac{x}{8}\right)\right\}\right]\\
=-~\left[\text{R.P. of }~\left\{i~\left(\cos 2x+i~\sin 2x\right)~\left(\dfrac{x^3}{3}+i~\dfrac{x^2}{4}-\dfrac{x}{8}\right)\right\}\right]\\
=-~\left[\text{R.P. of }~\left\{\left(i~\cos 2x-~\sin 2x\right)~\left(\dfrac{x^3}{3}+i~\dfrac{x^2}{4}-\dfrac{x}{8}\right)\right\}\right]\\
=-~\left[\text{R.P. of }~\left\{\left(-~\dfrac{x^2}{4}~\cos 2x-\left(\dfrac{x^3}{3}-\dfrac{x}{8}\right)~\sin 2x\right)~+~i~\left(-\dfrac{x^2}{4}\sin 2x+\left(\dfrac{x^3}{3}-\dfrac{x}{8}\right)\cos 2x\right)\right\}\right]\\
=-~\left[-~\dfrac{x^2}{4}~\cos 2x-\left(\dfrac{x^3}{3}-\dfrac{x}{8}\right)~\sin 2x\right]\\
=\dfrac{x^2}{4}~\cos 2x+\left(\dfrac{x^3}{3}-\dfrac{x}{8}\right)~\sin 2x
\end{equation}
Here R.P. stands for real part. 
