alternating sum of squares using a generating function

387 Views Asked by At

say we have the alternating sum of squares $f_n=\sum_{k=0}^n(-1)^kk^2$=-1+4-9+16-25+...

Any ideas how to derive this in terms of n using a generating function? I know that it can be derived by seeing that $(n+1)^2-n^2=(n+1)+n$, so we obtain that it is equal to $\frac{(-1)^nn*(n+1)}{2}$.

Let's say our generating function is as follows: $\phi(t)=\sum_{n\ge0}f_nt^n$

1

There are 1 best solutions below

0
On BEST ANSWER

Start with

$$\frac1{1+x}=\sum_{n\ge 0}(-1)^nx^n$$

and differentiate and multiply by $x$ to get

$$\frac{-x}{(1+x)^2}=\sum_{n\ge 0}(-1)^nnx^n\;.$$

Repeat to get

$$\frac{x(x-1)}{(1+x)^3}=\sum_{n\ge 0}(-1)^nn^2x^n\;.$$

This says that $\frac{x(x-1)}{(1+x)^3}$ is the generating function for the sequence $\sigma=\langle(-1)^nn^2:n\in\Bbb N\rangle$. To get the sequence of partial sums of $\sigma$, convolve with the sequence $\langle 1,1,1,\ldots\rangle$, whose generating function is $\frac1{1-x}$; the generating function of this convolution is

$$\frac{x(x-1)}{(1-x)(1+x)^3}=\frac{-x}{(1+x)^3}=\sum_{n\ge 0}\sum_{k=0}^n(-1)^kk^2x^n\;.$$

It’s well known that

$$\frac1{(1-x)^{m+1}}=\sum_{n\ge 0}\binom{m+n}mx^n\;,$$

so

$$\frac{-x}{(1+x)^3}=-\sum_{n\ge 0}\binom{n+2}2(-x)^{n+1}=\sum_{n\ge 0}(-1)^{n+1}\binom{n+2}2x^{n+1}=\sum_{n\ge 0}(-1)^n\binom{n+1}2x^n\;,$$

and it follows that

$$\sum_{k=0}^n(-1)^kk^2=(-1)^n\binom{n+1}2\;.$$