Consider the following solution: $$y(x) = c_1e^x + c_2xe^x + c_3x^2e^x + c_4\cos(x) + c_5\sin(x)$$ where all the $c_i$ are real constants ($c_i \in \Bbb R$). How to find a differential equation that have the previous solution?
I re-wrote the solution to the following:
$$y(x)=(c_1 + c_2x + c_3x^2)e^x + c_4\cos(x) + c_5\sin(x)$$
I can see that the solution looks like: $y(x) = Q(x)e^x + a\cos(x) + b\sin(x)$ where $Q$ is a second degree polynomial, but I don't really know how to take it from here.
\begin{eqnarray} \text{Operator} &\quad& \text{ Annihilates}\\ D^{n+1} && Q_n(x)\text{ a degree n polynomial}\\ D-a && e^{ax}\\ (D-a)^{n+1} && Q_n(x)e^{ax}\\ D^2+b^2 && c_1\cos(bx)+c_2\sin(bx)\\ (D^2+b^2)^{n+1} && Q_n(x)(c_1\cos(bx)+ c_2\sin(bx))\\ D^2-2aD+(a^2+b^2) && e^{ax}(c_1\cos(bx)+ c_2\sin(bx))\\ \left(D^2-2aD+(a^2+b^2)\right)^{n+1} &&Q_n(x)e^{ax}(c_1\cos(bx)+ c_2\sin(bx)) \end{eqnarray} If operator $L_1$ annihilates $f(x)$ and operator $L_2$ annihilates $g(x)$ then operator $L_1L_2$ annihilates $f(x)+g(x)$.
$(D-1)^3$ annihilates $(c_1+c_2x+c_3x^2)e^x$
$(D^2+1)$ annihilates $c_4\cos(x)+c_5\sin(x)$
so $(D-1)^3(D^2+1)$ annihilates their sum.
So $$y = c_1e^x + c_2xe^x + c_3x^2e^x + c_4\cos(x) + c_5\sin(x)$$ is the general solution of
$$ (D-1)^3(D^2+1)y=0 $$
which is
$$ y^{(5)}-3y^{(4)}+4y^{(3)}-4y^{\prime\prime}+3y^\prime-y=0 $$