# Counting how many ways 30 green balls…

How many ways are there to distribute 30 green balls to 4 persons if Alice and Eve together get no more than 20 and Lucky gets at least 7?

The answer given to me was $2464 = C(26, 3) − 66 − 46-24$ but I got $C(26, 3) - 6$.

Here is what I did:

Using "stars and bars" (or whatever the actual name for it is), I found the total number of possible combinations. Since 7 balls must immediately go to Lucky, there are 23 balls left to distribute. There are 3 'bars', so the total number of possible combinations is $\binom{26}{3}$.

Because this number accounts for the situations where Alice and Eve have $\geq 21$ balls, I must subtract those out. (Here is where I think I messed something up).

When Alice and Eve have 21: This leaves 2 balls left to distribute, so $\binom{3}{2}$

When Alice and Eve have 22: This leaves 1 ball left to distribute, so $\binom{2}{1}$

When Alice and Eve have 23: This leaves no balls left to distribute, so it equals 1.

So $C(26, 3) - 6$.

Where did I go wrong?

• When Alice and Eve have 21 balls between the two, there are 22 possible allocations. What about 22 or 23 balls between Alice and Eve? – Doug M Apr 5 '18 at 1:04

In counting the bad cases, you did not take into account the number of ways the balls could be distributed among Alice and Eve and the remaining balls could be distributed among Lucky and the unnamed person.

Let the number of balls Alice, Eve, Lucky, and the unnamed person receive be denoted by $a$, $e$, $l$, and $u$, respectively. Since you have already given Lucky seven balls, we need to solve the equation $$a + e + l + u = 23$$ subject to the restriction that $a + e \leq 20$.

You correctly found that without this restriction that there are $$\binom{23 + 3}{3} = \binom{26}{3}$$ ways to distribute the $23$ balls that are not reserved for Lucky. From these, we must subtract those distributions in which Alice and Eve receive more than $20$ balls.

There are three cases to consider: Alice and Eve receive $21$, $22$, or $23$ balls.

Alice and Eve receive a total of $21$ balls: This means Lucky and the unnamed person receive a total of $2$ balls (other than the $7$ Lucky has already received). Hence, the number of such distributions is the number of nonnegative integer solutions of the equation $$a + e = 21 \tag{1}$$ multiplied by the number of nonnegative integer solutions of the equation $$l + u = 2 \tag{2}$$ Since equation 1 has $\binom{21 + 1}{1} = 22$ solutions and equation 2 has $\binom{2 + 1}{1} = 3$ solutions, there are $22 \cdot 3 = 66$ such distributions.

Alice and Eve receive a total of $22$ balls: This means Lucky and the unnamed person receive a total of one ball (other than the $7$ Lucky has already received). The number of such distributions is the number of nonnegative integer solutions of the equation $$a + e = 22 \tag{3}$$ multiplied by the number of nonnegative integers solutions of the equation $$l + u = 1 \tag{4}$$ Equation 3 has $\binom{22 + 1}{1} = 23$ solutions and equation 4 has $\binom{1 + 1}{1} = 2$ solutions. Hence, there are $23 \cdot 2 = 46$ such distributions.

Alice and Eve receive a total of $23$ balls: This means Lucky and the unnamed person receive no balls (other than the $7$ Lucky has already received). The number of such distributions is the number of nonnegative integer solutions of the equation $$a + e = 23$$ which is $\binom{23 + 1}{1} = 24$.

Hence, the number of admissible distributions of the balls is $$\binom{26}{3} - \binom{22}{1}\binom{3}{1} - \binom{23}{1}\binom{2}{1} - \binom{24}{1}\binom{1}{1} = 2600 - 66 - 46 - 24 = 2464$$

• I understand where I went wrong. Thanks. – mymemesarespiciest Apr 6 '18 at 1:40

Lucky gets $7$ balls right away. Alice and Eve can split their $j\in[0..20]$ balls in $j+1$ ways, then Lucky and Mike can split the remaining $23-j$ balls in $24-j$ ways. The total number of admissible allocations therefore is $$\sum_{j=0}^{20}(j+1)(24-j)=2464\ .$$