The preceding three posts are devoted to a problem involving absorbing Markov chains (finding the mean time to absorption and the probability of absorption). The links to these three posts are here, here and here. One method in solving this problem is to use the fundamental matrix. The same method can be used to solve a problem involving the last step before being absorbed. Here are two examples.

*Example 1*

Six coins are tossed all at once. The coins randomly fall heads or tails. For the coins that fall tails, you pick up and toss again. The process continues in such a way that after each toss, you pick up the coins that fall tails and toss again. The process stops until all coins show heads. Let be the number of coins in the last toss. Determine the probability distribution of the random variable .

Note that can range from 6 down to 1. If the first toss results in 6 heads, there is no need to toss again, meaning that , which is not very likely. The problem is to determine how likely it is for to be a given value.

*Example 2*

A maze has 7 areas with two of the areas being food sources (area 5 and area 7)

A mouse is placed into this maze. When the mouse is in an area with food, it stays there and does not leave. When the mouse is in an area with no food, it moves into the adjacent areas at random. In other words, if the area has exits, the mouse moves to one of these areas with probability .

If the mouse is in one of the non-food areas, then the mouse will be absorbed into one of the food areas. We are interested in identifying the non-food area before reaching a food area. The areas adjacent to a food area would be 2, 4 and 6. These would be the entry points for food. When the mouse finds food, how likely is the entry point to be area 2, area 4 or area 6? More specifically, if the mouse is in area where , determine the probability that the mouse transitions into a food area from area where .

A common idea for these two examples and others like them is that we are interested in locating the transient state from which the process enters an absorbing state. We would like to find the probabilities of the various transient states being the entry point to absorption given an initial state. We discuss these two examples after demonstrating the method using a smaller example.

**Illustrative Example**

A Markov chain has 4 states (0, 1, 2 and 3). The process cycles among these states according to the following transition probability matrix.

There are two absorbing states (0 and 3) and two transient states (1 and 2). If the process starts at a transient state, the process will eventually be absorbed (be transitioned into an absorbing state). The question we want to answer is this. What is the transient state from which the process enters an absorbing state? In this example, the process can enter an absorbing state from state 1 or state 2. Given that the process is in state 1 initially, what is the probability that the process enters absorption from state 1? Likewise from state 2? The same question can be asked if the process starts at state 2 initially.

Let be the chain described by the above matrix. Let . The quantity is the random time to absorption. The quantity is the time period before absorption. Thus is the last transient state before absorption. We calculate the following probabilities.

The first two probabilities form the conditional distribution of the last transient state given that the initial state is 1. The last two probabilities form the conditional distribution of the last transient state given that the initial state is 2. To find these probabilities, it will be helpful to perform calculations involving the fundamental matrix.

See here for more information on the calculation. The matrix is the part of consisting of the transient states. The matrix is the difference between the identity matrix and . The matrix , the inverse of , is the fundamental matrix for the absorbing Markov chain.

The matrix gives the mean times spent in transient states. For example, if the process starts in state 1, it spend 35/19 = 1.842 periods in state 1 and 10/19 = 0.526 periods in state 2. In total, it spends on average 45/19 = 2.368 periods in transient states before being absorbed (if the initial state is 1). The following shows the calculation for the case of initial state being 1.

The calculation shows that if the initial state is 1, it is much more likely for the process to enter an absorbing state from state 1 than from state 2 (almost 74% chance). Before giving an indication why the calculation works, here’s the calculation for the initial state being 2.

If the process starts from state 2 instead, it is more likely (almost 79% chance) that the process enters an absorbing state from state 2.

Here’s the thought process for obtaining these probabilities. Consider . The starting transient state is 1 and the ending transient state is also 1. Then we look at the mean time in transient state . From the ending transient state 1, the process can go into the absorbing state 0 or 3. Thus the desired probability is .

If the starting state is 1 and the ending transient state is 2, we would take the sum of mean time times for . Thus would be .

In general is the sum of over all absorbing states from which it is possible to go from to . To get a sense of why this idea works, let’s look at the the probabilities of absorption calculated from the fundamental matrix .

