The Ehrenfest chains, named for Paul Ehrenfest, are simple, discrete models for the exchange of gas molecules between two containers. However, they can be formulated as simple ball and urn models; the balls correspond to the molecules and the urns to the two containers. Thus, suppose that we have two urns, labeled 0 and 1, that contain a total of $m$ balls. The state of the system at time $n$ is the number of balls in urn 1, which we will denote by $X_{n}$. Our stochastic process is $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ with state space $S=\{0, 1, , m\}$. Of course, the number of balls in urn 0 at time $n$ is $m-X_{n}$.

In the basic Ehrenfest model, at each discrete time unit, independently of the past, a ball is selected at random and moved to the other urn.

Show that $X$ is a Markov chain on $S$ with transition probability function $P$ given below. The steps show how to construct the chain from more basic processes.

$$P(x, x-1)=\frac{x}{m}\text{,\hspace{0.5em}}P(x, x+1)=\frac{m-x}{m}\text{;\hspace{1em}}x\in S$$- Let $V_{n}$ be the ball selected at time $n$. Thus $V=\left(\begin{array}{c}V_{1}\\ V_{2}\\ V_{3}\\ \end{array}\right)$ is a sequence of independent random variables, each uniformly distributed on $\{1, 2, , m\}$.
- Let $X_{0}\in S$ be independent of $V$. We can start the process any way that we like.
- Now we can define the state process recursively as follows: $X_{n+1}=\begin{cases}X_{n}-1 & \text{if $V_{n+1}\le X_{n}$}\\ X_{n}+1 & \text{if $V_{n+1}> X_{n}$}\end{cases}$.

Consider the basic Ehrenfest chain with $m=5$ balls, and suppose that $X_{0}$ has the uniform distribution on $S$.

- Compute the probability density function, mean and variance of $X_{1}$.
- Compute the probability density function, mean and variance of $X_{2}$.
- Compute the probability density function, mean and variance of $X_{3}$.
- Sketch the initial probability density function and the probability density functions in parts (a), (b), and (c) on a common set of axes.

In the Ehrenfest experiment, select the basic model. For selected values of $m$ and selected values of the initial state, run the chain for 1000 time steps and note the limiting behavior of the proportion of time spent in each state.

Suppose now that we modify the basic Ehrenfest model as follows: at each discrete time, independently of the past, we select a ball at random and a urn at random. We then put the chosen ball in the chosen urn.

Show that $X$ is a Markov chain on $S$ with the transition probability matrix $Q$ given below. Sketch the state graph. The steps show how to construct the chain basic processes.

$$Q(x, x-1)=\frac{x}{2m}\text{,\hspace{0.5em}}Q(x, x)=1/2\text{,\hspace{0.5em}}Q(x, x+1)=\frac{m-x}{2m}\text{;\hspace{1em}}x\in S$$- Let $X_{0}$ and $V$ be as in Exercise 1.
- Let $U_{n}$ be the urn selected at time $n$. Thus $U=\left(\begin{array}{c}U_{1}\\ U_{2}\\ U_{3}\\ \end{array}\right)$ is a sequence of independent random variables, each uniformly distributed on $\{0, 1\}$ (so that $U$ is a fair, Bernoulli trials sequence). Also, $U$ is independent of $V$ and $X_{0}$.
- Now we can define the state process recursively as follows: $X_{n+1}=\begin{cases}X_{n}-1 & \text{if $(V_{n+1}\le X_{n})\land (U_{n+1}=0)$}\\ X_{n}+1 & \text{if $(V_{n+1}> X_{n})\land (U_{n+1}=1)$}\\ X_{n} & \text{otherwise}\end{cases}$.

Consider the modified Ehrenfest chain with $m=5$ balls, and suppose that the chain starts in state 2 (with probability 1).

- Compute the probability density function, mean and standard deviation of $X_{1}$.
- Compute the probability density function, mean and standard deviation of $X_{2}$.
- Compute the probability density function, mean and standard deviation of $X_{3}$.
- Sketch the initial probability density function and the probability density functions in parts (a), (b), and (c) on a common set of axes.

In the Ehrenfest experiment, select the modified model. For selected values of $m$ and selected values of the initial state, run the chain for 1000 time steps and note the limiting behavior of the proportion of time spent in each state.

Show that the basic and modified Ehrenfest chains are irreducible and positive recurrent.

Show that basic Ehrenfest chain is periodic with period 2. Compute $P^{2}$ and identify the cyclic classes.

Show that the modified Ehrenfest chain is aperiodic.

Show that for the basic and modified Ehrenfest chains, the invariant distribution is the binomial distribution with trial parameter $m$ and success parameter $1/2$.

$$f(x)=(m, x)\left(\frac{1}{2}\right)^{m}\text{,\hspace{0.5em}}x\in S$$Thus, the invariant distribution corresponds to placing each ball randomly and independently either in urn 1 or in urn 2.

For the basic Ehrenfest chain, describe the limiting behavior of $P^{(2n)}$ and $P^{(2n+1)}$ as $n\to \infty $.

In the Ehrenfest experiment, the limiting binomial distribution is shown graphically and numerically. For each model and for selected values of $m$ and selected values of the initial state, run the chain for 1000 time steps and note the limiting behavior of the proportion of time spent in each state. How do the choices of $m$, the initial state, and the model seem to affect the rate of convergence to the limiting distribution?

Show that the basic and modified Ehrenfest chains are reversible and use the reversibility condition to show again that the invariant distribution is the binomial distribution with trial parameter $m$ and success parameter $1/2$.

Run the simulation of the Ehrenfest experiment 10,000 time steps for each model, for selected values of
$m$, and with initial state 0. Note that at first, you can see the arrow of time

. After a long period, however, the direction of time is no longer evident.