Suppose I have a bag of $25$ marbles: $5$ red, $5$ blue, $5$ green, and $10$ colorless. I'm drawing $9$ marbles from the bag, without replacement. What's the probability that those $9$ marbles contains at least one of each color (where colorless, in this case, doesn't count as a color)?

I'm trying to write a generalized formula for this so that I can plot it as variables change. In the generalized case, we can assume that:

  1. Each color present includes the same number of marbles as each other present color includes (eg, if there are red, blue, green, and purple marbles, there are n red, n blue, n green, and n purple)
  2. The number of colorless marbles can vary (but in the cases I'm dealing with, the majority of marbles will generally be colorless)
  3. The number of marbles pulled from the bag can vary

The (incorrect) formula I keep coming up with is:

$$\frac{(n^m) \cdot (S-m)! \cdot d! }{m! \cdot (d-m)! \cdot S!}$$

or in other words

$$\frac{n^m}{m!} \cdot \binom{S-m}{d-m} \cdot \binom{S}{d}$$

where $n$ is the number of marbles of each color ($n=5$ in my example), $m$ is the number of colors ($3$ in my example), $d$ is the number of marbles being drawn ($9$ in my example), and $S$ is the total number of marbles ($25$ in my example).

  • $\begingroup$ Welcome to MathSE. This tutorial explains how to typeset mathematics on this site. $\endgroup$ Commented May 27, 2018 at 17:20

1 Answer 1


Approach via inclusion-exclusion in order to find the probability of the complementary event and subtract that away from $1$.

Let $A$ represent the event that our selection contains no red marbles. Let $B$ represent the event that our selection contains no blue marbles. Let $C$ represent the event that our selection contains no green marbles. Let $S$ represent the sample space.

The original probability we are interested in calculating is $Pr(S\setminus(A\cup B\cup C))$, that is the probability that it is not the case that we are missing at least one of the colors in our selection, i.e. the probability that we have at least one of every color present in our selection.

Via rule of complements: $$Pr(S\setminus(A\cup B\cup C))=Pr(S)-Pr(A\cup B\cup C)=1-Pr(A\cup B\cup C)$$

Via inclusion exclusion this continues to expand as:

$$1-Pr(A\cup B\cup C)=1-Pr(A)-Pr(B)-Pr(C)+Pr(A\cap B)+Pr(A\cap C)+Pr(B\cap C)-Pr(A\cap B\cap C)$$

Now... each of the terms in the above expansion should be relatively trivial to calculate. For example, $Pr(A)$ is the probability that in our selection, no reds are taken. That is, among the nine marbles we selected out of the $25$ available, none of them were red. That occurs with probability:


Similarly we can calculate other probabilities:

$Pr(A)=Pr(B)=Pr(C)=\frac{\binom{20}{9}}{\binom{25}{9}}$, $Pr(A\cap B)=Pr(A\cap C)=Pr(B\cap C)=\frac{\binom{15}{9}}{\binom{25}{9}}$, $Pr(A\cap B\cap C)=\frac{\binom{10}{9}}{\binom{25}{9}}$

Plugging all of these in to the above expansion will yield a final answer.

This can of course be generalized as desired to any number of balls of whatever colors or noncolors etc...

For example, if there are $s$ marbles alltogether, $a$ of which are red and $b$ of which are blue, and you select $d$ marbles at a time, the probability that among the $d$ marbles you select none of them are red or blue would be $\dfrac{\binom{s-a-b}{d}}{\binom{s}{d}}$. This and similarly calculated generalizations can then be combined as above with the expansion via inclusion-exclusion.

  • $\begingroup$ In order to use it for plotting, I tried rearranging your answer into a formula as follows: $$Pr(S : A \cup B \cup C) = 1+\sum_{i=1}^m (-1)^i * \binom{m}{i} * \frac{\binom{S-n*i}{d}}{\binom{S}{d}}$$ (where the vars are defined as in my original post). That said, I'm not well-versed on inclusion-exclusion probability. Does this formula line up with your answer? $\endgroup$
    – mwarrior
    Commented May 27, 2018 at 18:16
  • $\begingroup$ If you make the assumption that every color has the same number each and once you change the left hand side to a more generalized form where it has $m$ events instead of just three, yes that is fine $\endgroup$
    – JMoravitz
    Commented May 27, 2018 at 18:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .