IB Markov Chain

Definition of Markov chain open_in_new

Definition (Markov chain) open_in_new

A sequence $\ouline{X} = (X_n)_{n\geq 0}$ of random variables taking values in a discrete (finite or countably finite) set $I$ is called a Markov chain with state space $I$ if for all $x_0, x_1, \ldots, x_n, x_{n+1}\in I$, $$ \begin{align*} \prob(X_{n+1} = x_{n+1} | X_n = x_n, \ldots, X_0 = x_0) = \prob(X_{n+1} = x_{n+1} | X_n = x_n). \end{align*} $$

More generally, for a measurable space $\mathcal{X}$, $\ouline{X}$ is a Markov chain taking value in $\mathcal{X}$ if $$ \begin{align*} \prob(X_{n+1} \in B \mid X_n = x_n, \ldots, X_0 = x_0) = K(x_n, B) \end{align*} $$ for some function $K$ called the Markov kernel such that

  1. $K(t, \cdot)$ is a probability measure for all $t\in \mathcal{X}$;

  2. $t \mapsto K(t, B)$ is measurable for all $B\in \mathcal{X}$ measurable.

The future $X_{n + 1}$ only depends on the present state $X_n$, not the past $X_{n - 1}, \ldots, X_{0}$.

Definition (time-homogenous Markov chain) open_in_new

A Markov chain $\ouline{X} = (X_n)_{n\geq 0}$ with state space $I$ is time-homogenous if $$ \begin{align*} \prob(X_{n+1} = y | X_n = x) = p_{xy} \end{align*} $$ for some $P = (p_{xy})_{x,y\in I}$ called the transition matrix.

  • $P$ is called a stochastic matrix because each row is a probability distribution on $I$, i.e. $p_{xy} \geq 0$ and $\sum_{y\in I} p_{xy} = 1$.

We will consider only time-homogenous Markov chains in this course.

Definition (Markov(lambda, P)) open_in_new

We say a random process (sequence of random variables) $\ouline{X} = (X_n)_{n\geq 0}$ with values in $I$ is $\mathrm{Markov}(\lambda, P)$ if it has initial distribution $\lambda$ and transition matrix $P$, i.e. if

  • $\prob(X_0 = x_0) = \lambda_{x_0}$ for all $x_0 \in I$; and

  • $\prob(X_{n+1} = x_{n+1} | X_n = x_n, \ldots, X_0 = x_0) = P(x_n, x_{n+1})$ for all $n\geq 0$ and $x_0, \ldots, x_n, x_{n+1}\in I$.

Theorem (condition for process to be Markov) open_in_new

Let $\ouline{X} = (X_n)_{n\geq 0}$ be a random process taking values in $I$.

$\ouline{X} \sim$ $\mathrm{Markov}(\lambda, P)$ iff for all $n\geq 0$ and $x_0, x_1, \ldots, x_n\in I$, $$ \begin{align*} \prob(X_0 = x_0, X_1 = x_1, \ldots, X_n = x_n) = \lambda_{x_0} P(x_0, x_1) P(x_1, x_2) \ldots P(x_{n-1}, x_{n}). \end{align*} $$

Proof

Definition (independent processes) open_in_new

Two processes $\ouline{X} = (X_n)_{n\geq 0}$ and $\ouline{Y} = (Y_n)_{n\geq 0}$ are said to be independent if for any $0\leq t_1 < t_2 < \ldots < t_k$ and $0 \leq s_1 < s_2 < \ldots < s_l$, the random variables $(X_{t_1}, X_{t_2}, \ldots, X_{t_k})$ are independent of $(Y_{s_1}, Y_{s_2}, \ldots, Y_{s_l})$.

Theorem (simple Markov property) open_in_new

Suppose $\ouline{X} \sim$ $\mathrm{Markov}(\lambda, P)$ on $I$. Fix some $i\in I$ and $m\geq 0$.

