A Markov process is a random process in which the future is independent of the past, given the present. Markov processes, named for Andrei Markov are among the most important of all random processes. In a sense, they are the stochastic analogs of differential equations and recurrence relations, which are of course, among the most important deterministic processes.

Suppose that
$X=\{X_{t}\colon t\in T\}$
is a random process on a probability space
$\left(\begin{array}{c}\Omega \\ F\\ \end{array}\right)$
where
$X_{t}$
is a random variable
taking values in
$S$ for each
$t\in T$.
We think of
$X_{t}$
as the state of a system at time
$t$. The state space
$S$ is usually either a countable set or a nice

region of
$\mathbb{R}^{k}$
for some
$k$. The time space
$T$ is either
$\mathbb{N}$
or
$\left[0 , \infty \right)$.

For $t\in T$, let $F_{t}$ denote the $\sigma $-algebra of events generated by $\{X_{s}\colon s\in T\land (s\le t)\}$. Intuitively, $F_{t}$ contains the events that can be defined in terms of $X_{s}$ for $s\le t$. In other words, if we are allowed to observe the random variables $X_{s}$ for $s\le t$, then we can tell whether or not a given event in $F_{t}$ has occurred.

The random process $X$ is a Markov process if the following property (known as the Markov property) holds: For every $s\in T$ and $t\in T$ with $s< t$, and for every $H\in F_{s}$ and $x\in S$, the conditional distribution of $X_{t}$ given $H$ and $X_{s}=x$ is the same as the conditional distribution of $X_{t}$ just given $X_{s}=x$:

$$(X_{t}\in A, HX_{s}=x)=(X_{t}\in A, X_{s}=x)\text{,\hspace{1em}}A\subseteq S$$In the statement of the Markov property, think of $s$ as the present time and hence $t$ is a time in the future. Thus, $x$ is the present state and $H$ is an event that has occurred in the past. If we know the present state, then any additional knowledge of events in the past is irrelevant in terms of predicting the future.

The complexity of Markov processes depends greatly on whether the time space or the state space are discrete or continuous. In this chapter, we assume both are discrete, that is we assume that $T=\mathbb{N}$ and that $S$ is countable (and hence the state variables have discrete distributions). In this setting, Markov processes are known as Markov chains. The theory of Markov chains is very beautiful and very complete.

The Markov property for a Markov chain $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ \end{array}\right)$ can be stated as follows: for any sequence of states $\left(\begin{array}{c}x_{0}\\ x_{1}\\ \\ x_{n-1}\\ x\\ y\end{array}\right)$,

$$(X_{n+1}=y, X_{0}=x_{0}X_{1}=x_{1}X_{n-1}=x_{n-1}X_{n}=x)=(X_{n+1}=y, X_{n}=x)$$Suppose that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is a Markov chain with state space $S$. As before, let $F_{n}$ is the $\sigma $-algebra generated by $\left(\begin{array}{c}X_{0}\\ X_{1}\\ \\ X_{n}\end{array}\right)$ for each $n\in \mathbb{N}$. A random variable $T$ taking values in $\mathbb{N}\cup \{\infty \}$ is a stopping time or a Markov time for $X$ if $\{T=n\}\in F_{n}$ for each $n\in \mathbb{N}$. Intuitively, we can tell whether or not $T=n$ by observing the chain up to time $n$. In some sense, a stopping time is a random time that does not require that we see into the future.

Suppose that $T$ is a stopping time for $X$. Show that for $n\in \mathbb{N}$,

- $\{T\le n\}\in F_{n}$
- $\{T> n\}\in F_{n}$

The quintessential example of a stopping time is the hitting time to a nonempty set of states $A$:

$$T_{A}=\min\{X_{n}\in A\mid X_{n}\in A\}$$where as usual, we define $\mathrm{min}(\emptyset )=\infty $. This random variable gives the first positive time that the chain is in $A$.

Show that $T_{A}$ is a stopping time for $X$: $\{T_{A}=n\}=\{X_{1}\notin A, , X_{n-1}\notin A, X_{n}\in A\}$

The strong Markov property states that the future is independent of the past, given the present, when the present time is a stopping time. For a Markov chain, the ordinary Markov property implies the strong Markov property.

