MathIsimple

Markov Chains

Master the complete theory of discrete-time Markov processes, from fundamental definitions to advanced applications

8-12 hoursAdvanced10 lessons
Learning Objectives
  • Master the Markov property and its mathematical formulation
  • Apply Chapman-Kolmogorov equations for multi-step transition probabilities
  • Classify states as recurrent, transient, periodic, or aperiodic
  • Calculate stationary distributions and analyze long-term behavior
  • Solve absorption problems including gambler's ruin scenarios
  • Apply Markov chains to real-world problems like PageRank and queueing systems

1. Markov Chain Definition & Basic Properties

The Markov Property (Memoryless Property)

Core Definition

A stochastic process {Xn;n=0,1,2,}\{X_n; n=0,1,2,\ldots\} with discrete state spaceII (such as {0,1,2,}\{0,1,2,\ldots\} or finite sets) is called a Markov chain if for any k1k \geq 1, time instants0n0<n1<<nk0 \leq n_0 < n_1 < \cdots < n_k, and statesi0,i1,,ik,jIi_0, i_1, \ldots, i_k, j \in I, it satisfies:

P{Xnk+1=jXn0=i0,Xn1=i1,,Xnk=ik}=P{Xnk+1=jXnk=ik}P\{X_{n_k+1}=j \mid X_{n_0}=i_0, X_{n_1}=i_1, \ldots, X_{n_k}=i_k\} = P\{X_{n_k+1}=j \mid X_{n_k}=i_k\}

Time-Homogeneous Markov Chains

If the transition probability P{Xn+1=jXn=i}P\{X_{n+1}=j \mid X_n=i\} is independent of time nn, the chain is called time-homogeneous. We denote the one-step transition probability as:

pij=P{Xn+1=jXn=i},i,jI,n0p_{ij} = P\{X_{n+1}=j \mid X_n=i\}, \quad \forall i,j \in I, n \geq 0

Transition Matrix Properties

The one-step transition matrix P=(pij)I×I\mathbf{P} = (p_{ij})_{I \times I} satisfies:

  • Non-negativity: pij0p_{ij} \geq 0 (probabilities are non-negative)
  • Row stochastic: jIpij=1\sum_{j \in I} p_{ij} = 1 (from state ii, transition to some state)
Example: Binary Transmission System

In a binary communication system with correct transmission probability pp and error probability q=1pq = 1-p. State space I={0,1}I = \{0,1\}, transition matrix:

P=(pqqp)\mathbf{P} = \begin{pmatrix} p & q \\ q & p \end{pmatrix}

This represents: p00=pp_{00} = p (0 transmitted correctly as 0),p01=qp_{01} = q (0 transmitted incorrectly as 1), etc.

2. Chapman-Kolmogorov Equations & Multi-Step Transitions

Multi-Step Transition Probabilities

The nn-step transition probability from state ii to state jj is defined as:

pij(n)=P{Xn+m=jXm=i},m0,n1p_{ij}(n) = P\{X_{n+m}=j \mid X_m=i\}, \quad \forall m \geq 0, n \geq 1

The corresponding nn-step transition matrix isP(n)=(pij(n))I×I\mathbf{P}(n) = (p_{ij}(n))_{I \times I}, withP(1)=P\mathbf{P}(1) = \mathbf{P}.

Chapman-Kolmogorov Equations (Core Formula)

For any i,jIi,j \in I and positive integers u,v1u,v \geq 1:

pij(u+v)=kIpik(u)pkj(v)p_{ij}(u+v) = \sum_{k \in I} p_{ik}(u) p_{kj}(v)

Matrix form:

P(u+v)=P(u)P(v)\mathbf{P}(u+v) = \mathbf{P}(u) \cdot \mathbf{P}(v)

Key Consequence

This leads to the fundamental result:

P(n)=Pn\mathbf{P}(n) = \mathbf{P}^n

So P(2)=P2\mathbf{P}(2) = \mathbf{P}^2,P(3)=P3\mathbf{P}(3) = \mathbf{P}^3, etc.

Example: Two-Step Transition Calculation

For the binary transmission system with P=(pqqp)\mathbf{P} = \begin{pmatrix} p & q \\ q & p \end{pmatrix}, the two-step transition probability p00(2)p_{00}(2) is:

p00(2)=p00p00+p01p10=p2+q2p_{00}(2) = p_{00}p_{00} + p_{01}p_{10} = p^2 + q^2

This matches the direct calculation: "two transmissions both correct OR both incorrect."

3. State Classification & Properties

First Passage Times & Hitting Probabilities

First Passage Time

The first passage time from state ii to state jj is:

τij=min{n1Xn=jX0=i}\tau_{ij} = \min\{n \geq 1 \mid X_n = j \mid X_0 = i\}

with convention min=\min \emptyset = \infty.

Hitting Probability

The probability of ever reaching state jj from state ii:

fij=P{τij<X0=i}f_{ij} = P\{\tau_{ij} < \infty \mid X_0 = i\}
Recurrent vs Transient States

Recurrent State

  • Definition: fii=1f_{ii} = 1
  • Returns to itself with probability 1
  • Equivalent: n=1pii(n)=\sum_{n=1}^\infty p_{ii}(n) = \infty
  • Visits infinitely often

