<s>[INST] Evaluate a sum with binomial coefficients: $\sum_{k=0}^{n} (-1)^k k \binom{n}{k}^2$ $$\text{Find} \ \ \sum_{k=0}^{n} (-1)^k k \binom{n}{k}^2$$
I expanded the binomial coefficients within the sum and got $$\binom{n}{0}^2 + \binom{n}{1}^2 + \binom{n}{2}^2 + \dots + \binom{n}{n}^2$$
What does this equal to? I think this can help me evaluate the original sum.
 [/INST] First, use $k\binom{n\vphantom{1}}{k}=n\binom{n-1}{k-1}=n\binom{n-1}{n-k}$
$$
\sum_{k=0}^n(-1)^kk\binom{n}{k}^2
=n\sum_{k=0}^n(-1)^k\binom{n}{k}\binom{n-1}{n-k}\tag{1}
$$
Next compute a generating function. The sum we want is the coefficient of $x^n$
$$
\begin{align}
n\sum_{m,k}(-1)^k\binom{n}{k}\binom{n-1}{m-k}x^m
&=n\sum_{m,k}(-1)^k\binom{n}{k}\binom{n-1}{m-k}x^{m-k}x^k\\
&=n\sum_k(-1)^k\binom{n}{k}(1+x)^{n-1}x^k\\
&=n(1+x)^{n-1}(1-x)^n\\
&=n\left(1-x^2\right)^{n-1}(1-x)\tag{2}
\end{align}
$$
The sum we want is the coefficient of $x^n$ in $(2)$:
$$
\begin{align}
\sum_{k=0}^n(-1)^kk\binom{n}{k}^2
&=\left\{\begin{array}{}
n\binom{n-1}{n/2}(-1)^{n/2}&\quad\text{if $n$ is even}\\[6pt]
n\binom{n-1}{(n-1)/2}(-1)^{(n+1)/2}&\quad\text{if $n$ is odd}
\end{array}\right.\\[6pt]
&=n\binom{n-1}{\lfloor n/2\rfloor}(-1)^{\lceil n/2\rceil}\tag{3}
\end{align}
$$
</s>