<s>[INST] Find a generating function for $a_r=(r-1)^2$ Problem

Find a generating function for $a_r=(r-1)^2$

My Solution
$$g(x)=1+x+x^2+x^3+\cdots=\frac{1}{1-x}$$
$$g'(x)=1+2x+3x^2+4x^3+\cdots=\frac{1}{(1-x)^2}$$
$$x\times g'(x)=x+2x^2+3x^3+4x^4+\cdots=\frac{x}{(1-x)^2}$$
$$[x\times g'(x)]'=1+2^2x+3^2x^2+4^2x^3+\cdots=\frac{1+x}{(1-x)^3}$$
$$x^2\times[x\times g'(x)]'=x^2+2^2x^3+3^2x^4+4^2x^5+\cdots=\frac{x^2(1+x)}{(1-x)^3}$$
My Answer
$$\frac{x^2(1+x)}{(1-x)^3}$$
Book's Answer (Applied Combinatorics (6th Edition) by Alan Tucker)
$$\frac{4x^2-3x+1}{(1-x)^3}$$
As you can see, my answer does not concur with the book's answer, and I'm not entirely sure what I've done wrong in my solution.  The final generating function appears to have the correct coefficients: $(2-1)^2x^2+(3-1)^2x^3+(4-1)^2x^4+\cdots$
Does anyone know what I've done wrong?
 [/INST] $\dfrac{x^2(1+x)}{(1-x)^3}=(2-1)^2x^2+(3-1)^2x^3+(4-1)^2x^4+\cdots$
appeared to be the correct answer, but actually the $a_0=(0-1)^2=1$ term is missing.
It corresponds to the constant term $1x^0$ in the generating function.
So a $1$ should be added to $\dfrac{x^2(1+x)}{(1-x)^3}$
$\dfrac{x^2(1+x)}{(1-x)^3}+1=\dfrac{(x^2+x^3)+(1-3x+3x^2-x^3)}{(1-x)^3}=\dfrac{4x^2-3x+1}{(1-x)^3}$
which matches the book's answer.  

My approach to this problem:
Let $\displaystyle f(x)=\sum_{r=0}^\infty a_rx^r=\sum_{r=0}^\infty(r-1)^2x^r$
First I break the $(r-1)^2$ into pieces.  
$(r-1)^2=r^2-2r+1=(r^2+3r+2)-5(r+1)+4=(r+2)(r+1)-5(r+1)+4$  
$\displaystyle \begin{align}f(x)&=\sum_{r=0}^\infty (r+2)(r+1)x^r-5\sum_{r=0}^\infty(r+1)x^r+4\sum_{r=0}^\infty x^r\\&=\dfrac{\mathrm d^2}{\mathrm dx^2}\sum_{r=0}^\infty x^{r+2}-5\dfrac{\mathrm d}{\mathrm dx}\sum_{r=0}^\infty x^{r+1}+4\sum_{r=0}^\infty x^r\\&=\dfrac{\mathrm d^2}{\mathrm dx^2}\dfrac{x^2}{1-x}-5\dfrac{\mathrm d}{\mathrm dx}\dfrac x{1-x}+\dfrac 4{1-x}\\&=\dfrac 2{(1-x)^3}-\dfrac 5{(1-x)^2}+\dfrac 4{1-x}\\&=\dfrac{4x^2-3x+1}{(1-x)^3}\end{align}$
as desired.
</s>