Can You Eat All The Chocolates?

Riddler Classic

From mathematician (and author of Basic Probability: What Every Math Student Should Know) Henk Tijms comes a choice matter of chance and chocolate:

I have 10 chocolates in a bag: Two are milk chocolate, while the other eight are dark chocolate. One at a time, I randomly pull chocolates from the bag and eat them — that is, until I pick a chocolate of the other kind. When I get to the other type of chocolate, I put it back in the bag and start drawing again with the remaining chocolates. I keep going until I have eaten all 10 chocolates.

For example, if I first pull out a dark chocolate, I will eat it. (I’ll always eat the first chocolate I pull out.) If I pull out a second dark chocolate, I will eat that as well. If the third one is milk chocolate, I will not eat it (yet), and instead place it back in the bag. Then I will start again, eating the first chocolate I pull out.

What are the chances that the last chocolate I eat is milk chocolate?

Solution

Define a function $B(d, m)$ which represents a $bag$ containing $d$ dark chocolates and $m$ milk chocolates. Applying the eating algorithm described, the function returns the probability that the last chocolate is milk chocolate.

For $B(d, m)$, $d > 0$ and $m > 0$, two cases are defined.

Case I.

There are only two scenarios where there is only one change in chocolate type.

The probability of eating all dark chocolates then all white chocolates ($d...dm...m$) is :

$$\frac{d}{d+m} \times \frac{d-1}{d+m-1} \times \frac{d-2}{d+m-2} \times ... \times \frac{1}{m+1} = \frac{d!m!}{(d+m)!}$$
Similarly, the probability of eating all white chocolates then all dark chocolates ($m...md...d$) is :

$$\frac{m}{d+m} \times \frac{m-1}{d+m-1} \times \frac{m-2}{d+m-2} \times ... \times \frac{1}{d+1} = \frac{d!m!}{(d+m)!}$$
These probabilities are equal.

Case II.

Each remaining chocolate selection scenario has at least two changes in chocolate type.

For $B(d, m)$, the probability of choosing $i$, $1 < i < d$, dark chocolates before choosing a milk chocolate is :

$$\frac{d}{d+m} \times \frac{d-1}{d+m-1} \times \frac{d-2}{d+m-2} \times ... \times \frac{d - (i-1)}{d+m-(i-1)} \times \frac{m}{d+m-i}$$
$$ = \frac{\frac{d!}{(d-i)!}}{\frac{(d+m)!}{(d+m-i)!}} \times \frac{m}{d+m-i}$$


For $B(d, m)$, the probability of choosing $j$, $1 < j < m$, milk chocolates before choosing a dark chocolate is :

$$\frac{m}{d+m} \times \frac{m-1}{d+m-1} \times \frac{m-2}{d+m-2} \times ... \times \frac{m - (j-1)}{d+m-(j-1)} \times \frac{d}{d+m-j}$$
$$ = \frac{\frac{m!}{(m-j)!}}{\frac{(d+m)!}{(d+m-j)!}} \times \frac{d}{d+m-j}$$

Therefore, $$B(d, m) = \sum_{i = 1}^{d-1}{\frac{\frac{d!}{(d-i)!}}{\frac{(d+m)!}{(d+m-i)!}} \times \frac{m}{d+m-i} \times B(d-i, m)} + \sum_{j = 1}^{m-1}{\frac{\frac{m!}{(m-j)!}}{\frac{(d+m)!}{(d+m-j)!}} \times \frac{d}{d+m-j} \times B(d, m-j)} + \frac{d!m!}{(d+m)!}$$


Notice that this answer would be exactly the same if $B(d, m)$ were defined as returning the probability that the last chocolate is dark chocolate.

Answer

Therefore, for $B(8, 2)$, the answer is : $$\frac{1}{2}$$

Rohan Lewis

2020.10.05