Then conditional on $\set{X_m = i}$, the new process $(X_{m+n})_{n\geq 0} \sim \mathrm{Markov}(\delta_i, P)$, where $\delta_i$ is the distribution given by $\delta_{ij} = \mathbb{1}(j=i)$. And it is independent of $(X_0, \ldots, X_m)$.

Proof

Theorem (power of transition matrix) open_in_new

Suppose $\ouline{X} \sim$ $\mathrm{Markov}(\lambda, P)$. Then

  1. $\prob(X_n = x) = (\lambda P^n)_x$ for all $x\in I$ (here $\lambda$ is a row vector);

  2. $\prob(X_{m+n} = y | X_{m} = x) = (P^n)_{xy} := p_{xy}(n)$ for all $m\geq 0$ and $x,y\in I$.

Proof

Method to compute powers of the transition matrix open_in_new

Here is a quick(ish) method to compute $p_{11}(n)$:

If $P$ has $k=|I|$ distinct eigenvalues, then it is diagonalisable: $P^n = U\op{diag}(\lambda_1^n, \ldots, \lambda_k^n) U\inv$, so $$ \begin{align*} p_{11}(n) = (P^n)_{11} = a_1 \lambda_1^n + a_2 \lambda_2^n + \ldots + a_k \lambda_k^n. \end{align*} $$ So we can compute $P^n$ for small values of $n$, and then solve for $a_1, \ldots, a_k$.

If there are repeated eigenvalues, e.g. $\lambda$ is repeated $m$ times, then we use the Jordan normal form instead and we have the term $(b_0 + b_1 n + \ldots + b_{m-1} n^{m-1}) \lambda^n$.

If there are complex eigenvalues, they come in conjugate pairs, e.g. $re^{i\theta}$ and $re^{-i\theta}$, and since $p_{11}(n)$ is real, these two eigenvalues will give the terms $ar^n\cos(n\theta) + br^n\sin(n\theta)$.

Examples

Definition (leads to, communicate) open_in_new

Let $\ouline{X}$ is a Markov chain with a transition matrix $P$ on $I$, and $x,y\in I$.

We say $x$ leads to $y$ (denoted as $x\to y$) if $$ \begin{align*} \prob(X_n = y\text{ for some } n\geq 0 | X_0 = x) > 0. \end{align*} $$ We say $x$ and $y$ communicate (denoted as $x\leftrightarrow y$) if $x\to y$ and $y\to x$.

Theorem (equivalent conditions for x leading to y) open_in_new

Let $\ouline{X}$ be a Markov chain with a transition matrix $P$. The following are equivalent:

  1. $x$ $\to$ $y$;

  2. there exists $n\geq 0$ and a sequence of states $x_0 = x, x_1, x_2, \ldots, x_k = y$ such that $P(x_i, x_{i+1}) > 0$ for all $i=0, \ldots, k-1$.

  3. $p_{xy}(n)$ $> 0$ for some $n\geq 0$.

Proof

Definition (communicating classes, closed class, irreducible chain, absorbing state) open_in_new

Let $\ouline{X}$ be a Markov chain on $I$.

  • The equivalence classes induced by "$\leftrightarrow$" on $I$ are called communicating classes.

  • A communicating class $A\subseteq I$ is said to be closed if whenever $x$ $\to$ $y$ for $x\in A$ and $y\in I$, we must have $y\in A$.

  • $\ouline{X}$ (or its transition matrix) is said to be irreducible if there is a single communicating class.

  • A state $x$ is absorbing iff $\set{x}$ is a closed communicating class, or equivalently, if $P(x,x) = 1$.

Hitting time and hitting probability open_in_new

Definition (hitting time, hitting probability) open_in_new

