[Math] Another colored balls puzzle

pr.probability

This is a puzzle a colleague asked me recently.

Imagine you have $n$ balls in a bag that are colored from $1$ to $n$. At each turn you take two balls at random out that have different colors and color one the color of the other. You then put them both back in the bag. What is the expected number of turns before all the balls have the same color?

The pair of balls you choose is uniformly selected from the set of all pairs of different-colored balls. You choose uniformly at random whether to paint the first the same as the second or vice versa.

Best Answer

I think you can verify Greg Martin's answer using indicator variables and linearity of expectation.

Let the random variable $X_i$ be the number of steps where one of the balls has the $i$th color before the $i$th color either disappears or becomes the only color.

The expected value of $X_i$ is as in the Gambler's Ruin, that is, $1 \cdot (n-1) = n-1$.

Each step involves two colors, hence the time to a single color is $\frac{1}{2} \sum X_i$.

The $\binom{n}{2}$ answer follows.