TITLE: Compute the expectation of steps making $n$ different balls the same
QUESTION [11 upvotes]: Suppose that we are given $n$ balls of different colors. Each time we pick up two balls randomly and change the color of the second ball to that of the first, then we put them back. The question is what is the expectation of steps when these balls become the same color.  
I solved the problem for $n=2, 3, 4$. The naive solution is to solve a system of recursive equations. But there are too many states if $n$ is lager than $4$.
As requested by the comment, I now present my solution for $n=3$; similar method works for $n=4$. Let $E(1, 2, 3)$ be the desired expectation, we have 
$$
E(1, 2, 3)=1+\frac{1}{6}(E(1, 1, 2)+E(1, 2, 2)+etc.)=1+E(1,1, 2)
$$
and 
$$
E(1, 1, 2)=1+\frac{1}{3}(E(1,1,2)+E(1,1,1)+E(1, 2, 2))=1+\frac{2}{3}E(1,1,2).
$$
It not hard to see that $E(1,1,2)$ is finite, hence $E(1,1,2)=3$ and $E(1,2,3)=4$.
P.S. I was asked this question by a phone interviewer. If I or he didn't get the question wrong, then I hope there might be a 'clever and quick' solution for general cases.

REPLY [4 votes]: @Daniel Weissmann's answer is the key to the full solution which follows.
It is enough to compute the expected number of drawings under the condition that the red color wins out. We only have to distinguish the $n+1$ states $s_k$ $\>(0\leq k\leq n)$ where there are $k$ red balls and $n-k$ nonred balls. The states $s_0$ and $s_n$ are terminal states. When we are in state $s_k$,  $1\leq k\leq n-1$, the next drawing will alter the state iff a red ball and a nonred ball are drawn. With equal probability this leads to the state $s_{k-1}$, resp. $s_{k+1}$. If we denote the probability of winning when in state $s_k$ by $p_k$ we therefore have
$$p_k=(1-2\lambda_k)p_k+{\lambda_k}(p_{k-1}+p_{k+1})\ ,$$
where $\lambda_k={k(n-k)\over n(n-1)}$. This implies $p_{k-1}-2p_k+p_{k+1}=0$ which together with $p_0=0$, $p_n=1$ leads to the "linear behavior"
$$p_k={k\over n}\qquad(0\leq k\leq n)\ .\tag{1}$$
Denote by $e_k$ $(1\leq k\leq n)$ the expected number of additional drawings when we are in state $s_k$, under the condition that red wins. Then we have the following recursion, valid for $1\leq k\leq n-1$:
$$e_k={1\over p_k}\biggl(\lambda_kp_{k-1}(e_{k-1}+1)+(1-2\lambda_k)p_k(e_k+1)+\lambda_k p_{k+1}(e_{k+1}+1)\biggr)\ .$$
Using $(1)$ this  can be simplified to
$$2k e_k=(k-1)e_{k-1}+(k+1)e_{k+1}={n(n-1)\over n-k}\qquad(1\leq k\leq n-1)\ .$$
We now put 
$$f_k:={ke_k\over n(n-1)}\quad(1\leq k\leq n-1), \qquad f_0=f_n:=0$$
and obtain the following equations for the $f_k$ $\>(1\leq k\leq n-1)$:
$$-f_{k-1}+2f_k-f_{k+1}={1\over n-k}\qquad(1\leq k\leq n-1)\ .$$
Let $A$ be the band matrix of this system (all elements  $\geq2$ off the main diagonal are zero). Its inverse $B=[b_{ik}]$ is given by
$$b_{ik}=\cases{{(n-i)k\over n} & $(k\leq i)$\cr
{(n-k)i\over n}&$(k\geq i)\ .$\cr}$$
It follows that
$$e_1=n(n-1)f_1=n(n-1)\sum_{k=1}^{n-1}b_{1k}{1\over n-k}=n(n-1)\sum_{k=1}^{n-1}{(n-k)\cdot1\over n(n-k)}=(n-1)^2\ .$$