Let y=y₁+y₂+y₃.
We can “factorise” the D “polynomial”: (D+1)(D+2) which gives us the solution for y₁=Ae⁻ˣ+Be⁻²ˣ, where A and B are constants of integration.
Let’s assume initially that y₂=aeˣ, so D=D²=y₂, where a is a constant to be found.
(D²+3D+2)y₂=aeˣ+3aeˣ+2aeˣ=6aeˣ, so, since we have to have eˣ in the final result, a=⅙. Therefore y₂=eˣ/6.
Let’s assume y₃=bx²+cx+d, where b, c and d are constants to be found.
2y₃=2bx²+2cx+2d,
Dy₃=2bx+c, 3Dy₃=6bx+3c,
D²y₃=2b.
(D²+3D+2)y₃=2b+6bx+3c+2bx²+2cx+2d=
2bx²+2(3b+c)x+(2b+3c+2d)≡x².
This is an equivalence so the coefficients must match:
therefore, b=½, 3b+c=0, so c=-3/2, and 2b+3c+2d=0, so d=½(-1+9/2)=7/4.
That gives us y₃=x²/2-3x/2+7/4.
Put all the components together and we get the solution:
y=Ae⁻ˣ+Be⁻²ˣ+eˣ/6+x²/2-3x/2+7/4.