Skip to main content
\(\newcommand{\set}[1]{\{1,2,\dotsc,#1\,\}} \newcommand{\ints}{\mathbb{Z}} \newcommand{\posints}{\mathbb{N}} \newcommand{\rats}{\mathbb{Q}} \newcommand{\reals}{\mathbb{R}} \newcommand{\complexes}{\mathbb{C}} \newcommand{\twospace}{\mathbb{R}^2} \newcommand{\threepace}{\mathbb{R}^3} \newcommand{\dspace}{\mathbb{R}^d} \newcommand{\nni}{\mathbb{N}_0} \newcommand{\nonnegints}{\mathbb{N}_0} \newcommand{\dom}{\operatorname{dom}} \newcommand{\ran}{\operatorname{ran}} \newcommand{\prob}{\operatorname{prob}} \newcommand{\Prob}{\operatorname{Prob}} \newcommand{\height}{\operatorname{height}} \newcommand{\width}{\operatorname{width}} \newcommand{\length}{\operatorname{length}} \newcommand{\crit}{\operatorname{crit}} \newcommand{\inc}{\operatorname{inc}} \newcommand{\HP}{\mathbf{H_P}} \newcommand{\HCP}{\mathbf{H^c_P}} \newcommand{\GP}{\mathbf{G_P}} \newcommand{\GQ}{\mathbf{G_Q}} \newcommand{\AG}{\mathbf{A_G}} \newcommand{\GCP}{\mathbf{G^c_P}} \newcommand{\PXP}{\mathbf{P}=(X,P)} \newcommand{\QYQ}{\mathbf{Q}=(Y,Q)} \newcommand{\GVE}{\mathbf{G}=(V,E)} \newcommand{\HWF}{\mathbf{H}=(W,F)} \newcommand{\bfC}{\mathbf{C}} \newcommand{\bfG}{\mathbf{G}} \newcommand{\bfH}{\mathbf{H}} \newcommand{\bfF}{\mathbf{F}} \newcommand{\bfI}{\mathbf{I}} \newcommand{\bfK}{\mathbf{K}} \newcommand{\bfP}{\mathbf{P}} \newcommand{\bfQ}{\mathbf{Q}} \newcommand{\bfR}{\mathbf{R}} \newcommand{\bfS}{\mathbf{S}} \newcommand{\bfT}{\mathbf{T}} \newcommand{\bfNP}{\mathbf{NP}} \newcommand{\bftwo}{\mathbf{2}} \newcommand{\cgA}{\mathcal{A}} \newcommand{\cgB}{\mathcal{B}} \newcommand{\cgC}{\mathcal{C}} \newcommand{\cgD}{\mathcal{D}} \newcommand{\cgE}{\mathcal{E}} \newcommand{\cgF}{\mathcal{F}} \newcommand{\cgG}{\mathcal{G}} \newcommand{\cgM}{\mathcal{M}} \newcommand{\cgN}{\mathcal{N}} \newcommand{\cgP}{\mathcal{P}} \newcommand{\cgR}{\mathcal{R}} \newcommand{\cgS}{\mathcal{S}} \newcommand{\bfn}{\mathbf{n}} \newcommand{\bfm}{\mathbf{m}} \newcommand{\bfk}{\mathbf{k}} \newcommand{\bfs}{\mathbf{s}} \newcommand{\bijection}{\xrightarrow[\text{onto}]{\text{$1$--$1$}}} \newcommand{\injection}{\xrightarrow[]{\text{$1$--$1$}}} \newcommand{\surjection}{\xrightarrow[\text{onto}]{}} \newcommand{\nin}{\not\in} \newcommand{\prufer}{\mbox{prüfer}} \DeclareMathOperator{\fix}{fix} \DeclareMathOperator{\stab}{stab} \DeclareMathOperator{\var}{var} \newcommand{\inv}{^{-1}} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section16.3Markov Chains

We begin this section with a motivational example. Consider the connected graph on six vertices shown in <<fig-markovchain>>. The first move is to choose a vertex at random and move there. Afterwards, we follow the following recursive procedures. If after \(i\) moves, you are at a vertex \(x\) and \(x\) has \(d\) neighbors, choose one of the neighbors at random, with each having probability \(1/d\) and move there. We then attempt to answer questions of the following flavor:

  1. For each vertex \(x\text{,}\) let \(p_{x,m}\) denote the probability that you are at vertex \(x\) after \(m\) moves. Does \(\lim_{m\rightarrow\infty}p_{x,m}\) exist and if so, how fast does the sequence converge to this limit?

  2. How many moves must I make in order that the probability that I have walked on every edge in the graph is at least \(0.999\text{?}\)

This example illustrates the characteristics of an important class of computational and combinatorial problems, which are collectively referred to as Markov Chains:

  1. There is a finite set of states \(S_1\text{,}\) \(S_2,\dots,S_n\text{,}\) and at time \(i\text{,}\) you are in one of these states.

  2. If you are in state \(S_j\) at time \(i\text{,}\) then for each \(k=1,2,\dots,n\text{,}\) there is a fixed probability \(p(j,k)\) (which does not depend on \(i\)) that you will be in state \(S_k\) at time \(i+1\text{.}\)

The \(n\times n\) matrix \(P\) whose \(j,k\) entry is the probability \(p(j,k)\) of moving from state \(S_j\) to state \(S_k\) is called the transition matrix of the Markov chain. Note that \(P\) is a stochastic matrix, i.e., all entries are non-negative and all row sums are \(1\text{.}\) Conversely, each square stochastic matrix can be considered as the transition matrix of a Markov chain.

For example, here is the transition matrix for the graph in <<fig-markovchain>>.

\begin{equation} P =\begin{pmatrix}0 \amp 1/4 \amp 1/4 \amp 1/4 \amp 1/4 \amp 0 \\ 1/2 \amp 0 \amp 0 \amp 1/2 \amp 0 \amp 0 \\ 1/3 \amp 0 \amp 0 \amp 1/3 \amp 0 \amp 1/3 \\ 1/3 \amp 1/3 \amp 1/3 \amp 0 \amp 0 \amp 0 \\ 1 \amp 0 \amp 0 \amp 0 \amp 0 \amp 0 \\ 0 \amp 0 \amp 1 \amp 0 \amp 0 \amp 0 \\ \end{pmatrix} \tag{16.3.1} \end{equation}

A transition matrix \(P\) is regular if there is some integer \(m\) for which the matrix \(P^m\) has only positive entries. Here is a fundamental result from this subject, one that is easy to understand but a bit too complex to prove given our space constraints.

Given the statement of Theorem 16.9, the computation of the row vector \(W\) can be carried out by eigenvalue techniques that are part of a standard undergraduate linear algebra course. For example, the transition matrix \(P\) displayed in (16.3.1) is regular since all entries of \(P^3\) are positive. Furthermore, for this matrix, the row vector \(W=(5/13, 3/13, 2/13, 2/13, 1/13, 1/13)\text{.}\) However, the question involving how fast the convergence of \(P^m\) is to this limiting vector is more subtle, as is the question as to how long it takes for us to be relatively certain we have made every possible transition.

Subsection16.3.1Absorbing Markov Chains

A state \(S_i\) in a Markov chain with transition matrix \(P\) is absorbing if \(p_{i,i}=1\) and \(p_{i,j}=0\) for all \(j\neq i\text{,}\) i.e., like the infamous Hotel California, once you are in state \(S_i\text{,}\) “you can never leave.”

Example16.10

We modify the transition matrix from (16.3.1) by making states \(4\) and \(5\) absorbing. The revised transition matrix is now:

\begin{equation} P =\begin{pmatrix}0 \amp 1/4 \amp 1/4 \amp 1/4 \amp 1/4 \amp 0 \\ 1/2 \amp 0 \amp 0 \amp 1/2 \amp 0 \amp 0 \\ 1/3 \amp 0 \amp 0 \amp 1/3 \amp 0 \amp 1/3 \\ 1/3 \amp 1/3 \amp 1/3 \amp 0 \amp 0 \amp 0 \\ 0 \amp 0 \amp 0 \amp 0 \amp 1 \amp 0 \\ 0 \amp 0 \amp 0 \amp 0 \amp 0 \amp 1 \\ \end{pmatrix} \tag{16.3.2} \end{equation}

Now we might consider the following game. Start at one of the four vertices in \(\{1,2,3,4\}\) and proceed as before, making moves by choosing a neighbor at random. Vertex \(4\) might be considered as an “escape” point, a safe harbor that once reached is never left. On the other hand, vertex \(5\) might be somewhere one meets a hungry tiger and be absorbed in a way not to be detailed here.

We say the Markov chain is absorbing if there is at least one absorbing state and for each state \(S_j\) that is not absorbing, it is possible to reach an absorbing state—although it may take many steps to do so. Now the kinds of questions we would like to answer are:

  1. If we start in non-absorbing state \(S_i\text{,}\) what is the probability of reaching absorbing state \(S_j\) (and then being absorbed in that state, a question which takes on genuine unpleasantness relative to tigers)?

  2. If we are absorbed in state \(S_j\text{,}\) what is the probability that we started in non-absorbing state \(S_i\text{?}\)

  3. If we start in non-absorbing state \(S_i\text{,}\) what is the expected length of time before we will be absorbed?