4

I have a container of 100 yellow items.

I choose 2 at random and paint each of them blue.

I return the items to the container.

If I repeat this process, on average how many cycles will I make before all 100 items are painted?

It is obviously 50 (100/2) if there is no replacement. But in this case, the items are returned to the container, so the same item could be chosen often.

What if we choose 3?

jopke
  • 143

3 Answers3

2

You could calculate the exact figure for the expected number using recursion and find the mean is about $258.32$ with a standard deviation of about $62.59$.

Alternatively, if you took the balls one at a time, this would be the Coupon Collector's Problem, with an expected value of $100H_{100} \approx 518.74$: you then need to halve this as you are taking items two at a time, so giving about $259.37$. The actual answer differs from this for two reasons: your pair of items are distinct, reducing the number needed, but this is slightly offset by the possibility that the first item of the final pair is the last that needs to be painted.

Henry
  • 157,058
  • If we choose 3 balls instead of 2, is it a reasonable approximation to divide by 3? – jopke Jan 08 '14 at 08:31
  • Yes, but the more balls you choose the bigger the "distinct" effect is. In the extreme case of choosing $100$ balls at a time, you obviously only have to do it once. With $99$ balls at a time, the expected number is about $2.01$ cycles. – Henry Jan 08 '14 at 16:05
1

If you choose 1 item each time, then the expected time until the items are all painted is $n \ln(n)$; This is the coupon collector problem.

http://en.wikipedia.org/wiki/Coupon_collector%27s_problem

If you take 2 at random each time it should take about half that time, because you speed up the process by a factor of two, so about $\frac{n \ln(n)}{2} $.

Zur Luria
  • 1,514
  • $n, ln(n) + n \gamma + \frac12$ would be a better approximation to $nH_n$ – Henry Jan 08 '14 at 08:26
  • One stupid answer is it depend on container and Ball size also. for narrow container repeating probality in more and vice-versa. – u_pendra Jan 08 '14 at 10:26
  • @u_pendra haha, yes, in a practical manner I suppose it does. Of course I was thinking in the more abstract sense. – jopke Jan 08 '14 at 16:11
0

By inclusion-exclusion, the probability that all items have been painted after $m$ batches of $b$ items each have been painted is

$$ \sum_{k=0}^{100}(-1)^k\binom{100}k\left(\frac{\binom kb}{\binom{100}b}\right)^m\;. $$

Thus the expected number of cycles required is

\begin{align} \sum_{m=0}^\infty\left(1-\sum_{k=0}^{100}(-1)^k\binom{100}k\left(\frac{\binom kb}{\binom{100}b}\right)^m\right) &= \sum_{m=0}^\infty\sum_{k=0}^{99}(-1)^{k+1}\binom{100}k\left(\frac{\binom kb}{\binom{100}b}\right)^m \\ &= \sum_{k=0}^{99}(-1)^{k+1}\binom{100}k\frac1{1-\frac{\binom kb}{\binom{100}b}}\;. \end{align}

For $b=2$, this is

$$ \sum_{k=0}^{99}(-1)^{k+1}\binom{100}k\frac1{1-\frac{k(k-1)}{9900}}=\\ \frac{4422524992331899897840584824409871573709079567200239855874554436668439024460525976895}{17120632903554452293765076229371169353453854260451613330736867261419928839179604592}\\\approx258.32\;, $$

in agreement with Henry's answer. For $b=3$, it is

$$ \sum_{k=0}^{99}(-1)^{k+1}\binom{100}k\frac1{1-\frac{k(k-1)(k-2)}{970200}}\approx171.51\;, $$

joriki
  • 238,052