Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Having a set of size M, I'm drawing M items with replacement. What is expected number of unique items that got picked?

Thanks, Jarek

share|improve this question
1  
Tell us if you have tried something. –  leonbloy May 26 '11 at 15:51
add comment

2 Answers

up vote 11 down vote accepted

Let $Y$ be the number of unique items that get picked. Let $X_i$ be $1$ if item $i$ gets picked and $0$ if not. We have $E[X_i] = 1 P(X_i = 1) + 0 P(X_i = 0) = P(X_i = 1) = 1 - P(X_i = 0)$. Since $P(X_i = 0)$ is the probability that item $i$ is not picked, this is the probability that $i$ is not picked with any of the first, second, third, etc., choices. Thus $P(X_i = 0) = \left(\frac{M-1}{M}\right)^M$.

Therefore, $$\begin{align}E[Y] &= E\left[\sum_{i=1}^M X_i\right] = \sum_{i=1}^M E[X_i] = \sum_{i=1}^M P(X_i = 1) = \sum_{i=1}^M \left(1 - \left(\frac{M-1}{M}\right)^M\right) \\ &= M - \frac{(M-1)^M}{M^{M-1}}.\end{align}$$

In general, using indicator functions to calculated expected values can be very helpful. For more examples, see the answers to Find the expectation or Another balls and bins question or Expected number of neighbors.

share|improve this answer
add comment

Thanks for great answer Mike!

I just would like to add that if someone is interested in percent of picked items, then $$ \frac{M - \frac{(M-1)^M}{M^{M-1}}}{M} = \frac{M - M\left(\frac{M-1}{M} \right)^M}{M} = 1 - \left(1 - \frac{1}{M} \right )^M $$

For large M it is approximately $$ 1 - \frac{1}{e} \simeq 0.632120559 \dots $$

because

$$ \lim_{M\to\infty}\left(1 - \frac{1}{M} \right )^M = \frac{1}{e} $$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.