Probability of drawing a red ball at move N if each move the color of one ball changes? Imagine a box with a known number of $r$ red and $b$ blue balls.
Each turn, I take one random ball from the box and put one ball of the opposite color back.
How can I calculate the probability of drawing a red ball at the $n$-th turn when I know the values for $r$, $b$ and $n$ and strictly follow the rule above?
 A: Denote the number $r+b$ of balls by $m$. The ball you choose has been switched $k$ times with probability
$$
\frac1{m^n}\binom nk(m-1)^{n-k}\;,
$$
so it's been switched an even number of times with probability
\begin{align}
\frac1{2m^n}\left(\sum_{k=0}^n\binom nk(m-1)^{n-k}+\sum_{k=0}^n\binom nk(-1)^k(m-1)^{n-k}\right)
&=\frac{m^n+(m-2)^n}{2m^n}\\
&=\frac12\left(1+\left(1-\frac2m\right)^n\right)\;.
\end{align}
Thus it's red with probability
$$
\frac rm\cdot\frac12\left(1+\left(1-\frac2m\right)^n\right)+\frac bm\cdot\frac12\left(1-\left(1-\frac2m\right)^n\right)=\frac12\left(1+\frac{r-b}m\left(1-\frac2m\right)^n\right)\;.
$$
A: Each state is completely determined by the number of red balls, since the total number of balls is constant, so all you have to do is to set up the recurrence relation.
Let $k$ be the total number of balls in the box.
Let $p(n,r)$ be the probability that the $n$-th state has $r$ red balls.
Then $p(n,r) = p(n-1,r+1) \cdot \frac{r+1}{k} + p(n-1,r-1) \cdot (1-\frac{r-1}{k})$ for any integers $n,r$ such that $0 \le r \le k$.
I'll leave the base cases to you. After this the answer would be just $\sum_{r=0}^k p(n,r) \frac{r}{k}$. Since you asked for calculation, this may be all you need.
I don't know if there is a closed-form, but one special case can be solved. For example if originally there are an equal number of red and blue balls, then the symmetry implies that both red and blue are equally likely at each step. Also, since the procedure is more likely to equalize the red and blue balls than not, for large $n$ the distribution of states would be nearly symmetric in colour, which would mean that both red and blue would be almost equally likely at each subsequent step.
