# Finding the probability of drawing all balls of the same color when there is a "wildcard" ball

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!

• Why wouldn't, say, two red balls and three rainbow balls also be considered monochromatic? That's how wildcards work. They can be tricky to compute with, but you are rescued by the fact that at least one of the five balls will have a definite color and that determines the common color. Consequently, the event whose probability you wish to compute partitions into three events of the type "one or more balls of color X along with some rainbow balls" where X is red, green, or blue. Obviously these events are equiprobable, so all you have to do is compute the chance of one of them and triple it.
– whuber
Mar 3, 2022 at 0:13
• A generalization of this question is answered at stats.stackexchange.com/questions/74468.
– whuber
Mar 3, 2022 at 0:18
• How about 4 rainbow and one of any solid color, 3 rainbow and two same solid color, etc.? Or can only one rainbow ball serve as wild, as you seem to suggest? // I suppose there are several approaches. Does the answer provided give any hint of method? // My first guess would to use hypergeometric probabilities. // For exam study in this course it might be a good idea to try using a method that appeared on a previous test. Mar 3, 2022 at 0:28
• @BruceET I did think about that but neither the wording on the question nor the answer given specify whether to account for this. I can't think of why it wouldn't be the case, and do recall him mentioning hypergeometric in lecture. Also, to your last point, this is the first of two exams and none of the past homeworks asked a question like this unfortunately. Thank you both! Mar 3, 2022 at 0:57
• I wouldn't expect exactly the same hwk problem to be on an exam, but might expect hwk problems to be a clue as to methods and distributions appearing on the next exam. Mar 3, 2022 at 1:10

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}

• Thank you! This is a creative way to look at the question and made it much easier for me to grasp. Mar 3, 2022 at 0:58
• I've just read through some of the other replies. Am I correct in saying that this method accounts for the event that 4 rainbow and then 1 of any other color are chosen? Is that why its probability is slightly higher, since you've effectively accounted for one more way the condition could be satisfied? Mar 3, 2022 at 1:02
• @macncheasy Yes, this would account for that case as well. Mar 3, 2022 at 1:19
• This almost surely is the intended interpretation of the question, because it did not explicitly limit the situation to just one rainbow ball serving as a wild card.
– whuber
Mar 3, 2022 at 1:20

if you want to find the probability P(4 balls of same color and 1 rainbow colored ball) then it would be

$$\frac{4}{16} \times \frac{3}{15} \times \frac{2}{14} \times \frac{1}{13} \times \frac{4}{12} \times \frac{5!}{4} \times 3 = 0.002747...$$

we multiply by 5!/4 if we don't care about the order in which we pick those balls(there would be 5 different permutations, rainbow first then colored ones or rainbow second and so on) and we multiply by 3 because there are three colors (excluding rainbow) you could also just add it three times.

If the rainbow colored balls can be considered of any color then the answer could be different for example if we pick 3 red and 2 rainbow colored balls does that also count as all red? if not then I believe the above answer is correct.

Edit: if for example 2 rainbow balls and 3 red balls also count as all red then the answer provided by @knrumsey is correct one, if sets like this don't count then the answer provided above is correct

• I checked the correctness of this answer by noting that the event in question consists of a sample with all four of one color (there are three ways to do this) and, independently of that, one of the rainbow balls must be selected as the fifth ball (there are four ways to do this). That gives three times four=12 samples in the event, whence the chance is $12/\binom{16}{5} = 1/364=0.002747253\ldots.$
– whuber
Mar 3, 2022 at 0:40
• @macncheasy. Does you Acceptance mean this version agrees with prof's answer? Mar 3, 2022 at 1:19
• @BruceET, I've switched which answer I accepted. The other one is what my professor was after! Mar 3, 2022 at 12:00