Let $\ouline{X}$ be a Markov chain on $I$, and $A\subseteq I$.

  • The first hitting time of $A$ is the random variable $$ \begin{align*} T_A = \inf\sb{n\geq 0}{X_n \in A} \in \set{0,1,2,\ldots,\infty}. \end{align*} $$ We use the convention that if $X_n\not\in A$ for all $n\geq 0$, then $T_A = \infty$.

  • The hitting probability of $A$ is the function $h^A: I \to [0,1]$ given by $$ \begin{align*} h^A_i = \prob(T_A < \infty | X_0 = i). \end{align*} $$

  • The mean hitting time of $A$ is the function $k^A: I\to[0,\infty]$ given by $$ \begin{align*} k^A_i = \expect(T_A | X_0 = i) = \sum_{n=0}^{\infty} n\cdot\prob(T_A = n | X_0 = i) + \infty \cdot \prob_i(T_A = \infty). \end{align*} $$

Theorem (linear equations for hitting probability) open_in_new

Consider a Markov chain on $I$ with a transition matrix $P$, and let $A\subseteq I$.

The hitting probability $(h_i^A)_{i\in I}$ is the minimal non-negative solution to the system of linear equations $$ \begin{align*} h_i^A = \begin{cases} 1, &\text{if }i\in A,\\ \sum_{j\in I} P(i,j) h_j^A = (Ph^A)_i, &\text{if } i\not\in A, \end{cases} \end{align*} $$ i.e. if $(h_i)_{i\in A}$ is another non-negative solution, then $h_i^A \leq h_i$ for all $i\in I$.

Proof

Theorem (linear equations for mean hitting time) open_in_new

Consider a Markov chain on $I$ with a transition matrix $P$, and $A\subseteq I$.

The mean hitting time $(k_i^A)_{i\in I}$ is the minimal non-negative solution to the system of linear equations $$ \begin{align*} k_i^A = \begin{cases} 0, &\text{if } i \in A, \\ 1 + \sum_{j\not\in A} P(i,j) \,k_j^A, &\text{if }i\not\in A. \end{cases} \end{align*} $$

Proof

Definition (stopping time) open_in_new

Let $\ouline{X} = (X_n)_{n\geq 0}$ be a random process, and let $T$ be a random variable taking values in $\set{0,1,2,\ldots} \cup \set{\infty}$.

We say $T$ is a stopping time with respect to $\ouline{X}$ if for each $n$, the event $\set{T=n}$ only depends on $X_0, X_1, \ldots, X_n$.

Theorem (strong Markov property) open_in_new

Suppose $\ouline{X} = (X_n)_{n\geq 0} \sim$ $\mathrm{Markov}(\lambda, P)$ on $I$. Let $T$ be a stopping time and $i\in I$.

Then conditional on $\set{T<\infty} \cap \set{X_T = i}$, the process $(X_{T+n})_{n\geq 0}\sim \mathrm{Markov}(\delta_i, P)$ and is independent of $(X_0, X_1, \ldots, X_T)$.

Proof

Example (hitting probability in simple random walk using strong Markov property)

Transience and recurrence open_in_new

Definition (transience and recurrence) open_in_new

Suppose $\ouline{X} = (X_n)_{n\geq 0}$ is a Markov chain on $I$ with transition matrix $P$.

We say a state $i\in I$ is

  • recurrent if $\prob(X_n = i \text{ for infinitely many } n | X_0 = i) = 1$;

  • transient if $\prob(X_n = i \text{ for infinitely many } n | X_0 = i) = 0$.

We say $P$ is recurrent/transient if all states are recurrent/transient.

Definition (return times) open_in_new

Suppose $\ouline{X} = (X_n)_{n\geq 0}$ is a Markov chain on $I$.

The return times $T_i^{(k)}$ for $i\in I$ are defined inductively as $$ \begin{align*} T_i^{(0)} = 0, \qquad T_i^{(k+1)} = \inf \sb{n>T_i^{(k)}}{X_n = i}. \end{align*} $$ and write $T_i = T_i^{(1)}$ as the first return time.

