Application to Markov Chains
Many natural phenomena progress through various stages and can be in a variety of states at each stage. For example, the weather in a given city progresses day by day and, on any given day, may be sunny or rainy. Here the states are “sun” and “rain,” and the weather progresses from one state to another in daily stages. Another example might be a football team: The stages of its evolution are the games it plays, and the possible states are “win,” “draw,” and “loss.”
The general setup is as follows: A “system” evolves through a series of “stages,” and at any stage it can be in any one of a finite number of “states.” At any given stage, the state to which it will go at the next stage depends on the past and present history of the system—that is, on the sequence of states it has occupied to date.
(Note: The name honors Andrei Andreyevich Markov (1856–1922) who was a professor at the university in St. Petersburg, Russia.)
Even in the case of a Markov chain, the state the system will occupy at any stage is determined only in terms of probabilities. In other words, chance plays a role. For example, if a football team wins a particular game, we do not know whether it will win, draw, or lose the next game. On the other hand, we may know that the team tends to persist in winning streaks; for example, if it wins one game it may win the next game \(\frac {1}{2}\) of the time, lose \(\frac {4}{10}\) of the time, and draw \(\frac {1}{10}\) of the time. These fractions are called the probabilities of these various possibilities. Similarly, if the team loses, it may lose the next game with probability \(\frac {1}{2}\) (that is, half the time), win with probability \(\frac {1}{4}\), and draw with probability \(\frac {1}{4}\). The probabilities of the various outcomes after a drawn game will also be known.
We shall treat probabilities informally here: The probability that a given event will occur is the long-run proportion of the time that the event does indeed occur. Hence, all probabilities are numbers between \(0\) and \(1\). A probability of \(0\) means the event is impossible and never occurs; events with probability \(1\) are certain to occur.
If a Markov chain is in a particular state, the probabilities that it goes to the various states at the next stage of its evolution are called the transition probabilities for the chain, and they are assumed to be known quantities. To motivate the general conditions that follow, consider the following simple example. Here the system is a man, the stages are his successive lunches, and the states are the two restaurants he chooses.
- (a)
- What is the probability that he eats at \(A\) on the third day after the initial one?
- (b)
- What proportion of his lunches does he eat at \(A\)?
The \(B\) column shows that, if he eats at \(B\) on one day, he will eat there on the next day \(\frac {3}{4}\) of the time and switches to \(A\) only \(\frac {1}{4}\) of the time.
The restaurant he visits on a given day is not determined. The most that we can expect is to know the probability that he will visit \(A\) or \(B\) on that day.
Let \({\bf s}_{m} = \begin{bmatrix} s_{1}^{(m)} \\ s_{2}^{(m)} \end{bmatrix}\) denote the state vector for day \(m\). Here \(s_{1}^{(m)}\) denotes the probability that he eats at \(A\) on day \(m\), and \(s_{2}^{(m)}\) is the probability that he eats at \(B\) on day \(m\). It is convenient to let \({\bf s}_{0}\) correspond to the initial day. Because he is equally likely to eat at \(A\) or \(B\) on that initial day, \(s_{1}^{(0)} = 0.5\) and \(s_{2}^{(0)} = 0.5\), so \({\bf s}_{0} = \begin{bmatrix} 0.5 \\ 0.5 \end{bmatrix}.\) Now let
Hence, the probability that his third lunch (after the initial one) is at \(A\) is approximately \(0.195\), whereas the probability that it is at \(B\) is \(0.805\). If we carry these calculations on, the next state vectors are (to five figures):
Moreover, as \(m\) increases the entries of \({\bf s}_{m}\) get closer and closer to the corresponding entries of \(\begin{bmatrix} 0.2 \\ 0.8 \end{bmatrix}\). Hence, in the long run, he eats \(20\%\) of his lunches at \(A\) and \(80\%\) at \(B\).
Example 007199 incorporates most of the essential features of all Markov chains. The general model is as follows: The system evolves through various stages and at each stage can be in exactly one of \(n\) distinct states. It progresses through a sequence of states as time goes on. If a Markov chain is in state \(j\) at a particular stage of its development, the probability \(p_{ij}\) that it goes to state \(i\) at the next stage is called the transition probability. The \(n \times n\) matrix \(P = \begin{bmatrix} p_{ij} \end{bmatrix}\) is called the transition matrix for the Markov chain. The situation is depicted graphically in the diagram.
We make one important assumption about the transition matrix \(P = \begin{bmatrix} p_{ij} \end{bmatrix}\): It does not depend on which stage the process is in. This assumption means that the transition probabilities are independent of time—that is, they do not change as time goes on. It is this assumption that distinguishes Markov chains in the literature of this subject.
Consider the \(j\)th column of the transition matrix \(P\).
If the system is in state \(j\) at some stage of its evolution, the transition probabilities \(p_{1j}, p_{2j}, \dots , p_{nj}\) represent the fraction of the time that the system will move to state 1, state 2, …, state \(n\), respectively, at the next stage. We assume that it has to go to some state at each transition, so the sum of these probabilities is \(1\):
Thus, the columns of \(P\) all sum to \(1\) and the entries of \(P\) lie between \(0\) and \(1\). Hence \(P\) is called a stochastic matrix.
As in Example 007199, we introduce the following notation: Let \(s_{i}^{(m)}\) denote the probability that the system is in state \(i\) after \(m\) transitions. The \(n \times 1\) matrices
are called the state vectors for the Markov chain. Note that the sum of the entries of \({\bf s}_{m}\) must equal \(1\) because the system must be in some state after \(m\) transitions. The matrix \({\bf s}_{0}\) is called the initial state vector for the Markov chain and is given as part of the data of the particular chain. For example, if the chain has only two states, then an initial vector \({\bf s}_0 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\) means that it started in state 1. If it started in state 2, the initial vector would be \({\bf s}_0 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}\). If \({\bf s}_0 = \begin{bmatrix} 0.5 \\ 0.5 \end{bmatrix}\), it is equally likely that the system started in state 1 or in state 2.
Heuristic Proof Suppose that the Markov chain has been run \(N\) times, each time starting with the same initial state vector. Recall that \(p_{ij}\) is the proportion of the time the system goes from state \(j\) at some stage to state \(i\) at the next stage, whereas \(s_{i}^{(m)}\) is the proportion of the time it is in state \(i\) at stage \(m\). Hence
If the initial probability vector \({\bf s}_{0}\) and the transition matrix \(P\) are given, Theorem 007270 gives \({\bf s}_{1}, {\bf s}_{2}, {\bf s}_{3}, \dots \), one after the other, as follows:
Hence, the state vector \({\bf s}_{m}\) is completely determined for each \(m = 0, 1, 2, \dots \) by \(P\) and \({\bf s}_{0}\).
- (a)
- If it hunts in some region one day, it is as likely as not to hunt there again the next day.
- (b)
- If it hunts in \(R_{1}\), it never hunts in \(R_{2}\) the next day.
- (c)
- If it hunts in \(R_{2}\) or \(R_{3}\), it is equally likely to hunt in each of the other regions the next day.
If the pack hunts in \(R_{1}\) on Monday, find the probability that it hunts there on Thursday.
Steady State Vector
Another phenomenon that was observed in Example 2 can be expressed in general terms. The state vectors \({\bf s}_{0}, {\bf s}_{1}, {\bf s}_{2}, \dots \) were calculated in that example and were found to “approach” \({\bf s} = \begin{bmatrix} 0.2 \\ 0.8 \end{bmatrix}\). This means that the first component of \({\bf s}_{m}\) becomes and remains very close to \(0.2\) as \(m\) becomes large, whereas the second component gets close to \(0.8\) as \(m\) increases. When this is the case, we say that \({\bf s}_{m}\) converges to \(\bf s\). For large \(m\), then, there is very little error in taking \({\bf s}_{m} = {\bf s}\), so the long-term probability that the system is in state 1 is \(0.2\), whereas the probability that it is in state 2 is \(0.8\). In Example 2, enough state vectors were computed for the limiting vector \(\bf s\) to be apparent. However, there is a better way to do this that works in most cases.
Suppose \(P\) is the transition matrix of a Markov chain, and assume that the state vectors \({\bf s}_{m}\) converge to a limiting vector \(\bf s\). Then \({\bf s}_{m}\) is very close to \(\bf s\) for sufficiently large \(m\), so \({\bf s}_{m+1}\) is also very close to \(\bf s\). Thus, the equation \({\bf s}_{m+1} = P{\bf s}_{m}\) from Theorem 5 is closely approximated by
so it is not surprising that \(\bf s\) should be a solution to this matrix equation. Moreover, it is easily solved because it can be written as a system of homogeneous linear equations
with the entries of \(\bf s\) as variables.
In Example 2, where \(P = \begin{bmatrix} 0 & 0.25 \\ 1 & 0.75 \end{bmatrix}\), the general solution to \((I - P){\bf s} = {\bf 0}\) is \({\bf s} = \begin{bmatrix} t \\ 4t \end{bmatrix}\), where \(t\) is a parameter. But if we insist that the entries of \(S\) sum to \(1\) (as must be true of all state vectors), we find \(t = 0.2\) and so \({\bf s} = \begin{bmatrix} 0.2 \\ 0.8 \end{bmatrix}\) as before.
All this is predicated on the existence of a limiting vector for the sequence of state vectors of the Markov chain, and such a vector may not always exist. However, it does exist in one commonly occurring situation. A stochastic matrix \(P\) is called regular if some power \(P^{m}\) of \(P\) has every entry greater than zero. The matrix \(P = \begin{bmatrix} 0 & 0.25 \\ 1 & 0.75 \end{bmatrix}\) of Example 2 is regular (in this case, each entry of \(P^{2}\) is positive), and the general theorem is as follows:
- (a)
- \(P{\bf s} = {\bf s}\).
- (b)
- The entries of \(\bf s\) are positive and sum to \(1\).
Moreover, condition 1 can be written as
This theorem will not be proved here. The interested reader can find an elementary proof in J. Kemeny, H. Mirkil, J. Snell, and G. Thompson, Finite Mathematical Structures (Englewood Cliffs, N.J.: Prentice-Hall, 1958).
If \(P\) is the regular transition matrix of a Markov chain, the column \(\bf s\) satisfying conditions 1 and 2 of Theorem 9 is called the steady-state vectorfor the Markov chain. The entries of \(\bf s\) are the long-term probabilities that the chain will be in each of the various states.
- (a)
- If he has beef soup one day, what is the probability that he has it again two days later?
- (b)
- What are the long-run probabilities that he eats each of the three soups?
To find the long-run probabilities, we must find the steady-state vector \(\bf s\). Theorem 9 applies because \(P\) is regular (\(P^{2}\) has positive entries), so \(\bf s\) satisfies \(P{\bf s} = {\bf s}\). That is, \((I - P){\bf s} = {\bf 0}\) where
Practice Problems
Which of the following stochastic matrices is regular?
In each case find the steady-state vector and, assuming that it starts in state 1, find the probability that it is in state 2 after \(3\) transitions.
A fox hunts in three territories \(A\), \(B\), and \(C\). He never hunts in the same territory on two successive days. If he hunts in \(A\), then he hunts in \(C\) the next day. If he hunts in \(B\) or \(C\), he is twice as likely to hunt in \(A\) the next day as in the other territory.
Assume that there are three social classes—upper, middle, and lower—and that social mobility behaves as follows:
- (a)
- Of the children of upper-class parents, \(70\%\) remain upper-class, whereas \(10\%\) become middle-class and \(20\%\) become lower-class.
- (b)
- Of the children of middle-class parents, \(80\%\) remain middle-class, whereas the others are evenly split between the upper class and the lower class.
- (c)
- For the children of lower-class parents, \(60\%\) remain lower-class, whereas \(30\%\) become middle-class and \(10\%\) upper-class.
A mouse is put into a maze of compartments, as in the diagram. Assume that he always leaves any compartment he enters and that he is equally likely to take any tunnel entry.
\(P = \begin{bmatrix} 1 - p & q \\ p & 1 - q \end{bmatrix}\), where \(0 < p < 1\) and \(0 < q < 1\).
- (a)
- Show that \(\frac {1}{p + q} \begin{bmatrix} q \\ p \end{bmatrix}\) is the steady-state vector for \(P\).
- (b)
- Show that \(P^{m}\) converges to the matrix \(\frac {1}{p + q} \begin{bmatrix} q & q \\ p & p \end{bmatrix}\) by first verifying inductively that \(P^m = \frac {1}{p + q} \begin{bmatrix} q & q \\ p & p \end{bmatrix}\) \(+ \frac {(1 - p - q)^m}{p + q} \begin{bmatrix} p & -q \\ -p & q \end{bmatrix}\) for \(m = 1, 2, \dots \). (It
can be shown that the sequence of powers \(P, P^{2}, P^{3}, \dots \) of any regular transition matrix
converges to the matrix each of whose columns equals the steady-state vector
for \(P\).) Since \(0 < p < 1\) and \(0 < q < 1\) we get \(0 < p + q < 2\) whence \(-1 < p + q - 1 < 1\). Finally, \(-1 < 1 - p - q < 1\), so \((1 - p - q)^{m}\) converges to zero as \(m\) increases.
Text Source
This application was adapted from Section 2.9 of Keith Nicholson’s Linear Algebra with Applications. (CC-BY-NC-SA)
W. Keith Nicholson, Linear Algebra with Applications, Lyryx 2018, Open Edition, p. 134