$$(X_{T+1}=y, X_{0}=x_{0}X_{1}=x_{1}X_{T}=x)=(X_{T+1}=y, X_{T}=x)$$The study of Markov chains is simplified by the use of operator notation that is analogous to operations on vectors and matrices. Suppose that $(U, S\times S, \mathbb{R})$ and $(V, S\times S, \mathbb{R})$ and that $(f, S, \mathbb{R})$ and $(g, S, \mathbb{R})$. Define $(UV, S\times S, \mathbb{R})$ by

$$(UV)(x, z)=\sum_{y\in S} U(x, y)V(y, z)\text{,\hspace{1em}}\left(\begin{array}{c}x\\ y\end{array}\right)\in S^{2}$$Define $(Uf, S, \mathbb{R})$ by

$$(Uf)(x)=\sum_{y\in S} U(x, y)f(y)\text{,\hspace{1em}}x\in S$$and define $(fU, S, \mathbb{R})$ by

$$(fU)(y)=\sum_{x\in S} f(x)U(x, y)\text{,\hspace{1em}}y\in S$$Finally, we will sometimes let $fg$ denote the real number

$$fg=\sum_{x\in S} f(x)g(x)$$In all of the definitions, we assume that if $S$ is infinite then the either the terms in the sums are nonnegative or the sums converge absolutely, so that the order of the terms in the sums does not matter. We will often refer to a function $(U, S\times S, \mathbb{R})$ as a matrix on $S$. Indeed, if $S$ is finite, then $U$ really is a matrix in the usual sense, with rows and columns labeled by the elements of $S$. The product $UV$ is ordinary matrix multiplication; the product $Uf$ is the product of the matrix $U$ and the column vector $f$; the product $fU$ is the product of the row vector $f$ and the matrix $U$; and the product $fg$ is he product of $f$ as a row vector and $g$ as a column vector, or equivalently, the inner product of the vectors $f$ and $g$.

The sum of two matrices on $S$ or two functions on $S$ is defined in the usual way, as is a real multiple of a matrix or function.

In the following exercises, suppose that $U$, $V$, and $W$ are matrices on $S$ and that $f$ and $g$ are functions on $S$. Assume also that the sums exist.

Show that the associate property holds whenever the operations makes sense. In particular,

- $UVW=UVW$
- $UVf=UVf$ and $fUV=fUV$
- $fUg=fUg$,

Show that the distributive property holds whenever the operations makes sense. In particular,

- $U(V+W)=UV+UW$ and $(U+V)W=UW+VW$
- $f(U+V)=fU+fV$ and $(U+V)f=Uf+Vf$
- $U(f+g)=Uf+Ug$ and $(f+g)U=fU+gU$

The commutative property does not hold in general. Give examples where

- $UV\neq VU$
- $fU\neq Uf$

If $U$ is a matrix on $S$ we denote $U^{n}=UUU$, the $n$-fold (matrix) power of $U$ for $n\in \mathbb{N}$. By convention, $U^{0}=I$, the identity matrix on $S$, defined by

$$\mathrm{id}(x, y)=\begin{cases}1 & \text{if $x=y$}\\ 0 & \text{if $x\neq y$}\end{cases}$$If $U$ is a matrix on $S$ and $A\subseteq S$, we will let $U_{A}$ denote the restriction of $U$ to $A\times A$. Similarly, if $f$ is a function on $S$, then $f_{A}$ denotes the restriction of $f$ to $A$.

If $(f, S, \left[0 , \infty \right))$, then $f$ is a discrete probability density function (or probability mass function) on $S$ if

$$\sum_{x\in S} f(x)=1$$We have studied these in detail! On the other hand, if $(P, S\times S, \left[0 , \infty \right))$, then $P$ is a transition probability matrix or stochastic matrix on $S$ if

$$\sum_{y\in S} P(x, y)=1\text{,\hspace{1em}}x\in S$$Thus, if $P$ is a transition matrix, then $(y, P(x, y))$ is a probability density function on $S$ for each $x\in S$. In matrix terminology, the row sums are 1.

Show that if $P$ is a transition probability matrix on $S$ then $P\times 1=1$ where $1$ is the constant function 1 on $S$. Thus, in the language of linear algebra, $1$ is a right eigenvector of $P$, corresponding to the eigenvalue 1.

Suppose that $P$ and $Q$ are transition probability matrices on $S$ and that $f$ is a probability density function on $S$. Show that

- $PQ$ is a transition probability matrix.
- $P^{n}$ is a transition probability matrix for each $n\in \mathbb{N}$
- $fP$ is a probability density function.

