### Bernoulli-Laplace Experiment

State Space
Distribution graph

#### Description

The Bernoulli-Laplace experiment models a simple diffusion process as a Markov chain. Suppose that we have two urns: urn 0 contains $$j$$ balls and urn 1 contains $$k$$ balls. Of the $$j + k$$ balls, $$r$$ are red, where $$0 \le r \le j + k$$. At each discrete time unit, a ball is selected at random from each urn, and the balls are switched to the opposite urns. The state of the system at any time is the number of red balls in urn 1. This forms a Markov chain with transition matrix $$P$$ given by \begin{align} P(x, x - 1) & = \frac{(j - r + x) x}{j k} \\ P(x, x) & = \frac{(r - x) x + (j - r + x) (j - x)}{j k} \\ P(x, x + 1) & = \frac{(j - x) (k - x)}{j k} \end{align} for $$x$$ in the state space $$S = \{\max\{0, r - j\}, \ldots, \min\{k, r\}\}$$

The states are shown in the top graph, with the current state colored red. As the process runs, the chain moves from state to state. The time and the sate are recorded at each update in the record table. The proportion of time that the chain is in each state is shown visually in the graph box in red and displayed numerically in the distribution table. The limiting distribution is shown visually in the graph box in blue and displayed numerically in the distribution table

The parameters $$j$$, $$k$$, $$r$$ and the initial state $$x_0$$ can be varied with the input controls.