TITLE: Number of integral solutions to a linear inequality
QUESTION [5 upvotes]: I am trying to show the following identity:
Let $k,n \in \mathbb{N}$. Then
$$
\text{card}\{x \in \mathbb{Z}^n: \sum_{i=1}^n |x_i| \leq k\} =\sum_{i=0}^n 2^{n-i} {n \choose i}{k \choose n-i}.
$$
My attempt: Let $A=\{x \in \mathbb{Z}^n: \sum_{i=1}^n |x_i| \leq k\}$. Let $0\leq i \leq n$. Let $x_1,\ldots,x_{n-i}\geq 1$ be such that $x_1+\ldots+x_{n-i} \leq k$. Then it is easy to see that $|A|=\sum_{i=0}^n 2^{n-i} {n \choose i} |\text{no. of positive integral solutions to } x_1+\ldots+x_{n-i} \leq k| $. 
However, I am getting the number of positive integral solutions to $x_1+\ldots+x_{n-i} \leq k$ as not equal to ${k \choose n-i}$. Can anyone help me?

REPLY [3 votes]: Let $t=k-\left(|x_1|+\cdots+|x_n|\right)$, 
so we want to find the number of solutions of $|x_1|+\cdots+|x_n|+t=k$
where the $x_i$ and $t$ are integers and $t\ge0$.
For each $i$ with $0\le i\le n$, we can
1) choose $i$ of the terms $x_1,\cdots,x_n$ to be 0 in $\binom{n}{i}$ ways 
2) choose the signs of the remaining $n-i$ terms in $2^{n-i}$ ways
3) If we let $y_1,\cdots,y_{n-i}$ be the terms of the form $|x_j|$ chosen to be nonzero, 
$\hspace{.2 in}$we must find the number of solutions of $y_1+\cdots+y_{n-i}+t=k$ with $y_j>0$ for each $j$ and $t\ge0$.
$\hspace{.2 in}$Letting  $y_{n-i+1}=t+1$ gives 
$\hspace{.2 in}$$y_1+\cdots+y_{n-i+1}=k+1\;$ with $y_j>0$ for all $j$; so there are $\binom{k}{n-i}$ solutions.
This gives a total of $\displaystyle\sum_{i=0}^n 2^{n-i}\binom{n}{i}\binom{k}{n-i}$ solutions.