Calculate sum with binomials using generating functions

binomial-coefficientsgenerating-functionssummation

How would you calculate this sum using generating functions? I have tried a lot of things but cannot seem to get the right solution which should even contain $\sqrt{π}$

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

Best Answer

A slight variation of the theme. It is convenient to use the coefficient of operator $[x^n]$ to denote the coefficient of $x^n$. This way we can write for instance \begin{align*} [x^k](1+x)^n=\binom{n}{k}\tag{1} \end{align*}

We obtain \begin{align*} \color{blue}{\sum_{k=0}^n\binom{n}{k}^2(-1)^k} &=\sum_{k=0}^n\binom{n}{k}(-1)^k\binom{n}{n-k}\tag{2}\\ &=\sum_{k=0}^n\binom{n}{k}(-1)^k[x^{n-k}](1+x)^n\tag{3}\\ &=[x^n](1+x)^n\sum_{k=0}^n\binom{n}{k}(-x)^k\tag{4}\\ &=[x^n](1+x)^n(1-x)^n\tag{5}\\ &=[x^n](1-x^2)^n\\ &\,\,\color{blue}{=(-1)^{n/2}\binom{n}{\frac{n}{2}}[n\equiv0 \operatorname{mod} 2]}\tag{6} \end{align*}

Comment:

  • In (2) we use the binomial identity $\binom{p}{q}=\binom{p}{p-q}$.

  • In (3) we apply the coefficient of operator according to (1).

  • In (4) we apply the rule $[x^{p-q}]A(x)=[x^p]x^qA(x)$.

  • In (5) we apply the binomial theorem.

  • In (6) we select the coefficient of $[x^n]$ using Iverson brackets.