<s>[INST] Solving $(D^2-1)y=e^x(1+x)^2$ I did like this:
$$\text{Let,} y=e^{mx} \text{ be a trial solution of } (D^2-1)y=0$$
$$\therefore \text{The auxiliary equation is } m^2-1=0$$
$$\therefore m=\pm1\\
\text{C.F.} = c_1e^x+c_2e^{-x}$$
$$\begin{align}
\text{P.I.}& =\frac{1}{D^2-1}e^x(1+x)^2\\
& =e^x\frac{1}{(D+1)^2-1}(1+2x+x^2)\\
& =e^x\frac{1}{D^2+2D}(1+2x+x^2)\\
& =\frac{e^x}{2}\left[\frac{1}{D}-\frac{1}{D+2}\right](1+2x+x^2)\\
& =\begin{aligned}
\frac{e^x}{2}\frac{1}{D}(1+2x+x^2)-\frac{e^x}{2}\frac{1}{D+2}(1+2x& +x^2)\\
\end{aligned}\\
& =\frac{e^x}{2}\left(x+x^2+\frac{x^3}{3}\right)-\frac{e^x}{4}\left(x^2+x+\frac{1}{2}\right)\\
& =e^x\left(\frac{x^3}{6}+\frac{x^2}{4}+\frac{x}{4}-\frac{1}{8}\right)\\
\end{align}$$
$$\therefore \text{The solution is}$$
$$y=c_1e^x+c_2e^{-x}+e^x\left(\frac{x^3}{6}+\frac{x^2}{4}+\frac{x}{4}-\frac{1}{8}\right)$$
But, in my book the answer is:
$$y=c_1e^x+c_2e^{-x}+\frac{xe^x}{12}(2x^2+3x+3)$$
$$\text{Please, check if there is any } \color{red}{mistake}.$$
 [/INST] The answers are essentially the same.  $-\frac18e^x$ can be absorbed in $c_1e^x$.
</s>