Find $y^{(n)}$ if $y=x^2e^x \cos(x)$ 
Q:Find $y_n$ if $$y=x^2e^x \cos(x)$$ 

My Approach:
By product rule, $$y'=2xe^x \cos(x)+x^2e^x \cos(x)+x^2e^x \cos(\frac{\pi}{2}+x)$$
$$y''=2e^x \cos(x)+4xe^x \cos(\frac{\pi}{2}+x)+4xe^x \cos(x)+2x^2e^x \cos(\frac{3\pi}{2}-x)$$
If i go in this process than i think i couldn't reach any conclusion because i didn't find any pattern.Any hint or solution will be appreciated.
Thanks in advance.
 A: We also know that
$$
y=\mathrm{Re}\,x^2e^{(1+i)x},\,\,
y'=\mathrm{Re}\,2xe^{(1+i)x}+\mathrm{Re}\,(1+i)x^2e^{(1+i)x},\\
y''=\mathrm{Re}\,2e^{(1+i)x}+\mathrm{Re}\,4(1+i)xe^{(1+i)x}+\mathrm{Re}\,(1+i)^2x^2e^{(1+i)x},\\
y'''=\mathrm{Re}\,6(1+i)e^{(1+i)x}+\mathrm{Re}\,6(1+i)^2xe^{(1+i)x}+\mathrm{Re}\,(1+i)^3x^2e^{(1+i)x}
$$
and in general
$$
y^{(n)}=\mathrm{Re}\Big(\big(n(n-1)(1+i)^{n-2}+2n(1+i)^{n-1}x+(1+i)^nx^2\big)e^{(1+i)x}\Big)
$$
and hence
$$
y^{(n)}=n(n-1)2^{(n-2)/2}e^x\cos\left(x+\frac{(n-2)\pi}{4}\right)+n2^{(n+1)/2}xe^x\cos\left(x+\frac{(n-1)\pi}{4}\right)\\+2^{n/2}x^2e^x\cos\left(x+\frac{n\pi}{4}\right) \tag{1}
$$
If one is not familiar with complex number, then one can show $(1)$ inductively, using the induction of the form: $P(k)\& P(k+1)\Rightarrow P(k+2)$.
Note. The function $y$ satisfies the ODE
$$
z^{(4)}-2z^{(3)}+2z^{(2)}=0,
$$
and hence, $y^{(n)}$ satisfies the recursive relation
$$
y^{(n+2)}=2y^{(n+1)}-2y^{(n)}, \quad \text{for all $n\ge 2$.}
$$
Hence $y^{(n)}=c_1\lambda_1^n+c_2\lambda_2^n$, where $\lambda_1,\lambda_2$ are the roots 
of the quadratic equation $\lambda^2-2\lambda+2=0$. Hence, $\lambda_{1,2}=1\pm i$, and so
$$
y^{(n)}=(1+i)^nc_1+(1-i)^nc_2, \quad n\ge 2.
$$
