1

There are $n$ different color balls in a box. Take two balls in turns, and change color of the second ball to the first. (This is one operation). Let $k$ be the (random) number of operations needed to change all $n$ balls to same color.

How to calculate the expected value of $k$?

Sasha
  • 70,631
yibotg
  • 951
  • 6
  • 14
  • Are all the balls different initially, or are there only two colors? Also, I take it the two balls are chosen at random with replacement? – Ian Aug 27 '14 at 14:44
  • Possible duplicate of http://math.stackexchange.com/q/910601/75923. But that question has not been answered uptil now. – drhab Aug 27 '14 at 14:44
  • I'm not sure that this kind of problem have an answer, what on the other hand can be asked is: what is the expected value of $k$ where there is $50$%(or any number which is not 100) that all the balls will be of the same value – d_e Aug 27 '14 at 15:27
  • @Ian all the balls different initially. – yibotg Aug 27 '14 at 16:57
  • @d_e but the answer is (n-1)^2 for n=2 to 9. – yibotg Aug 27 '14 at 16:59
  • @d_e At worst the expected value is $\infty$; the time to hit all one color is a nonnegative random variable, so it has an expectation, even if it's infinite. Note that it is not completely ludicrous that it might be infinite, because for $n>2$ there are arbitrarily long trajectories, for example $(1,1,1) \to (0,2,1) \to (0,1,2) \to (0,2,1) \to \dots$. But these trajectories have exponentially small probability. – Ian Aug 27 '14 at 17:21
  • 1
    @tan9p Could you please cite the origin of the problem? Thank you. Also please see my answer to the related question 910601. – Sasha Aug 28 '14 at 14:41
  • @Sasha,Sorry, I don't know the origin,A guy asked me,I solved it by Mathematica,and found the answer is subtle. – yibotg Aug 29 '14 at 12:20

1 Answers1

2

Here's a rough estimate which may give an idea of how to get a proper answer.

Let $X_i(t)$ be the number of colors such that there are $i$ balls of that color. Let the level at time $t$, denoted by $L(t)$, be the largest $i$ such that $X_i(t)>0$. Suppose $L(t)=i$. We want the probability that $L(t+1)=i+1$.

At time $t$, there are $i X_i(t)$ balls of such colors. So $L(t+1)=i+1$ if and only if the first draw is of one of these colors and the second is of any different color. This will happen with probability $\frac{i X_i(t) (n-i)}{n(n-1)}$. Now notice that for $i>1$, when we reach level $i$, $X_i=1$. So the probability that $L(t+1)=i+1$ given that $X_i(t)=1$ is $i$ is $\frac{i (n-i)}{n(n-1)}$. If we neglect the possibility that $X_i$ decreases or increases before the level reaches $i+1$, we get a rough estimate of the expected time:

$$E \tau \approx 1 + \sum_{i=2}^{n-1} \frac{n(n-1)}{i (n-i)}$$

This is exact for $n=2$ and $n=3$, as is fairly straightforward to check. It is not exact for $n=4$; the above suggests the value $8$, but the actual value is $9$, so there is a significant effect of the level dropping back to $2$ after reaching $3$. Presumably it is not exact for higher $n$ either.

Ian
  • 101,645
  • But from 2 to 9,the answer are all (n-1)^2.is it a coincidence¶ – yibotg Aug 28 '14 at 05:56
  • @tan9p I don't know. My only guess for how to show that would be to choose stopping times $\tau_1 \leq \tau_2 \leq \dots \leq \tau_n$ where $\tau_n$ is the stopping time you want and then prove $E(\tau_{i+1}-\tau_i)=2i-1$. I thought my "level" idea would achieve this, but the issue of going back down in level got in the way of that. – Ian Aug 28 '14 at 10:33
  • I forgot to put in that you would have $\tau_1=0$. – Ian Aug 28 '14 at 11:30
  • 3
    +1 The exact expression is $\mathrm{E}\left(\tau\right) = 1 + \sum_{k=1}^{n-2} \frac{n(n-1)}{k(k+1)} = (n-1)^2$, since the sum telescopes. See problem 910601 for more detailed. – Sasha Aug 28 '14 at 14:39