<s>[INST] Calculate $\sum\limits_{k=0}^{20}(-1)^k\binom{k+2}2$ without calculating each term separately Is it possible to calculate $\sum_{k=0}^{20}(-1)^k\binom{k+2}2$ without calculating each term separately?
The original question was find the number of solutions to $2x+y+z=20$ which I calculated to be the coefficient of $x^{20}$ in $(1+x^2+x^4\dots)(1+x+x^2\dots)^2$ which simplified to the term above.
I know $\sum_{k=0}^{20}\binom{k+2}{2}=\binom{23}3$ but the $(-1)^k$ is ruining things.
 [/INST] There is! You can use the identity $\binom{k+2}2 = \sum_{i=0}^{k+1}i$.
Our sum is $$\sum_{k=0}^n (-1)^k \binom{k+2}{2} = \sum_{k=0}^n (-1)^k \sum_{i=0}^{k+1}i$$
For odd $n$: Letting $m=\frac {n-1}2$ and pairing up the terms we get
$$\begin{align}\sum_{k=0}^n (-1)^k \sum_{i=0}^{k+1}i &= \sum_{j=0}^m [(-1)^{2j}\sum_{i=0}^{2j+1}i + (-1)^{2j+1}\sum_{i=0}^{2j+2}i] \\&=\sum_{j=0}^m [\sum_{i=0}^{2j+1}i -\sum_{i=0}^{2j+2}i] \\&= \sum_{j=0}^m-(2j+2) \\&= -2\sum_{j=0}^m(j+1) \\&= -2\sum_{j=1}^{m+1}j\\ &= -2[\binom{m+2}2-0] \\&= -(m+2)(m+1) \\&=-\frac{(n+3)(n+1)}4
\end{align}$$
For even $n$: $$\begin{align} \sum_{k=0}^n (-1)^k \sum_{i=0}^{k+1}i &= \sum_{k=0}^{n-1} (-1)^k \sum_{i=0}^{k+1}i + \sum_{i=0}^{n+1}i
\\&= -\frac{((n-1)+3)((n-1)+1)}4 + \binom{n+2}2 \\
&=-\frac{n^2+2n}4 + \frac{n^2 + 3n + 2}{2}
\\&= \frac{ - n^2 - 2n + 2n^2 + 6n + 4}4 \\&=(\frac{n+2}2)^2
\end{align}$$
</s>