Lemma (probability for number of visits) open_in_new

Define, for $i\in I$, the total number of visits $$ \begin{align*} V_i = \sum_{n=0}^{\infty} \mathbb{1}(X_n = i). \end{align*} $$ For all $r\geq 0$, $$ \begin{align*} \prob(V_i > r | X_0 = i) = \big(\prob(T_i < \infty| X_0 = i)\big)^r. \end{align*} $$

Proof

Theorem (state is either recurrent or transient) open_in_new

Consider a Markov chain on $I$ with transition matrix $P$, and let $i\in I$.

  1. If $\prob(T_i < \infty | X_0 = i) = 1$, then $i$ is recurrent and $\sum_{n=0}^{\infty}$ $p_{ii}(n)$ $=\infty$.

  2. Otherwise, $i$ is transient and $\sum_{n=0}^{\infty}$ $p_{ii}(n)$ $<\infty$.

Proof

Theorem (both recurrent or transient if communicates) open_in_new

Consider a Markov chain on $I$, and let $x, y\in I$.

If $x$ $\leftrightarrow$ $y$, then they are either both recurrent or both transient.

Proof

As a result, a communicating class consists of either all recurrent states or all transient states.

Theorem (recurrent and closed communicating class) open_in_new

Let $C$ be a communicating class of a Markov chain.

  • If $C$ is recurrent, then $C$ is closed.

  • If $C$ is closed and finite, then $C$ is recurrent.

Proof

Theorem (visit everywhere in irreducible and recurrent chain) open_in_new

Suppose a Markov chain on $I$ is irreducible and recurrent. Then for all $x,y\in I$, $$ \begin{align*} \prob(T_y < \infty | X_0 = x) = 1. \end{align*} $$

Proof

Random walks on integer lattices open_in_new

Definition (simple symmetric random walk) open_in_new

A simple symmetric random walk on $\Z^d$ is the Markov chain with transition probabilities $$ \begin{align*} P(x, x + e_i) = P(x, x-e_i) = \frac{1}{2d} \end{align*} $$ for all $i=1,2,\ldots,d$ where $\set{e_1, \ldots, e_d}$ is the standard basis of $\R^d$.

Theorem (recurrence and transience of simple symmetric random walk) open_in_new

Proposition (asymmetric random walk on Z is transient) open_in_new

The Markov chain on $\Z$ with transition probabilities, for some $p\in (0,1)$ and $p\neq 1/2$, $$ \begin{align*} P(x,x+1) = p, \qquad P(x,x-1) = 1-p \end{align*} $$ is transient.

Proof 1 (using $\sum_{n=0}^{\infty} p_{ii}(n)$), Proof 2 (using invariance equations)

Invariant distribution open_in_new

Definition (measure on state space) open_in_new

A measure on a state space $I$ is a vector $\lambda = (\lambda_i: i\in I)$ where all $\lambda_i\geq 0$.

  • A distribution $\pi$ is a measure with the additional condition that $\sum_{i\in I} \pi_i = 1$.

Definition (invariant measure) open_in_new

Consider a Markov chain on $I$ with a transition matrix $P$.

A measure $\lambda$ on $I$ is said to be invariant with respect to $P$ if $$ \begin{align*} \lambda &= \lambda P &&\text{or equivalently} & \lambda_j = \sum_{i\in I} \lambda_i P(i,j). \end{align*} $$

More generally, for a Markov kernel $K$, a measure $λ$ is invariant if $$ \begin{align*} λ(B) = \int_{\mathcal{X}} K(t, B) \,λ(\d t). \end{align*} $$

If $λ$ has a density $f$ and $K(t,\cdot )$ has a density $k(t,\cdot )$, then $$ \begin{align*} f(x) = \int_{\mathcal{X}} k(t,x) f(t) \d t. \end{align*} $$

  • Invariant distribution can be defined the same way.

Proposition (initial invariant distribution) open_in_new

