<s>[INST] 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$.
 [/INST] 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$$
</s>