DeepNull

Stochastic Series - Pt 2 - Ehrenfest chain

In my last post, I covered the gambler's ruin, where a gambler was trying to win some money on roulette so he could pay child support to his ex-wife.

This time, we are looking at a simple model called the Ehrenfest chain, where there are no absorbing states.

Imagine that there are 2 urns, one to the left and one to the right. We also have 4 balls, labeled A, B, C, and D, with 2 balls in each urn.

Now we randomly select one ball, giving each ball an equal chance of being selected, regardless of which urn it is in. What is the probability of picking a ball from the left urn?

The answer is 50%, since both urns contain equally many balls.

Here is the twist, each time you select a ball from the right urn, you need to place it in the left urn, and vice versa.

Example flow:

  1. Start with 2 balls in each urn.
  2. Randomly select a ball.
  3. Place the ball in the opposite urn.
  4. Repeat steps 2 and 3.

So what happens after we pick a ball from the right urn and put it in the left urn? The probabilities of drawing a ball from each urn have changed.

Now the left urn contains 3 balls and the right urn contains 1 ball, so the probability of selecting a random ball from the right urn is only 1/4 (1 out of 4 balls), and the probability of selecting a ball from the left urn is 3/4 (3 out of 4 balls).

As you can imagine, this creates a tendency to push the number of balls towards an equal distribution between the two urns, although individual moves can still take us further away.

Defining a state

We need to define what a state is, so in this case we are going to use the number of balls in the left urn.

i = number of balls in the left urn

So let's say that the number of balls in the left urn is 3 (i = 3). We can easily get the number of balls in the right urn:

Balls in the right urn = 4 - i

The transition rule

Let's say we are about to draw a random ball, and there are currently 3 balls in the left urn (i = 3).

We can calculate the probability of going from i = 3 to i = 4:

P(i → i+1) = (4 - i) / 4

This reads as:

When i = 3, we get (4 - 3) / 4, which is equal to 0.25. This means that the probability of increasing i by one is 0.25, or 25%.

Similarly, the probability of decreasing i by one is:

P(i → i-1) = i / 4

Here are all the transition probabilities. Each row shows the current state, and each column shows the next state.

Current state Next: 0 Next: 1 Next: 2 Next: 3 Next: 4
0 0 1 0 0 0
1 1/4 0 3/4 0 0
2 0 1/2 0 1/2 0
3 0 0 3/4 0 1/4
4 0 0 0 1 0

The balancing tendency

As we noted previously, this kind of system has a way of balancing itself.

p(4, 3) = 1
p(3, 2) = 3/4
p(2, 1) = 1/2
p(1, 0) = 1/4
p(0, 1) = 1

Read p(i, j) as the probability of going from state i to state j in one step.

When there are 3 balls in the left urn, we have a 3/4 chance of moving towards an equal distribution. When there is only 1 ball in the left urn, we also have a 3/4 chance of moving towards an equal distribution.

But this does not mean that the state is sticky or stuck at any moment, because for each round a ball has to be drawn and moved. Even when we reach 2 balls in each urn, the next move takes us away from that balance.

Multistep probabilities

To calculate the probability of one particular path, you just have to multiply the probabilities along the path.

Example:

2 → 1 → 2

1/2 × 3/4 = 3/8

But there is another way to get back to state 2 after two steps:

2 → 3 → 2

1/2 × 3/4 = 3/8

When there are several different possible paths leading to the same result after the same number of steps, we can add their probabilities:

3/8 + 3/8 = 3/4

So this means that if we start from state 2, the probability of being back at state 2 after two steps is 3/4.

Even and odd states

Since every move changes the state by exactly one:

even → odd

or

odd → even

For our chain, we have the following states:

even states = 0, 2, 4
odd states = 1, 3

Each time we draw a ball, the state toggles between even and odd. To get back to the state we started from, we need at least two draws, and we can only return after an even number of draws.

Examples of a real-life Ehrenfest chain

I purposely left out any examples that are related to the study of physics, mainly because I do not care much for physics.

The airlines

This is an extreme simplification of how people react to airline crashes, but it captures the idea.

Imagine 2 airlines that are competing for the same customers, let's call them Airline A and Airline B. Both airlines have equally many customers:

Airline Customers
Airline A 100,000
Airline B 100,000

i = number of customers flying with Airline A

In this model, each year exactly one flight crashes, and each time that happens, 1,000 customers change from the affected airline to the other airline.

We assume that each airline's probability of experiencing that crash is proportional to its number of customers. An airline with 75% of the customers therefore has a 75% chance of being the affected airline.

Each year, the probability of Airline A gaining 1,000 customers is:

P(i → i+1000) = (200,000 - i) / 200,000

This is the probability that the crash happens at Airline B.

The probability of Airline A losing 1,000 customers is:

P(i → i-1000) = i / 200,000

Airline A customers Airline B customers Probability A gains 1,000 Probability A loses 1,000
0 200,000 100% 0%
50,000 150,000 75% 25%
100,000 100,000 50% 50%
150,000 50,000 25% 75%
200,000 0 0% 100%

The larger airline is more likely to experience the crash and lose customers, while the smaller airline is more likely to gain them.

This shows the same balancing tendency as the Ehrenfest chain. If we count customers in groups of 1,000, we have the equivalent of 200 balls moving between two urns.