Distributing identical balls in boxes with minimum and maximum per box I'm trying to solve the following problem:
In how many ways can you distribute 100 identical balls among 3 different boxes (box A, box B and box C), such that each box will get at least 20 and at most 50 balls?
I'm trying to solve it using a generating function. 
Please help me check the correctness. And please let me know if there's an easier way to solve this problem.
So I'm trying to find the integer solution to:
$c_1+c_2+c_3=100$ with c1, c2, c3 varying from 20 to 50 balls.
The associated polynomial associated with the given equation is:
$(x^{20}+x^{21}+x^{22}+...+x^{50})^3$
I think the solution to the problem is the coefficient of $x^{100}$ in the equation $(x^{20}+x^{21}+x^{22}+...+x^{50})^3$, so I'm trying to find the coefficient of $x^{100}$.
$(x^{20}+x^{21}+x^{22}+...+x^{50})^3={(x^{20})}^3 {(1+x+x^2+...+x^{30})}^{3}$
$= {(x^{60})} {(1+x+x^2+...+x^{30})}^{3}$
Using the geometric series, this becomes:
${(x^{60})} { ( \frac{1-x^{31} }{1-x} ) }^{3}$
$= {(x^{60})} { ( 1 -3x^{31}+3x^{62}-x^{93} ) }{(1-x)}^{-3}$
Next I'm trying to find ways the coefficients of $x^{100}$ can be obtained:
$x^{60}x^{0}x^{40}$
$x^{60}x^{31}x^{9}$
Then I'm trying to find the value of the coefficient of $x^{100}$ by summing the values of these coefficients:
$1*1 * {3+40-1 \choose 40} + 1*-3*{3+9-1 \choose 9}$
$=  {42 \choose 40} -3 *{11 \choose 9}$ 
$= 861 - 3 * 55 = 696$
 A: $x+y+z = 100$      where x,y,z belongs to [20,50]
Let $x= 20+a, y= 20 +b, z= 20+c$;
$a+b+c = 40$
number of non negative solution of above equation is given by$\binom{42}{2}$
We have to subtract cases where a,b,c are greater than 30
first calculate for a
Let $a = 31 +a_1$ then
$a_1+b+c = 9$
Number of non negative solutions for above equation is $\binom{11}{2}$
Similar cases are for b and c
Total cases = 3$\binom{11}{2}$
Final answer = $\binom{42}{2}$ - 3$\binom{11}{2}$  
A: Another approach: 
Fill each box with 20 balls each. We have 40 left. 
Now we need to distribute 40 identical balls into 3 distinct boxes (this is weak composition meaning we can dump all 40 into just one box). # ways = $\binom{40 + 3 -1}{3 - 1}$
Now we need to subtract all the cases where one of the boxes has $51$ or more. 
Now fill one of the boxes with $51$ balls. We can choose this box in $3$ ways. Distribute the $9$ into three boxes (this is weak composition meaning we can dump all 9 into just one box).
We get $3 * \binom{9 + 3 - 1}{3 - 1}$. 
So we get $\binom{42}{2} - 3 \binom{11}{2} = 696$
