Suppose I have $10$ pens each with caps of the matching color:
- 4 red
- 3 blue
- 2 black
- 1 green
If I mix the caps and pair them with the pens randomly, what is the expected number of resulting pens whose caps have the matching color?
Suppose I have $10$ pens each with caps of the matching color:
If I mix the caps and pair them with the pens randomly, what is the expected number of resulting pens whose caps have the matching color?
On
The original question was
What is the probability of matching pens and caps of the same color?
before David Stork edited the question, changing it to asking for the expected value.
The answer to the original question is $$ \frac{4!\cdot 3!\cdot 2!\cdot 1!}{10!} $$ This is because there are $10!$ equally likely assignments of pens to caps, but in a valid arrangement, there are $4!$ ways to assign red caps to red pens, $3!$ ways to assign blue caps to blue pens, etc.
Consider a random variable for each pen. In particular $ X_i = 1$ if the color matches and $ X_i = 0$ otherwise. We want to evaluate $$ \mathbb{E}[ X_1 + \ldots + X_{10}] = \sum\limits_{i=1}^{10} \mathbb{E}[X_i] = \sum\limits_{i=1}^{10} \mathbb{P}(X_i = 1)$$ Since:
the result is $\sum\limits_{j=1}^{4} j \cdot \frac{j}{10} = 3$