Suppose that $f$ is the probability density function of a random variable $X$ taking values in $S$ and that $(g, S, \mathbb{R})$. Show that $fg=(g(X))$ (assuming that the expected value exists).

A function $f$ on $S$ is said to be left-invariant for a transition probability matrix $P$ if $fP=f$. In the language of linear algebra, $f$ is a left eigenvector of $P$ corresponding to the eigenvalue 1.

Show that if $f$ is left-invariant for $P$ then $fP^{n}=f$ for each $n\in \mathbb{N}$.

Suppose again that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is a Markov chain with state space $S$. For $m\in \mathbb{N}$ and $m\in \mathbb{N}$ with $m\le n$, let

$$P_{m, n}(x, y)=(X_{n}=y, X_{m}=x)\text{,\hspace{1em}}x\in S\text{,\hspace{0.5em}}y\in S$$The matrix $P_{m, n}$ is the transition probability matrix from time $m$ to time $n$. The result in the next exercise is known as the Chapman-Kolmogorov equation, named for Sydney Chapman and Andrei Kolmogorov. It gives the basic relationship between the transition matrices.

Suppose that $k$, $m$, and $n$ are nonnegative integers with $k\le m\le n$. Use basic properties of conditional probability and the Markov property to show that

$$P_{k, m}P_{m, n}=P_{k, n}$$.It follows immediately that all of the transition probability matrices for $X$ can be obtained from the one-step transition probability matrices: if $m$ and $n$ are nonnegative integers with $m\le n$ then

$$P_{m, n}=P_{m, m+1}P_{m+1, m+2}P_{n-1, n}$$.Suppose that $m$ and $n$ are nonnegative integers with $m\le n$. Show that if $X_{m}$ has probability density function $f_{m}$, then $X_{n}$ has probability density function $f_{n}=f_{m}P_{m, n}$.

Combining the last two results, it follows that the distribution of
$X_{0}$
(the initial distribution) and the one-step transition matrices determine the distribution of
$X_{n}$
for each
$n$. Actually, these basic quantities determine the *joint distributions* of the process, a much stronger result.

Suppose that $X_{0}$ has probability density function $f_{0}$. Show that for any sequence of states $\left(\begin{array}{c}x_{0}\\ x_{1}\\ \\ x_{n}\end{array}\right)$,

$$(X_{0}=x_{0}, X_{1}=x_{1}, , X_{n}=x_{n})=f_{0}(x_{0})P_{0, 1}(x_{0}, x_{1})P_{n-1, n}(x_{n-1}, x_{n})$$Computations of this sort are the reason for the term *chain* in Markov chain.

A Markov chain $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is said to be time homogeneous if the transition matrix from time $m$ to time $n$ depends only on the difference $n-m$ for any nonnegative integers $m$ and $n$ with $m\le n$. That is,

$$(X_{n}=y, X_{m}=x)=(X_{n-m}=y, X_{0}=x)\text{,\hspace{1em}}x\in S\text{,\hspace{0.5em}}y\in S$$It follows that there is a single one-step transition probability matrix $P$, given by

$$P(x, y)=(X_{n+1}=y, X_{n}=x)\text{,\hspace{1em}}x\in S\text{,\hspace{0.5em}}y\in S$$and all other transition matrices can be expressed as powers of $P$. Indeed if $m\le n$ then $P_{m, n}=P^{(n-m)}$, and the Chapman-Kolmogorov equation is simply the law of exponents for matrix powers. From Exercise 11, if $X_{m}$ has probability density function $f_{m}$ then $f_{n}=f_{m}P^{(n-m)}$ is the probability density function of $X_{n}$. In particular, if $X_{0}$ has probability density function $f_{0}$ then $f_{n}=f_{0}P^{n}$ is the probability density function of $X_{n}$. The joint distribution in Exercise 12 above also simplifies: if $X_{0}$ has probability density function $f_{0}$, then for any sequence of states $\left(\begin{array}{c}x_{0}\\ x_{1}\\ \\ x_{n}\end{array}\right)$,

$$(X_{0}=x_{0}, X_{1}=x_{1}, , X_{n}=x_{n})=f_{0}(x_{0})P(x_{0}, x_{1})P(x_{n-1}, x_{n})$$Suppose that
$X_{0}$
has probability density function
$f$ and that
$f$ is left-invariant for
$P$. Show that
$X_{n}$
has probability density function
$f$ for each
$n\in \mathbb{N}$
and hence the sequence of random variables
$X$ is identically distributed (although certainly **not** independent in general).

