find a 4th order linear, non-homo ODE whose general solution: How to find a fourth order, linear, not homogenous ODE with general solution:
$y=c_1+c_2 x+c_3 e^{2x}\cos x+c_4e^{2x}\sin x-x e^{-x}$?
Is there a specific method? I feel like it is guesswork to a certain degree. I can tell some parts such as the $c_1$ term will originally have had to be some sort of degree $4$ polynomial, and the $\sin,\cos$ terms will be some linear combination  $a\cos +b\sin$ (I think)  as well. but the other ones aren't as obvious to me. Any help would be appreicated. thank you!
 A: Looking at the solution you know that the characteristic equation of the homogeneous equation has the double root $0$ and the complex conjugate roots $2\pm i$. The characteristic equation is then
$$
r^2((r-2)^2+1)=r^4-4\,r^3+5\,r^2=0.
$$
The equation will be
$$
y''''-4\,y'''+5\,y''=f(x).
$$
You also know that $y=-x\,e^x$ is a solution. Plug it into the equation to find $f$.
A: Leave a constant term on the right hand side, then differentiate.  The first two are easy.
$$y'=c_2+c_5e^{2x}\cos x+c_6e^{2x}\sin x-e^{-x}+xe^{-x}$$
Note that I sort of skipped the trig terms.  I know that the derivative of each is going to be a linear combination of $e^{2x}\cos x$ and $e^{2x}\sin x$, but the exact constants aren't important.
$$y''=c_7e^{2x}\cos x+c_8e^{2x}\sin x+2e^{-x}-xe^{-x}$$
For this specific problem, maybe Julian's method is the best way go from here, solving for $y''$.  If you had no idea what the homogeneous equation looked like, though, the next step would be
$$e^{-2x}\sec xy''=c_7+c_8\tan x+(2-x)e^{-3x}\sec x$$
$$e^{-2x}\sec xy'''+y''(-2e^{-2x}\sec x+e^{-2x}\sec x\tan x)=c_8\sec^2x-e^{-3x}\sec x+(3x-6)e^{-3x}\sec x+(2-x)e^{-3x}\sec x\tan x$$
$$e^{-2x}\cos xy'''+y''(-2e^{-2x}\cos x+e^{-2x}\sin x)=c_8-e^{-3x}\cos x+(3x-7)e^{-3x}\cos x+(2-x)e^{-3x}\sin x$$
Differentiate one last time for the solution.  Divide both sides by the $y^{(4)}$ coefficient if you must.
