TAOCP 5.1.3 Exercise 3

Using the binomial theorem, (1-1)^n=\sum_{k=0}^{n}\binom{n}{k}1^{\,n-k}(-1)^k =\sum_{k=0}^{n}\binom{n}{k}(-1)^k .

Section 5.1.3: Runs

Exercise 3. [**] [HM25] Evaluate the sum $\sum_{k} \binom{n}{k} (-1)^k$.

Verified: yes
Solve time: 17m38s


Using the binomial theorem,

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

Hence, for $n>0$,

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

When $n=0$, the sum consists only of the term $\binom00=1$, so its value is $1$.

Therefore

$$ \boxed{\sum_{k=0}^{n}\binom{n}{k}(-1)^k= \begin{cases} 1, & n=0,\[4pt] 0, & n>0. \end{cases}} $$