Finding general solution of p(D)x Reviewing for my math exam I came across a problem that I didn't know how to do and was unable to find any solutions online. The problem is:
Find the general solution of $p(D)x = 4e^{3t} + 2\cos(t)$, where $D = d/dt$ and $p(s) = (s-2)^2(s^2 + 1)(s-3)$
I've done problems similar to this where I am given a $p(D)$ and $f(t)$ and just need to take derivatives over and over in order to solve it. But the terminology of this problem confuses and I'm not sure how to go about it. 
Thanks in advance!
 A: You want the solution of
$$
       (D-2)^{2}(D^{2}+1)(D-3)f = 4e^{3t}+2\cos(t).
$$
$(D-3)(D^{2}+1)$ annihilates the right hand side. Therefore, the desired solution is among the solutions of
$$
         (D-2)^{2}(D^{2}+1)^{2}(D-3)^{2}f = 0.
$$
The solutions of this equation are
$$
    f=Ae^{2t}+Bte^{2t}+C\cos(t)+Et\cos(t)+F\sin(t)+Gt\sin(t)+He^{3t}+Jte^{3t}.
$$
Now plug this $f$ back into the original equation, and note that all terms are annihilated except for the terms with $E$, $G$, $J$. So $E$, $G$, $J$ must be determined so that
$$
    (D-2)^{2}(D^{2}+1)(D-3)\{Et\cos(t)+Gt\sin(t)+Jte^{3t}\}=4e^{3t}+2\cos(t).
$$
You can start differentiating, but it's easier to play with polynomials. For example, $(D-3)^{2}$ annihilates $Jte^{3t}$. So expand the polynomials around $3$:
$$
    (D-2)^{2}(D^{2}+1)(D-3)Jte^{3t} \\
   = ((D-3)+1)^{2}((D-3+3)^{2}+1)(D-3)Jte^{3t} \\
   = ((D-3)+1)^{2}((D-3)^{2}+6(D-3)+1)(D-3)Jte^{3t} \\
   = (D-3)Jte^{3t}=Je^{3t}
$$
And $(D^{2}+1)^{2}$ annihilates $t\cos(t)$, $t\sin(t)$, which motivates
$$
    (D^{2}+1)(D-2)(D-3)\{Et\sin(t)+Gt\cos(t)\}\\
   =(D^{2}+1)((D^{2}+1)+(-5D+5))\{Et\sin(t)+Gt\cos(t)\} \\
   = -5(D-1)(D^{2}+1)\{Et\sin(t)+Gt\cos(t)\} \\
   = -5(D-1)\{ 2E\cos(t)-2G\sin(t) \} \\
   = -5\{ (-2E\sin(t)-2G\cos(t)-2E\cos(t)+2G\sin(t)\} \\
   = -5\{ 2(G-E)\sin(t)-2(G+E)\cos(t)\}
$$
Therefore,
$$
    Je^{3t}+10(E-G)\sin(t)+10(E+G)\cos(t) = 4e^{3t}+2\cos(t)
$$
So $J=4$, $E=G$ and $20E=2$ or $E=1/10$. The general solution is
$$
    f = Ae^{2t}+Bte^{2t}+C\cos(t)+F\sin(t)+He^{3t}+\frac{1}{10}t\cos(t)+\frac{1}{10}t\sin(t)+4te^{3t}
$$
