How many different integer solutions are there to the equation $x_1 + x_2 + x_3 + x_4 = 21$ with restrictions So i was Given this question. How many different integer solutions are there to 
the equation 
$x_1 + x_2 + x_3 + x_4 = 21$ 
$0 \leq x_i \leq 9$?
I just assumed it would be 
${21+4-4-1 \choose 4-1} = {20 \choose 3}$
I'm confused by the $0 \leq x_i \leq 9$.
 A: This can be expressed as the coefficient of $x^{21}$ in the binomial expansion of
$$(1+x+x^2+\cdots+x^9)^4$$
This is because the coefficient will represent the number of ways $4$ powers of $x$, ranging from $0$ to $9$, can add up to $21$. Thus you get the number of solutions to the given equation.
Each variable has been replaced with a series in $x$ whose terms contain in the powers all the allowed values of $x$. All these series' have been multiplied with each other. The logic behind this is that when two terms are multiplied, their powers add up. So, the coefficient of the sum you want gives the number of ways in which the power was achieved, which is the same as the number of ways the individual powers added up to the sum.
A: Let S be the set of all solutions in nonnegative integers, and 
let $E_i$ be the set of solutions with $x_i\ge10$ for $1\le i\le4$.
Using Inclusion-Exclusion, 
$\displaystyle|\overline{E_1}\cap\cdots\cap\overline{E_4}|=|S|-\sum_{i}|E_i|+\sum_{i<j}|E_i\cap E_j|-\sum_{i<j<k}|E_i\cap E_j\cap E_k|+|E_1\cap\cdots\cap E_4|$
$\hspace{1.0 in}\displaystyle=\binom{24}{3}-\binom{4}{1}\binom{14}{3}+\binom{4}{2}\binom{4}{3}=592$
A: All solutions
Split $(x_{1}+x_{2})+(x_{3}+x_{4})=21$. There are 16 different pairs $(x_{1}+x_{2},x_{3}+x_{4})$ (if you count $3+18$ different from $18+3$) simply $(3,18),(4,17),(5,16),...,(10,11),...,(18,3)$
For $(10,11)$ and $(11,10)$ you have $9$ combinations for $10$ and $8$ combinations for $11$. That makes $2\cdot 9 \cdot 8=144$ combinations.
For $(9,12)$ and $(12,9)$ you have $10$ combinations for $9$ and $7$ combinations for $12$.
For $(8,13)$ and $(13,8)$ you have $9$ combinations for $8$ and $6$ combinations for $13$.
...
The pattern emerges $2m(m-3)$. So the total number of solutions is then
$$144+ \sum\limits_{m=4}^{10} 2m(m-3) = 592$$
