generating function question, method?

56 Views Asked by At

Write a closed formula for the generating function of the sequence $a_n=(2n+3)(-1)^n$

So first I try

$A(z)=\sum_{z=0}^\infty (2n+3)(-1)^nz^n$

$=\sum_{n=0}^\infty [2(n+1)+1](-1)^nz^n$

$=2\sum_{n=0}^\infty (n+1)(-1)^nz^n + \sum_{n=0}^\infty (-1)^nz^n$

$=\frac2{(1+z)^2}+\frac1{1+z}$

However, the answer is $A(z)=\frac{-2z}{(1+z)^2}+\frac3{(1+z)}$

So I just wondered what is wrong with my method?