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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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|cite|improve this question
Tell us if you have tried something. – leonbloy May 26 '11 at 15:51
up vote 19 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|cite|improve this answer

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 $$


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

share|cite|improve this answer

Your Answer


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.