Let $\ouline{X} = (X_n)_{n=1}^\infty$ be a Markov chain with a transition matrix $P$, and $\pi$ is an invariant distribution for $P$.

If $X_0\sim \pi$, then $X_n \sim \pi$ for all $n$.

Proof

Proposition (limiting distribution is invariant) open_in_new

Let $\ouline{X}$ be a Markov chain with a transition matrix $P$ on a state space $I$, and $(\pi_j)_{j\in I}$ be a vector.

If $I$ is finite and there exists $i\in I$ such that $p_{ij}(n)$ $\to \pi_j$ as $n\to \infty$ for all $j\in I$, then $\pi$ is an invariant distribution for $\ouline{X}$.

Proof

  • $\pi$ may not be a probability distribution if $I$ is infinite. (Example)

Definition (expected number of visits during an excursion) open_in_new

Consider a Markov chain $\ouline{X} = (X_n)_{n\geq 0}$ on $I$ with transition matrix $P$, and let $k\in I$ be a state.

Define $\nu_k(i)$ to be the expected number of visits to $i$ during an excursion from $k$, i.e. $$ \begin{align*} \nu_k(i) = \expect\Big(\sum_{t=0}^{T_k-1} \mathbb{1}(X_t = i) \,\Big|\, X_0 = k\Big). \end{align*} $$ where $T_k = \inf\sb{n\geq 1}{X_n=k}$ is the first return time of $k$.

Proposition (properties of expected number of visits during excursion) open_in_new

Consider a Markov chain on $I$ with transition matrix $P$, and let $k\in I$.

If $P$ is irreducible and recurrent, then

  1. $\nu_k$ is an invariant measure for $P$;

  2. $\nu_k(k) = 1$; and

  3. $0 < v_k(i) < \infty$ for all $i\in I$.

Proof

Proposition (invariant measure and expected number of visits during excursion) open_in_new

Consider a Markov chain on $I$ with transition matrix $P$, and let $k\in I$.

If $P$ is irreducible, $\lambda$ is an invariant measure for $P$ and $\lambda_k=1$, then $\lambda\geq$ $\nu_k$.

If moreover $P$ is recurrent, then $\lambda=\nu_k$.

Proof

  • This shows that if $P$ is irreducible and recurrent, then all invariant measures are multiples of one another.

Definition (positive recurrent, null recurrent) open_in_new

Consider a Markov chain $\ouline{X} = (X_n)_{n\geq 0}$ on $I$, and let $i\in I$ be an recurrent state. We say $i$ is

  • positive recurrent if $\expect($$T_i$$|X_0 = i) < \infty$; and

  • null recurrent if $\expect(T_i|X_0 = i) = \infty$.

Theorem (existence of an invariant distribution) open_in_new

Consider a Markov chain on $I$ with a transition matrix $P$.

Suppose $P$ is irreducible. Then the following are equivalent:

  1. every state is positive recurrent;

  2. there exists a state which is positive recurrent;

  3. there exists an invariant distribution $\pi = (\pi_i)_{i\in I}$ for $P$.

If any of the above holds, then for all $i,k\in I$, $$ \begin{align*} \pi_i ={}& \frac{1}{\expect(T_i|X_0 = i)}, \\ \nu_k(i) ={}& \frac{\pi_i}{\pi_k}. \end{align*} $$ where $T_i$ is the first return time and $\nu_k$ is the expected number of visits during an excursion.

Proof

  • This shows that if $P$ is irreducible, invariant distributions are unique.

Examples:

Time reversibility open_in_new

Proposition (time-reversed transition matrix) open_in_new

Let $\ouline{X}\sim \mathrm{Markov}(\pi, P)$ be irreducible and $\pi$ be an invariant distribution for $P$. For some fixed $N$, let $\ouline{Y} = (Y_n)_{0\leq n\leq N}$ be a random process given by $Y_n = X_{N-n}$ for $0\leq n\leq N$.