Transient State

  • Definition: fii<1f_{ii} < 1
  • Positive probability of never returning
  • Equivalent: n=1pii(n)<\sum_{n=1}^\infty p_{ii}(n) < \infty
  • Visits finitely often
Positive vs Null Recurrence

For a recurrent state ii, define the mean return time:

μi=E[τiiX0=i]=n=1nP{τii=nX0=i}\mu_i = E[\tau_{ii} \mid X_0 = i] = \sum_{n=1}^\infty n \cdot P\{\tau_{ii} = n \mid X_0 = i\}

Positive Recurrent

  • μi<\mu_i < \infty
  • Finite mean return time
  • In stationary distribution: πi=1/μi\pi_i = 1/\mu_i

Null Recurrent

  • μi=\mu_i = \infty
  • Infinite mean return time
  • Stationary probability: πi=0\pi_i = 0
Periodicity

The period of state ii is defined as:

d(i)=gcd{n1pii(n)>0}d(i) = \gcd\{n \geq 1 \mid p_{ii}(n) > 0\}

where gcd\gcd denotes the greatest common divisor.

Aperiodic

  • d(i)=1d(i) = 1
  • Can return at irregular intervals
  • Most common in applications

Periodic

  • d(i)>1d(i) > 1
  • Returns only at multiples of d(i)d(i)
  • Example: Bipartite graphs have period 2

4. Stationary Distributions & Long-term Behavior

Definition of Stationary Distribution

A probability distribution {πj;jI}\{\pi_j; j \in I\} is called stationary if it satisfies:

  • Normalization: jIπj=1\sum_{j \in I} \pi_j = 1
  • Balance equations: πj=iIπipij\pi_j = \sum_{i \in I} \pi_i p_{ij}

Matrix form:

π=πP\boldsymbol{\pi} = \boldsymbol{\pi} \mathbf{P}

where π=(π0,π1,π2,)\boldsymbol{\pi} = (\pi_0, \pi_1, \pi_2, \ldots) is the stationary distribution vector.

Existence & Uniqueness Conditions
Chain TypeStationary Distribution
Irreducible, aperiodic, positive recurrentUnique stationary distribution exists
πj=1/μj\pi_j = 1/\mu_j
Irreducible, null recurrent or transientNo stationary distribution
(or only trivial πj=0\pi_j = 0)
Reducible (multiple closed classes)Multiple stationary distributions
(convex combinations possible)
Computing Stationary Distributions

For Finite State Spaces

Given state space I={0,1,,m}I = \{0,1,\ldots,m\} and transition matrixP=(pij)\mathbf{P} = (p_{ij}):

  1. Write balance equations: πj=i=0mπipij\pi_j = \sum_{i=0}^m \pi_i p_{ij} (m+1 equations, m independent)
  2. Add normalization: j=0mπj=1\sum_{j=0}^m \pi_j = 1
  3. Solve the linear system

Example: Binary Transmission System

For P=(0.80.20.30.7)\mathbf{P} = \begin{pmatrix} 0.8 & 0.2 \\ 0.3 & 0.7 \end{pmatrix}:

  • Balance equations: π0=0.8π0+0.3π1\pi_0 = 0.8\pi_0 + 0.3\pi_1
  • Normalization: π0+π1=1\pi_0 + \pi_1 = 1
  • Solution: π0=0.6,π1=0.4\pi_0 = 0.6, \pi_1 = 0.4

5. Classic Applications

Gambler's Ruin Problem

Player A starts with ii dollars, Player B withmim-i dollars. Each game, A wins \$1 with probabilitypp or loses \$1 with probability q=1pq=1-p. Game continues until one player is ruined.

Ruin Probabilities

Fair Game (p=0.5p = 0.5)
hi=mimh_i = \frac{m-i}{m}
Unfair Game (p0.5p \neq 0.5)
hi=(q/p)i(q/p)m1(q/p)mh_i = \frac{(q/p)^i - (q/p)^m}{1 - (q/p)^m}

Expected Game Duration

Fair Game
E[Ti]=i(mi)E[T_i] = i(m-i)
Unfair Game
E[Ti]=iqpmqp(q/p)i1(q/p)m1E[T_i] = \frac{i}{q-p} - \frac{m}{q-p} \cdot \frac{(q/p)^i - 1}{(q/p)^m - 1}
PageRank Algorithm

Google's PageRank algorithm models web surfing as a Markov chain where:

  • • States represent web pages
  • • Transitions represent clicking on links
  • • From page ii with kik_i outbound links, transition probability to linked page jj is pij=1/kip_{ij} = 1/k_i
Queueing Systems

Model: Single server + 2 waiting positions (state space I={0,1,2,3}I = \{0,1,2,3\}), where XnX_n = number of customers at time nΔtn\Delta t.

Transition Rules

  • • Customer arrival probability: qq per time unit
  • • Customer service completion probability: pp per time unit
  • p01=qp_{01} = q (arrival when empty),p10=pp_{10} = p (service completion)
  • p32=pp_{32} = p (service completion when full)

The stationary distribution π\boldsymbol{\pi} gives long-term probabilities of having 0, 1, 2, or 3 customers in the system.

Ready to Practice?

Test your understanding with interactive problems and use our specialized calculators