I am working on a practice exam question for my Probability Theory class and am confused about a solution my professor gives us.

The problem is as follows:

There is a box with 16 balls in it, 4 red, 4 green, 4 blue, and 4 rainbow. If we pick at random 5 balls without replacement, what is the probability that all 5 balls are of the same color, if we allow the rainbow balls to take any color?

I know that the sample space would be $16 \choose 5$. I also know that the probability of this would generally be $P(\text{4 red balls, 1 rainbow}) + P(\text{4 green balls, 1 rainbow}) + P(\text{4 blue balls, 1 rainbow})$. However, I'm not quite sure how to actually count all of these.

My initial thinking is to use the conditional approach and do something along the lines of:

$\frac{4}{16} * \frac{3}{15} * \frac{2}{14} * \frac{1}{13} * \frac{4}{12}$

Essentially, the probability of picking 1 ball of a specific color multiplied by the probabilities of picking another ball of that same color, and then finally multiplied by the probability of picking 1 of the rainbow balls. This doesn't seem right to me, however as I feel like I need to account for the fact that you could pick a rainbow ball at any point in there.

Could someone guide me on this? Thank you!

## Best Answer

As @whuber points out in the comments, we can have $5$ balls of the same color with more than just 1 rainbow ball in the sample. This answer is based on the assumption that these sets also count.

Try finding the probability of getting five "red" balls. There are $8$ red balls (counting the rainbow) and $8$ non-red balls. This reduces to the usual univariate hypergeometric distribution, and has probability $$P(\text{all reds}) = \frac{\binom{8}{5}\binom{8}{0}}{\binom{16}{5}}.$$

To get a final answer, we can simply multiply by 3 since \begin{align} P(\text{all same color}) &= P(\text{all reds} \cup \text{all blues} \cup \text{all greens}) \\[1.5ex] &= P(\text{all reds}) + P(\text{all blues}) + P(\text{all greens}) \\[1.5ex] &= 3P(\text{all reds}) \\[1.5ex] &\approx 0.03846 \end{align}

Note: We might also need to include $\{\text{all rainbows}\}$ as an event in some versions of this problem, but this event has probability zero so I just ignored it here for simplicity.## A General Solution

I thought it might be interesting to include a general solution for this problem. Let's assume there are $M$ colors, with $n_1, n_2, \ldots n_M$ balls of each color and $n_0$ rainbow colored balls. We will sample $k$ balls without replacement. We will also assume that drawing $k$ rainbow balls counts as all the same color.

\begin{equation} P(\text{all color $i$}) = \begin{cases} \frac{\binom{n_0 + n_i}{k}}{\binom{n_0 + n_1 + n_2 + \ldots n_M}{k}}, & n_0 + n_i \geq k \\ 0, & \text{otherwise} \end{cases} \end{equation}

The "all rainbow" case can be molded into this equation by treating it as the $(M+1)^{th}$ color with $n_{M+1} = 0$.

Finally, lets define $N= \sum_{i=1}^M n_i$ (for brevity) and take the convention that $\binom{a}{b} = 0$ whenever $a < b$.

\begin{align} P(\text{all same color}) &= P\left(\bigcup_{i=1}^{M+1}\text{all color i}\right) \\[1.5ex] &= \sum_{i=1}^{M+1}P(\text{all color $i$}) \\[1.5ex] &= \sum_{i=1}^{M+1}\frac{\binom{n_0 + n_i}{k}}{\binom{N}{k}} \end{align}