The Bernoulli-Laplace chain, named for James Bernoulli and Pierre Simon Laplace, is a simple discrete model for the diffusion of two incompressible gases between two containers. Like the Ehrenfest chain, it can also be formulated as a simple ball and urn model. Thus, suppose that we have two urns, labeled 0 and 1. Urn 0 contains $j$ balls and urn 1 contains $k$ balls, where $j$ and $k$ are positive integers. Of the $j+k$ balls, $r$ are red and the remaining $j+k-r$ are green. At each discrete time, independently of the past, a ball is selected at random from each urn and then the two balls are switched. The balls of different colors correspond to molecules of different types, and the urns are the containers. The incompressible property is reflected in the fact that the number of balls in each urn remains constant over time.

Let $X_{n}$ denote the number of red balls in urn 1 at time $n$. Note that

- $k-X_{n}$ is the number of green balls in urn 1 at time $n$.
- $r-X_{n}$ is the number of red balls in urn 0 at time $n$.
- $j-r+X_{n}$ is the number of green balls in urn 0 at time $n$.

Argue that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is a Markov chain on $S=\{\max\{0 , r-j\}, , \min\{k , r\}\}$ with the transition probability function $P$ given below. Sketch the state graph.

$$P(x, x-1)=\frac{(j-r+x)x}{jk}\text{,\hspace{0.5em}}P(x, x)=\frac{rx-j(k-x)}{jk}\text{,\hspace{0.5em}}P(x, x+1)=\frac{(r-x)(k-x)}{jk}\text{;\hspace{1em}}x\in S$$Explicitly give the state space and the transition probability function in the following cases:

- $j=k$, so each container has the same number of particles.
- $j=k=r$, so the number of particles of each type is the same, and is the number of particles in each container.

Consider the Bernoulli-Laplace chain with $j=10$, $k=5$, and $r=4$. Suppose that $X_{0}$ has the uniform distribution on $S$.

- Explicitly give the transition probability function in matrix form.
- 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.

Run the simulation of the Bernoulli-Laplace experiment for 10000 steps and for various values of the parameters. Note the limiting behavior of the proportion of time spent in each state.

Show that the Bernoulli-Laplace chain is irreducible and aperiodic.

Show that the invariant distribution is the hypergeometric distribution with population parameter $j+k$, sample parameter $k$, and type parameter $r$. The probability density function is

$$f(x)=\frac{(r, x)(j+k-r, k-x)}{(j+k, k)}\text{,\hspace{1em}}x\in S$$Thus, the invariant distribution corresponds to selecting a sample of $k$ balls at random and without replacement from the $j+k$ balls and placing them in urn 1.

In the simulation of the Bernoulli-Laplace experiment, vary the parameters and note the shape and location of the limiting hypergeometric distribution. For selected values of the parameters, run the simulation for 10000 steps and and note the limiting behavior of the proportion of time spent in each state.

Show that the Bernoulli-Laplace chain is reversible and use the basic reversibility condition to show again that the invariant distribution is the hypergeometric distribution with population parameter $j+k$, sample parameter $k$, and type parameter $r$.

Run the simulation of the Bernoulli-Laplace experiment 10,000 time steps for selected values of the parameters, 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.