Generating function: Find a closed form of $\sum_{k=0}^n (-3)^k(k+1)$ Find the closed form of $\sum_{k=0}^n (-3)^k(k+1)$.
So the generating function would be: $$A(x)=1-6x+18x^2-108x^3...$$ So what I did notice is that its closed form is perhaps some variation of $1\over {1+x}$ but I didn't manage to find a general formula. 
Thanks for any help in advance! 
 A: Let $f(x) = \sum_{k=0}^n x^{k+1}
= \frac{x-x^{n+2}}{1-x}
$.
Then $f'(x) = \sum_{k=0}^n (k+1)x^k$,
so $f'(-3) = \sum_{k=0}^n (k+1)(-3)^k$.
So 
$\begin{align}
f'(x) &= \frac{(x-x^{n+2})'(1-x) - (1-x)'(x-x^{n+2})}{(1-x)^2}\\
&= \frac{(1-x)(1-(n+2)x^{n+1})+x-x^{n+2}}{(1-x)^2}\\
&= \frac{1-(n+2)x^{n+1}-x+(n+2)x^{n+2}+x-x^{n+2}}{(1-x)^2}\\
&= \frac{1-(n+2)x^{n+1}+(n+1)x^{n+2}}{(1-x)^2}\\
\end{align}
$
Putting $x = -3$,
$\begin{align}
f'(-3) 
&= \frac{1-(n+2)(-3)^{n+1}+(n+1)(-3)^{n+2}}{4^2}\\
&= \frac{1-(-3)^{n+1}((n+2)+(n+1)3)}{4^2}\\
&= \frac{1-(-3)^{n+1}(4n+5)}{16}\\
\end{align}
$
As a check (since I did this off the top of my head):
If $n=0$, 
$f'(-3) = \frac{1-(-3)^{1}(5)}{16}
=\frac{1+15}{16}
=1
$
and $1*(-3)^0 = 1$.
If $n=1$, 
$f'(-3) = \frac{1-(-3)^{2}(4+5)}{16}
=\frac{1-9*9}{16}
=-5
$
and $1+2*(-3) = -5$.
If $n=2$, 
$f'(-3) = \frac{1-(-3)^{3}(8+5)}{16}
=\frac{1+27*13}{16}
=22
$
and $-5+3*(-3)^2 = -5+27 = 22$.
A: We have that $$A(x)=\sum_{n=0}^\infty a_nx^n,\qquad a_n=\sum_{k=0}^n(-3)^k(k+1).$$
Note that
$$a_{n+1}-a_n=(-3)^{n+1}(n+2),$$
which implies that
$$\begin{align*}
(1-x)A(x)=A(x)-xA(x)&=\sum_{n=0}^\infty (a_nx^{n}-a_nx^{n+1})\\\\
&=a_0+\sum_{n=1}^\infty (a_n-a_{n-1})x^n\\\\\\
&=1+\sum_{n=1}^\infty(-3)^{n+1}(n+2)x^n\\\\\\
&=1-3\sum_{n=1}^\infty n(-3x)^n-6\sum_{n=1}^\infty (-3x)^n
\end{align*}$$
Can you take it the rest of the way?
A: Let $a_{n}=(-3)^n(n+1)$ and let $f(x)=\sum_n a_{n}x^n$ be the generating function of $a_{n}$.
From a property of generating functions we have,that if $f$ is the Generating Function of {$a_{n}$},then $\frac{f}{1-x}$ is the generating function of {$\sum_{k=0}^n  a_{k}$}$_{n\ge0}$,which is precisely what you want.
Now,in order to calculate $f$,we have $$\sum_{n\ge0}a_{n}x^n=\sum_{n\ge0} n(-3x)^n+\sum_{n\ge0} (-3x)^n$$
$$\Rightarrow f=\frac{-3x}{(1+3x)^2} + \frac{1}{1+3x}=\frac{1}{(1+3x)^2}$$
Therefore,$$\frac{f}{1-x}=\frac{1}{(1-x)(1+3x)^2}$$Which is the required generating function.
