Solution (source code)

= Solution

At state $r$, urn 1 has $r$ red and $n-r$ blue balls, while urn 2 has $n-r$ red and $r$ blue balls. Conditional on the state, the two choices are <independent>, each assigning <probability> $1/n$ to every ball. A red–blue exchange decreases $r$; a blue–red exchange increases it; equal colours leave it unchanged. Thus the <conditional probability mass function> is
$$
\boxed{\mathbb P(R_{k+1}=s\mid R_k=r)=
\begin{cases}
r^2/n^2,&s=r-1,\\
2r(n-r)/n^2,&s=r,\\
(n-r)^2/n^2,&s=r+1,\\
0,&\text{otherwise}.
\end{cases}}
$$
The three numerators sum to $n^2$. At $r=0$ or $n$, the outward transition has probability zero. These are the transitions of the <Bernoulli-Laplace diffusion model>. The displayed formula is a transition kernel on every state; a literal conditional probability at a particular time requires the conditioning event to have positive probability.