1

How would I calculate the number of times I need to pick one of N unique balls at random out of an urn with replacement until I'm 95% confident that I've seen every ball?

For example, let's say there are 16 balls in the urn, labeled uniquely from each other with the letters A thru P. I pick one ball out at random, write down the letter I got, then put the ball back. Repeat. My goal is to write down all 16 different letters (not being allowed to write down a letter until I've seen it on a ball I picked from the urn). Before starting, how many times should I expect to pull a ball to be 95% confident that I would have seen (and written down) each of the 16 letters at least once?

Sass
  • 21
  • 1

2 Answers2

1

The number of surjections from $[n]$ to $[N]$ is given by $N!{n \brace N} = \sum_{j=0}^{N-1}(-1)^j \binom{N}{N-j}(N-j)^n $ and hence the probability of having seen all after we've picked $n$ times is

$$ p(n) = \frac{1}{N^n}\sum_{j=0}^{N-1}(-1)^j \binom{N}{N-j}(N-j)^n $$

Then we solve the least $n$ such that $p(n)>0.95$. For $N=16$ we get $n=90$.

ploosu2
  • 12,367
0

A useful approximation is that if you are making enough draws to have a $95\%$ chance of seeing them all, you will certainly have seen at least $N-1$ of them. This is not true, you might have seen only $N-2$ of them, but if you follow the ideas here you will see the chance is very low. Having said that, if you make $k$ draws the chance you have never seen one is the chance you have chosen all the $k$ draws from $N-1$ of the balls. If you choose a specific ball to miss, the chance is $\frac {k(N-1)^k}{N^k}$ so the chance you miss any one is $N\frac {k(N-1)^k}{N^k}$ (Here we use the assumption you don't miss more than one as you would double count draws that miss two and so on.) Now you can numerically choose $k$ to get this below $0.05$

Alpha say for $N=16$ you need $169$ draws.

Ross Millikan
  • 383,099