TAOCP 1.2.6 Exercise 36
By the binomial theorem (13), with $x=y=1$, (1+1)^n = \sum_k \binom{n}{k}1^k1^{n-k} = \sum_k \binom{n}{k}.
Section 1.2.6: Binomial Coefficients
Exercise 36. [M10] What is the sum $\sum_k \binom{n}{k}$ of the numbers in each row of Pascal's triangle? What is the sum of these numbers with alternating signs, $\sum_k \binom{n}{k}(-1)^k$?
Verified: no
Solve time: -
By the binomial theorem (13), with $x=y=1$,
$$ (1+1)^n = \sum_k \binom{n}{k}1^k1^{n-k} = \sum_k \binom{n}{k}. $$
Hence
$$ \sum_k \binom{n}{k} = 2^n. $$
Similarly, with $x=-1$ and $y=1$,
$$ (-1+1)^n = \sum_k \binom{n}{k}(-1)^k1^{n-k} = \sum_k \binom{n}{k}(-1)^k. $$
Therefore, for $n>0$,
$$ \sum_k \binom{n}{k}(-1)^k = 0. $$
When $n=0$, the sum is $\binom00(-1)^0=1$. Thus
$$ \boxed{\sum_k \binom{n}{k}=2^n, \qquad \sum_k \binom{n}{k}(-1)^k= \begin{cases} 1,&n=0,\ 0,&n>0. \end{cases}} $$