# Solve second-order linear ODE

everyone, I've a ODE to find a solution for it. The ODE is:

$y''+2y'+10y=x^2e^{-x}cos(3x)$

I'm trying to solve it and find $y_h(x)=c_1e^{-x}sin(3x)+c_2e^{-x}cos(3x)+y_p$. The problem is to find $y_p$, the particular solution. I tryed to fint it, but a found a MONSTROUS algebric expression. Everyone have a tip to solve it more quickly? Thanks!

Hint One option is to write $$\cos 3x = \frac{1}{2} (e^{3ix} + e^{-3ix})$$ and hence the r.h.s. of the o.d.e. as $$\frac{1}{2} x^2 (e^{(-1 + 3i) x} + e^{(-1 - 3i) x}).$$ This makes writing the ansatz for $y_p$, differentiating it, and collecting like terms a little more tractable, at the cost of wrangling with complex numbers.