The number of ways to distribute 30 identical candies among four children C1,C2,C3,C4 so that C2 receives at least 4 and at most 7 candies, C3 receives at least 2 and at most 6 candies, is equal to:
Solutions · 1
Official solution
Using generating functions: coefficient of x30 in (x4+⋯+x7)(x2+⋯+x6)(1+x+x2+⋯)2
\[= [x^{24}]\ (1-x^4)(1-x^5)(1-x)^{-4} \cdot (1-x^{31})^2\text{ terms negligible}\]
\[= [x^{24}]\ (1-x^4-x^5+x^9)(1-x)^{-4}\]
\[= \binom{27}{24}-\binom{23}{20}-\binom{22}{19}+\binom{18}{15} = 2925-1771-1540+816 = 430\]