Then $\ouline{Y}\sim \mathrm{Markov}(\pi, \hat P)$, $\ouline{Y}$ is irreducible, and $\pi$ is an invariant distribution for $\hat P$, where $$ \begin{align*} \hat P(x,y) = \frac{\pi(y)}{\pi(x)}P(y,x). \end{align*} $$

Proof

(Note that $\pi>0$.)

Definition (time-reversible transition matrix) open_in_new

A transition matrix $P$ is said to be time-reversible with respect to an invariant distribution $\pi$ if, equivalently,

  • $P=$ $\hat P$;

  • $P$ satisfies the detailed balance equations $$ \begin{align*} \pi(x) \, P(x,y) = \pi(y) \, P(y,x) \qquad \text{for all }x,y\in I; \end{align*} $$

  • if $\ouline{X}\sim\mathrm{Markov}(\pi, P)$, then $(X_n, X_{n+1})$ and $(X_{n+1}, X_n)$ have the same (joint) distribution.

Lemma (measure satisfying detailed balance equations is invariant) open_in_new

Let $P$ be a transition matrix on $I$, and $\lambda$ be a measure on $I$.

If $\lambda$ satisfies the detailed balance equations, i.e. $\lambda(x)\, P(x,y) = \lambda(y) \, P(y,x)$, then $\lambda$ is invariant for $P$.

Proof

  • This means if we can solve the detailed balance equation to find a distribution $\pi$ for an irreducible $P$ (which is easier than solving $\pi = \pi P$), then $P$ is positive recurrent and time-reversible, and $\pi$ is its unique invariant distribution.

Convergence to equilibrium open_in_new

Definition (period of a state, aperiodic) open_in_new

Consider a Markov chain $\ouline{X}$ on $I$ with a transition matrix $P$.

  • Define the period of a state $i\in I$ as $$ \begin{align*} d_i = \op{gcd}\sb{n\geq 1}{p_{ii}(n) > 0}. \end{align*} $$

  • If $d_i=1$, then $i$ is said to be aperiodic.

  • If all states are aperiodic, then we say $P$ and $\ouline{X}$ are aperiodic.

Lemma (aperiodic iff returning probability all positive eventually) open_in_new

Consider a Markov chain $\ouline{X}$ on $I$ and let $i\in I$ be a state.

$i$ is aperiodic iff $p_{ii}(n)>0$ for all sufficiently large $n$.

Proof. Use the property that $p_{ii}(n) > 0$ and $p_{ii}(m) > 0$ implies $p_{ii}(n+m)>0$, and apply this fact from number theory.

Lemma (one state aperiodic implies all state aperiodic) open_in_new

Consider a Markov chain on $I$ with a transition matrix $P$.

If $P$ is irreducible and a state $i\in I$ is aperiodic, then all states are aperiodic.

Proof

Theorem (convergence to equilibrium in a Markov chain) open_in_new

Let $\ouline{X}\sim \mathrm{Markov}(\lambda,P)$ be a Markov chain on $I$.

Suppose $\ouline{X}$ is irreducible and aperiodic.

Proof

  • In particular, for the positive recurrent case, taking $\lambda=\delta_x$ gives $$ \begin{align*} \prob(X_n = y | X_0 = x) \to \pi(y) \quad \text{as } n\to \infty. \end{align*} $$ for any $x,y\in I$.

Theorem (ergodic theorem) open_in_new

Let $\ouline{X}\sim \mathrm{Markov}(\lambda, P)$ on $I$.

If $P$ is irreducible and positive recurrent, and has an invariant distribution $\pi$, then for each $x\in I$, $$ \begin{align*} \prob\left(\frac{1}{n}\sum_{i=0}^{n-1} \mathbb{1}(X_i = x) \to \pi(x) \quad \text{ as } n\to \infty\right) = 1 \end{align*} $$

Proof