Solution (source code)

= Solution

For the <homogeneous linear differential equation>, the <characteristic equation> is $r^2-2r+2=0$, with <polynomial roots> $1\pm i$. Its <homogeneous solution> is therefore $e^x(A\cos x+B\sin x)$.

Use the <method of undetermined coefficients> for a <particular solution> $y_p=ax^2+bx+c$. Substitution gives
$$
2ax^2+(2b-4a)x+(2a-2b+2c)=2x^2.
$$
Equating coefficients yields $a=1$, $b=2$ and $c=1$. Hence the <general solution> is
$$
\boxed{y=e^x(A\cos x+B\sin x)+x^2+2x+1.}
$$