<s>[INST] No. of integral solutions of $x_1+x_2+x_3+x_4=20.$ I've to solve a no. of questions of this type but don't get how to do it:  

Determine the no. of integral solutions of $x_1+x_2+x_3+x_4=20.$ given the constraint that
           $$1\leq x_1\leq 6,0\leq x_2\leq7,4\leq x_3\leq 8 ,2\leq x_4\leq 6.$$   

I made the following expansions :
              $(x+x^2+x^3+x^4+x^5+x^6)(1+x+x^2+\cdots +x^7)(x^4+\cdots +x^8)(x^2+\cdots+ x^6)$
now we'll find the coeffiecient of $x^{20}$ in the above expression .
but I can't understand how...
 [/INST] One method that leads to a general solution of these types of problems is to sum each geometric series and then deal with the resulting product. In this case, your generating function would be
$$\frac{x(1-x^6)}{1-x}\cdot
\frac{(1-x^8)}{1-x}\cdot
\frac{x^4(1-x^5)}{1-x}\cdot
\frac{x^2(1-x^5)}{1-x}.$$
Then, the coefficient of $x^{20}$ of this would coincide with the coefficient of $x^{13}$ in $\frac{(1-x^6)(1-x^8)(1-x^5)^2}{(1-x)^4}$. I think you're stuck with expanding the numerator, but the denominator is just $\frac1{(1-x)^4}=\sum_n\binom{n+3}3x^n$. This leads to $$(1-2x^5-x^6-x^8+x^{10}+2x^{11}+2x^{13}+\cdots)\cdot\sum_n\binom{n+3}3x^n.$$ So, the number of solutions to your original equation would be
$$\binom{16}3-2\binom{11}3-\binom{10}3-\binom83+\binom63+2\binom53+2\binom33=96.$$
</s>