-1

I have $N$ slots and I start throwing balls into a randomly picked slots. In each turn I throw a single ball into one of the slots. What is the expected number of throws in order to have all the $N$ slots having at least one ball?

$K$ - numbers of throws.

$T$ - the number of slots with balls after $K$ throws.

$P(K|T,N) = P(K-1|T-1,N)\cdot((N-T+1)/N)$ and $\ p(K,1,N) = (1/N)^{k-1}$

But the expressions become very complicated and I got nowhere. Thanks, Gil

Sebastiano
  • 7,649
Tomer
  • 434
  • A quick way is to find the expected number of balls until you put a ball in a previously empty slot, and then add these up. This is in effect the coupon-collector's problem – Henry Sep 25 '19 at 19:24

1 Answers1

2

This is an alternative approach.

Let $P(t,n)$ be the probability that, after $t$ throws, you have not ended up with a ball in all $n$ bins. Then your expected value is:

$$\sum_{t=0}^{\infty} P(t,n)$$

For a fixed value of $t,$ let $A$ be all tosses of $t$ balls, and $A_i$ be all tosses of $t$ balls that never reach slot $i.$ Then inclusion-exclusion gives:

$$\left|A_1\cup A_2\cup\cdots\cup A_n\right|=\sum_{k=1}^n(-1)^{k-1}\binom{n}{k}(n-k)^t$$

This then gives:

$$P(t,n)=\frac{\left|A_1\cup A_2\cup\cdots\cup A_n\right|}{|A|}=\sum_{k=1}^n(-1)^{k-1}\binom{n}{k}\left(1-\frac{k}{n}\right)^t.$$

So your expected value is:

$$\begin{align}\sum_{t=0}^{\infty} P(t,n)&=\sum_{k=1}^{n}(-1)^{k-1}\binom{n}{k}\sum_{t=0}^{\infty}\left(1-\frac{k}n\right)^t\\ &=\sum_{k=1}^{n}(-1)^{k-1}\binom{n}k\frac{1}{1-\left(1-\frac kn\right)}\\ &=\sum_{k=1}^{n}(-1)^{k-1}\binom{n}k\frac{n}{k} \end{align}$$

I don't know if there is a closed form.

When $n=2,$ this gives $2\cdot 2 - 1\cdot 1 = 3.$

When $n=3$ this gives $3\cdot 3 - 3\cdot \frac{3}{2}+1\cdot 1 = \frac{11}{2}.$

When $n=4$ then you get $\frac{25}{3}.$


From a comment above by Henry Sep, if $X_k$ is the number of tosses expected until we hit a new slot, after already reaching $k-1$ different slots, then the value we are seeking, $X=\sum_{k=1}^{n} X_k,$ has an expected value: $$E(X)=\sum_{k=1}^{n} E(X_k).$$ It is relatively easy to see that $E(X_k)=\frac{n}{n-k+1}.$ So this means that:

$$E(X)=n\left(\frac{1}{1}+\frac{1}{2}+\cdots+\frac{1}{n}\right)$$

According to this question, my two answers are equal.

By known approximations for the Harmonic Series, this also gives you the estimation: $$E(X)=n\log n + n\gamma +\frac{1}{2}-\frac{1}{12n}+O\left(\frac{1}{n^3}\right),$$ where $\gamma$ is the Euler–Mascheroni constant.

This estimation is quite good - when $n=2,$ it gives $2.9991,$ when $n=3,$ it gives $5.4997$ and when $n=4$ it gives $8.3332.$

Thomas Andrews
  • 177,126