In the context of the previous exercise, the probability distribution on $S$ associated with $f$ is said to be invariant or stationary for $P$ or for the Markov chain $X$. Stationary distributions turn out to be of fundamental importance in the study of the limiting behavior of Markov chains.

The assumption of time homogeneity is not as restrictive as might first appear. The following exercise shows that *any* Markov chain can be turned into a homogeneous chain by enlarging the state space with a time component.

Suppose that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is an inhomogeneous Markov chain with state space $S$, and let $Q_{n}(x, y)=(X_{n+1}=y, X_{n}=x)$ denote the one-step transition probability at time $n$, for $x\in S$ and $y\in S$. Suppose that $N_{0}$ is a random variable taking values in $\mathbb{N}$, independent of $X$. Let $N_{n}=N_{0}+n$ and let $Y_{n}=\left(\begin{array}{c}X_{N_{n}}\\ N_{n}\end{array}\right)$ for $n\in \mathbb{N}$. Show that $Y=\left(\begin{array}{c}Y_{0}\\ Y_{1}\\ Y_{2}\\ \end{array}\right)$ is a homogeneous Markov chain on $S\times \mathbb{N}$ with transition probability matrix $P$ given by

$$P(\left(\begin{array}{c}x\\ m\end{array}\right), \left(\begin{array}{c}y\\ n\end{array}\right))=\begin{cases}Q_{m}(x, y) & \text{if $n=m+1$}\\ 0 & \text{otherwise}\end{cases}$$From now on, unless otherwise noted, the term *Markov chain* will mean homogeneous Markov chain.

Suppose that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is an Markov chain with state space $S$ and transition probability matrix $P$. For fixed $k\in \mathbb{N}$, show that $\left(\begin{array}{c}X_{0}\\ X_{k}\\ X_{2k}\\ \end{array}\right)$ is a Markov chain on $S$ with transition probability matrix $P^{k}$.

The following exercise also uses the basic trick of enlarging the state space to turn a random process into a Markov chain.

Suppose that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is a random process on $S$ in which the future depends stochastically on the last two states. Specifically, suppose that for any sequence of states $\left(\begin{array}{c}x_{0}\\ x_{1}\\ \\ x_{n-1}\\ x\\ y\\ z\end{array}\right)$

$$(X_{n+2}=z, X_{0}=x_{0}X_{1}=x_{1}X_{n-1}=x_{n-1}X_{n}=xX_{n+1}=y)=(X_{n+2}=z, X_{n}=xX_{n+1}=y)$$We also assume that this probability is independent of $n$, and we denote it by $Q(x, y, z)$. Let $Y_{n}=\left(\begin{array}{c}X_{n}\\ X_{n+1}\end{array}\right)$ for $n\in \mathbb{N}$. Show that $Y=\left(\begin{array}{c}Y_{0}\\ Y_{1}\\ Y_{2}\\ \end{array}\right)$ is a Markov chain on $S\times S$ with transition probability matrix $P$ given by

$$P(\left(\begin{array}{c}x\\ y\end{array}\right), \left(\begin{array}{c}w\\ z\end{array}\right))=\begin{cases}Q(x, y, z) & \text{if $y=w$}\\ 0 & \text{otherwise}\end{cases}$$The result in the last exercise generalizes in a completely straightforward way to the case where the future of the random process depends stochastically on the last $k$ states, for some fixed $k\in \mathbb{N}$.

Suppose again that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is a Markov chain with state space $S$ and transition probability matrix $P$. The directed graph associated with $X$ has vertex set $S$ and edge set $\{\left(\begin{array}{c}x\\ y\end{array}\right)\in S^{2}\colon P(x, y)> 0\}$. That is, there is a directed edge from $x$ to $y$ if and only if state $x$ leads to state $y$ in one step. Note that the graph may well have loops, since a state can certainly lead back to itself in one step.

Suppose that $A$ is a nonempty subset of $S$. Show that

$$P_{A}^{n}(x, y)=(X_{1}\in A, X_{2}\in A, , X_{n-1}\in A, X_{n}=y, X_{0}=x)\text{,\hspace{1em}}\left(\begin{array}{c}x\\ y\end{array}\right)\in A^{2}$$That is, $P_{A}^{n}(x, y)$ is the probability of going from state $x$ to state $y$ in $n$ steps, remaining in $A$ all the while. In graphical terms, it is the sum of products of probabilities along paths of length $n$ from $x$ to $y$ that stay inside $A$. Note that in general, $P_{A}^{n}(x, y)\neq P^{n}_{A}(x, y)$.

