Question based on the probabilistic model of diffusion I've been stumped on this question on my introductory probability course, with no clue on how to proceed:
"There are two boxes — A containing n blue balls and B containing n black balls.
At each step, one ball is chosen at random from both boxes and swapped, i.e., the
one from A is put into B and vice versa. Let $X_m$ be the number of black balls in
urn A after m steps. Observe that this determines the state of the system after m
steps, i.e., knowing $X_m$ describes the composition of both the urns. Obtain the probability mass function of $X_m$."
I've been stuck on this question, writing out pointless equations with no way to know what I should be doing. Could someone please give me an insight on how I can get started?
Also, we've just been introduced to random variable (just putting it out there because I found something online regarding Markov matrices and all, and I didn't understand any of it).
Thanks in advance!
 A: Given a procedure dealing with two boxes with blue and red balls it is hard to guess a number of black boxes in an urn. Below I assumed that the question contains misprints and tried to fix them, but the obtained answer looks too complicated.
We assume that initially box $A$ contains $n$ blue balls and no other balls and box $B$ contains $n$ black balls and no other balls. Also we assume that at each step $m\ge 1$ all balls from $A$ and all balls from $B$ have equal probability to be chosen. Suppose that $X_{m-1}=i$. Depending of colors of the chosen balls, there are the following four possible cases for $X_m$.
1)) The ball from $A$ is black and the ball from $B$ is black. The probability of this case is $\tfrac in\cdot \tfrac {n-i}n=\tfrac{i(n-i)}{n^2}.$ In this case $X_{m}=X_{m-1}=i$.
2)) The ball from $A$ is black and the ball from $B$ is blue. The probability of this case is $\tfrac in\cdot \tfrac in=\tfrac{i^2}{n^2}.$ In this case $X_{m}=X_{m-1}-1=i-1$.
3)) The ball from $A$ is blue and the ball from $B$ is black. The probability of this case is $\tfrac {n-i}n\cdot \tfrac {n-i}n=\tfrac{(n-i)^2}{n^2}.$ In this case $X_{m}=X_{m-1}+1=i+1$.
4)) The ball from $A$ is blue and the ball from $B$ is blue. The probability of this case is $\tfrac {n-i}n\cdot \tfrac in=\tfrac{i(n-i)}{n^2}.$ In this case $X_{m}=X_{m-1}=i$.
For each $m\ge 0$ let $x_m=(x_{m0}, x_{m1},\dots, x_{mn})^T$, where for each integer $i$ from $0$ to $n$, $x_{mi}$ is a probability that $X_m$ equals $i$. The observation above follows that $x_m=Ax_{m-1}$ for each $m\ge 1$, where $A=\|a_{ij}\|$ is a matrix such that
$a_{ii}=\frac {2i(n-i)}{n^2}$ for each $0\le i\le n$,
$a_{i-1, i}=\frac{(n-i)^2}{n^2}$, for each $1\le i\le n$,
$a_{i+1, i}=\frac{i^2}{n^2}$, for each $0\le i\le n-1$,
and all other $a_{ij}$ are zeroes.
Then $x_0=(1,0,\dots,0)$ and $x_m=A^mx_0$ for each $m$. For large $m$ the calculation of the power $A^m$ can be simplified by finding a Jordan normal form $J=P^{-1}AP$, calculating $J^m$ by the formulae for Jordan cells of $J$ and obtaining $A^m=PJ^mP^{-1}$.