To make it easier to see, we rewrite the last matrix on the right as follows.

This is a 2 x 2 matrix indicating the probability of absorption based on the initial states (the rows) and the absorbing states (the columns). The first column gives the probabilities of absorption into state 0 and the second column gives the probabilities of absorption into state 3. Each of the four elements is a sum of two quantities. We can rearrange these 8 quantities to get the desired probabilities. For example, would be the quantities corresponding to the initial transient state 1 and ending transient state 1, which would be . The probability would be the sum of the quantities corresponding to the initial transient state 2 and ending transient state 1, which would be .

**Summary**

Before tackling the examples stated earlier, we summarize the ideas in the preceding section. Suppose that is the transition probability matrix for a given absorbing Markov chain. For conceptual clarity, we can rewrite in the following form.

In this formulation, consists of the one-step transition probabilities from transient states into transient states, consists of the one-step transition probabilities from transient states into absorbing states. Furthermore, all entries of are zero and is the identity matrix of an appropriate size.

The next step is to obtain the fundamental matrix , which is the inverse matrix of . The entries of are mean times spent in transient states. For example, the entry is the mean time spent in state given that the initial state is . As mentioned, the entries of the matrix are one-step probabilities from a transient state into an absorbing state. A typical entry of is where is a transient state and is an absorbing state. As the above example demonstrates, the entries of and are used in finding the probability of the transient state from which the process enters an absorbing state.

Let , which is the random time to absorption. The goal is to find the probability of the form

where is the initial transient state and is the ending transient state (the last transient state before absorption). This probability is obtained by combining the appropriate entries of the matrices and in the following way:

where is over all relevant absorbing states, i.e. all absorbing states for which it is possible to transition from to .

**Examples**

We now solve the two examples indicated at the beginning.

*Example 1*

Let , i.e. the 0th toss involves 6 coins. Let be the number of coins in the st toss. This is indeed a Markov chain since the next state depends only on the current state. The states decrease as more and more tosses are made. Thus the states of the chain are 6, 5, 4, 3, 2, 1 and 0 with state 0 being the absorbing state.

In each step in the chain, we observe the number of tails in tossing a number of coins. Thus each row in the transition probability matrix consists of the probabilities from a binomial distribution. Thus the following gives the transition probability matrix .

The following shows the calculation to obtain the fundamental matrix .

To solve the problem at hand, first define the time to absorption . The following calculation gives the probabilities of the last step.

Starting a 6 coins, the reduction in coins in tosses is gradual. There is a 72% chance that the coins will be reduced to one coin in the last toss. The most likely way to end the game is from tossing the last single coin. However, the calculation does not indicate how long it will take to reach the last step of one coin.

*Example 2*

The diagram of the maze is repeated here.

There are 7 states in this Markov chain, representing the areas in the maze. The following gives the transition probability matrix.

The states 5 and 7 are the areas with food, thus are absorbing states. The next step is the calculation surrounding the fundamental matrix .

The matrices and are all we need to finish the problem. Suppose that we place the mouse initially at either area 2, area 3 and area 6. We find the probabilities of the last transient state being 2, 4 and 6. Once again is the random time to absorption and is defined by .

First, the starting state is 2.

Next, the starting state is 3.

Lastly, the starting state is 6.

The results agree with the intuition. If the mouse is placed in area 2 initially, it is most likely that the mouse enters food area from area 2 (65% chance). Because the mouse makes the moves at random, there is a small but not negligible chance that the entry to food is from area 4 or area 6.

The initial state of area 3 is more neutral. If the mouse is placed in area 3 at first, the entry to food is roughly equally likely to be from areas 2, 4 and 6, with area 6 having a slight edge. Note that area 6 has food areas on two sides.

If the mouse is placed in area 6 initially, the entry to food is mostly likely to be from area 6 since there are foods on two sides of area 6.

**Practice Problems**

Several practice problems to reinforce the concepts discussed here are available in a companion blog. See the problems at the end of this problem set.

Dan Ma math

Daniel Ma mathematics

Dan Ma Markov chains

Daniel Ma Markov chains

2018 – Dan Ma