Perhaps the simplest, non-trivial Markov chain has two states, say $S=\{0, 1\}$ and the transition probability matrix given below, where $p$ and $q$ are parameters with $0< p< 1$ and $0< q< 1$.

$$P=\begin{pmatrix}1-p & p\\ q & 1-q\end{pmatrix}$$Show that the eigenvalues of $P$ are 1 and $1-p-q$.

Show that $B^{(-1)}PB=D$ where

$$B=\begin{pmatrix}1 & -p\\ 1 & q\end{pmatrix}\text{\hspace{0.5em}and\hspace{0.5em}}D=\begin{pmatrix}1 & 0\\ 0 & 1-p-q\end{pmatrix}$$.Show that

$$P^{n}=BD^{n}B^{(-1)}=\frac{1}{p+q}\begin{pmatrix}q+p(1-p-q)^{n} & p-p(1-p-q)^{n}\\ q-q(1-p-q)^{n} & p+q(1-p-q)^{n}\end{pmatrix}$$Show that

$$P^{n}\to \frac{1}{p+q}\begin{pmatrix}q & p\\ q & p\end{pmatrix}\text{\hspace{0.5em}as\hspace{0.5em}}n\to \infty $$Show that the only invariant probability density function for the chain is $f=\left(\begin{array}{c}\frac{q}{p+q}\\ \frac{p}{p+q}\end{array}\right)$.

In spite of its simplicity, the two state chain illustrates some of the basic limiting behavior and the connection with invariant distributions that we will study in general in a later section.

Suppose that $X=\left(\begin{array}{c}X_{0}\\ X_{1}\\ X_{2}\\ \end{array}\right)$ is a sequence of independent random variables taking values in a countable set $S$, and that $\left(\begin{array}{c}X_{1}\\ X_{2}\\ X_{3}\\ \end{array}\right)$ are identically distributed with (discrete) probability density function $f$.

Show that $X$ is a Markov chain on $S$ with transition probability matrix $P$ given by $P(x, y)=f(y)$ for $x\in S$ and $y\in S$. Show also that $f$ is invariant for $P$.

As a Markov chain, the process
$X$ is not very interesting, although it is *very* interesting in other ways. Suppose now that
$S=\mathbb{Z}$,
the set of integers, and consider the partial sum process (or random walk)
$Y$ associated with
$X$:

Show that $Y$ is a Markov chain on $\mathbb{Z}$ with transition probability matrix $Q$ given by $P(x, y)=f(y-x)$ for $x\in \mathbb{Z}$ and $y\in \mathbb{Z}$.

Consider the special case where $f(1)=p$ and $f(-1)=1-p$, where $0< p< 1$. Show that the transition probability matrix is given by

$$Q(x, x-1)=1-p\text{,\hspace{0.5em}}Q(x, x+1)=p\text{,\hspace{1em}}x\in \mathbb{Z}$$This special case is the simple random walk on $\mathbb{Z}$. When $p=1/2$ we have the simple, symmetric random walk. Simple random walks are studied in more detail in the chapter on Bernoulli Trials.

A matrix
$P$ on
$S$ is doubly stochastic if it is nonnegative and if the row *and* columns sums are 1:

Suppose that $X$ is a Markov chain on a finite state space $S$ with doubly stochastic transition probability matrix $P$. Show that the uniform distribution on $S$ is invariant.

A matrix $P$ on $S$ is symmetric if $P(x, y)=P(y, x)$ for all $\left(\begin{array}{c}x\\ y\end{array}\right)\in S^{2}$.

- Show that if $P$ is a symmetric, stochastic matrix then $P$ is doubly stochastic.
- Give an example of a doubly stochastic matrix that is not symmetric.

The Markov chains in the following exercises model important processes that are studied in separate sections. We will refer to these chains frequently.

Read the introduction to the Ehrenfest chains and work the exercises.

Read the introduction to the Bernoulli-Laplace chain and work the exercises.

Read the introduction to the reliability chains and work the exercises.

Read the introduction to the branching chain and work the exercises.

Read the introduction to the queuing chains and work the exercises.

Read the introduction to random walks on graphs and work the exercises.

Read the introduction to birth-death chains and work the exercises.