Analyzing the Setup
The problem asks us to distribute 30 identical candies among four children
C1,C2,C3, and
C4. We represent this with the equation:
x1+x2+x3+x4=30
The constraints are given as 4≤x2≤7 and 2≤x3≤6, while x1,x4≥0. To simplify, we handle the lower bounds by pre-allocating the candies.
Let
y2=x2−4 and
y3=x3−2. Substituting these into the original equation:
x1+(y2+4)+(y3+2)+x4=30
This simplifies to the reduced equation:
x1+y2+y3+x4=24
The new constraints are 0≤y2≤3 and 0≤y3≤4, with x1,x4≥0.
The Power of Generating Functions
We represent the distribution possibilities for each child as a polynomial. For children with no upper limit (
C1 and
C4), the generating function is:
f(x)=1+x+x2+⋯=(1−x)−1
For
C2, the constraint
0≤y2≤3 yields:
g(x)=1+x+x2+x3=1−x1−x4
For
C3, the constraint
0≤y3≤4 yields:
h(x)=1+x+x2+x3+x4=1−x1−x5
The total generating function
P(x) is the product of these individual functions:
P(x)=(1−x)−1⋅1−x1−x4⋅1−x1−x5⋅(1−x)−1
Simplifying this expression, we obtain:
P(x)=(1−x4)(1−x5)(1−x)−4
The Final Extraction
We seek the coefficient of
x24 in the expansion of
P(x). First, we expand the numerator:
(1−x4)(1−x5)=1−x4−x5+x9
We multiply this by the series expansion of (1−x)−4. Using the generalized binomial theorem, the coefficient of xr in (1−x)−n is (n−1n+r−1). With n=4, the coefficient is (3r+3).
We now extract the coefficient of
x24 from the product
(1−x4−x5+x9)∑r=0∞(3r+3)xr:
Coeff=(324+3)−(320+3)−(319+3)+(315+3)
This simplifies to:
(327)−(323)−(322)+(318)
Calculating the individual binomial coefficients:
(327)=3×2×127×26×25=2925
(323)=3×2×123×22×21=1771
(322)=3×2×122×21×20=1540
(318)=3×2×118×17×16=816
Performing the final arithmetic:
2925−1771−1540+816=430
The total number of ways to distribute the candies is 430.