birth and death processes Suppose we have a system of N balls, each of which can be in one of two
boxes. A ball in box I stays there for a random amount of time with exponential(lambda)
distribution and then moves instantaneously to box II. A ball in box II stays there
for a random amount of time with exponential(lambda) distribution and then moves
instantaneously to box I. All balls act independently of each other. Let Xt be the
number of balls in box I at time t.


*

*a) I'm trying to show that X is a birth and death process and specify
the birth and death rates.

*b) How can we find the stationary distribution of the process.
For part (a), if we can show it satisfies a Yule process, this is essentially what we're trying to do. And for part (b), I also want some clarification on the detailed balanced equations for this problem.
 A: As the comments mention, this is indeed a continuous time version of the Ehrenfest model and there are papers written considering this problem like


*

*Karlin, Samuel, and James McGregor. Ehrenfest urn models. Journal of Applied Probability 2.2 (1965): 352-376.


The model is a birth-death process, births when there are $i$ balls in box I are at rate $(N-i)\lambda$ and deaths at rate $i\lambda$. These formulas cover the special cases too. When box I is empty then there are no deaths, and births happen at rate $N\lambda$, while when box I is full there are no births and deaths occur at rate $N\lambda$.
The balance equations (writing $\pi_i$ for the probability of being in state $i$) are
$$ \begin{align}
(N\lambda)\pi_0 &= (N\lambda)\pi_1\\
(N\lambda)\pi_1 &= \lambda \pi_0 + (N-1)\lambda \pi_2 \\
(N\lambda)\pi_2 &= 2\lambda \pi_1 + (N-2)\lambda \pi_3 \\
& \vdots\\
(N\lambda)\pi_{N-1} &= (N-1)\lambda \pi_{N-2} + \lambda \pi_N \\
(N\lambda)\pi_N &= N\lambda \pi_{N-1} \\
\end{align}$$
which you then need to solve along with the constraint that $\sum_{i=0}^N \pi_i = 1$ to find the stationary probability distribution.
A: What you are looking for is founded extensively by the so called master equations (linear or non-linear possible). See for the linear on here
The stochastic equations are for instance used to describe birth death processes and in general chemical reaction processes, also they can be applied to physical mdoels such as the two or multi mode laser. In the simplest case you have a transition from a state $A$ (box I) to a state $B$ (box II) at microscopic level of particles or individual species (social and biological system):
$$A \xrightarrow{\lambda_{AB}} B$$
$$A \xleftarrow{\lambda_{BA}} B$$
then with $\lambda_{AB}=P_\ell$ and $\lambda_{BA}=P_k$ as well as $P_\ell =A_{k\ell}$ and $P_k=A_{\ell k}$ (notation connects you to the wiki reference above):
$$\frac{dP_k}{dt}=\sum_\ell(A_{k\ell}P_\ell - A_{\ell k}P_k)=\sum_{\ell\neq k}(A_{k\ell}P_\ell - A_{\ell k}P_k)$$
You can then require microscopic steady state as condition hence:
$$A_{k \ell} \pi_\ell = A_{\ell k} \pi_k$$
In order to get to the macroscopic level you will need to build the moments such as the first order $\langle A_{k \ell} \rangle$ and $\langle A_{\ell k} \rangle$ (if linear the first, if non-linear then even higher order) and then in general you will see that the differential equation above (in the non-linear case with some neglegance of higher moments) reforms into a macroscopic differential equation as known from for instance chemistry or population dynamics (including birth/death processes). The moments turn then to encapsulate into the macroscopic reaction rates.
This approach is a general and elegant approach that allows you to have a microscopic comprehensive model both for your dyanmic model as well as its reaction rates (in your case the macroscopic rates of birth/death).
Hermann Haken among many others has investigated in detail these type of approach. Extensively literature you will find about this around synergetics/master equations for social and chemical systems. Hermann Haken, in his book Synergetics: an introduction describes with examples in the last chapters the complete calculations.
I hope this is good answer.
Append for a detailled description see Handbook of Stochastic Methods: for Physics, Chemistry and the Natural Sciences page 234 upwards
