01 / 20

Markov Chains
Transition Matrices

Model systems that change between states over time using probability matrices and state vectors to predict long-term behavior.

Finite Mathematics

What Is a Markov Chain?

A Markov chain is a mathematical model describing a system that transitions between a finite set of states. At each time step, the system moves from one state to another (or stays) with a fixed probability.

Examples include weather patterns (sunny vs. rainy), customer brand loyalty, web page navigation, and gene mutations across generations.

States and Transitions

Sunny State S Rainy State R 0.3 0.5 0.7 0.5

The Transition Matrix \( P \)

We organize all transition probabilities into a square matrix called the transition matrix \( P \). Each entry \( p_{ij} \) represents the probability of moving from state \( i \) to state \( j \).

State Vectors: Where Are We Now?

A state vector \( \mathbf{s} \) is a row vector that describes the probability of being in each state at a given time. For \( n \) states, it has \( n \) entries that sum to 1.

Initial State
If we know it is sunny today:
\( \mathbf{s}_0 = \begin{bmatrix} 1 & 0 \end{bmatrix} \)
Uncertain Start
50/50 between sunny and rainy:
\( \mathbf{s}_0 = \begin{bmatrix} 0.5 & 0.5 \end{bmatrix} \)

The Core Rule: Multi-Step Prediction

To find the state vector after \( n \) steps, we repeatedly multiply by \( P \), or equivalently raise \( P \) to the \( n \)th power:

\(\mathbf{s}_0\)
\(\times P\)
\(\mathbf{s}_1\)
\(\times P\)
\(\mathbf{s}_2\)
...

The Steady-State Vector

As \( n \to \infty \), many Markov chains converge to a steady-state vector \( \mathbf{q} \) that no longer changes. This vector satisfies:

To find \( \mathbf{q} \), solve the system of equations \( \mathbf{q}P = \mathbf{q} \) together with the constraint that all entries sum to 1.

Regular vs. Absorbing Chains

Regular Chain
Some power \( P^k \) has all positive entries. Guaranteed to reach a unique steady state. Example: the weather model.
Absorbing Chain
Has at least one absorbing state (once entered, never left: \( p_{ii} = 1 \)). No steady-state distribution; we instead ask "how long until absorption?"

How to Apply Markov Chains

1
Identify the states. List all possible states the system can be in (e.g., Sunny, Rainy).
2
Build the transition matrix \( P \). Fill in each \( p_{ij} \) using given probabilities. Verify each row sums to 1.
3
Define the initial state vector \( \mathbf{s}_0 \). Express the starting condition as a row vector.
4
Compute \( \mathbf{s}_n = \mathbf{s}_0 \cdot P^n \). Multiply step by step, or raise \( P \) to the \( n \)th power.
5
Find the steady state (if regular). Solve \( \mathbf{q}P = \mathbf{q} \) with \( \sum q_i = 1 \).

Example 1: Weather Prediction

Using our weather model with \( P = \begin{bmatrix} 0.7 & 0.3 \\ 0.5 & 0.5 \end{bmatrix} \) and today is sunny: \( \mathbf{s}_0 = \begin{bmatrix} 1 & 0 \end{bmatrix} \). Find the probability distribution for tomorrow.

Example 2: Two Days Ahead

What is the weather probability distribution for the day after tomorrow?

Example 3: Finding the Steady State

Find \( \mathbf{q} = \begin{bmatrix} q_1 & q_2 \end{bmatrix} \) such that \( \mathbf{q}P = \mathbf{q} \).

Larger Example: Three States

A customer chooses between Brand A, Brand B, and Brand C each month. The transition matrix is:

A B C 0.2 0.2 0.3 0.2 0.1 0.3 0.6 0.5 0.6

Common Mistakes to Avoid

✕ Rows Don't Sum to 1
Every row must total exactly 1. A row like \( \begin{bmatrix} 0.4 & 0.4 \end{bmatrix} \) is invalid: the system must go somewhere.
✕ Column vs. Row Vector
If using row state vectors, multiply \( \mathbf{s} \cdot P \). If columns, multiply \( P \cdot \mathbf{s} \). Mixing conventions gives wrong answers.
✕ Confusing \( P \) with \( P^T \)
Entry \( p_{ij} \) means "from state \( i \) to state \( j \)." Swapping row and column indices reverses the direction of all transitions.

Summary of Key Concepts

Concept Symbol Meaning
State vector \( \mathbf{s}_n \) Probability distribution at step \( n \)
Transition matrix \( P \) Matrix of all transition probabilities
One-step update \( \mathbf{s}_1 = \mathbf{s}_0 \cdot P \) Multiply state vector by \( P \)
Multi-step \( \mathbf{s}_n = \mathbf{s}_0 \cdot P^n \) Raise \( P \) to the \( n \)th power
Steady state \( \mathbf{q}P = \mathbf{q} \) Long-run equilibrium distribution
Row sum rule \( \sum_j p_{ij} = 1 \) Each row must sum to 1

Question 1 of 5

Which property defines a Markov chain?

Question 2 of 5

In a valid transition matrix, each row must:

Question 3 of 5

Given \( \mathbf{s}_0 = \begin{bmatrix} 1 & 0 \end{bmatrix} \) and \( P = \begin{bmatrix} 0.8 & 0.2 \\ 0.4 & 0.6 \end{bmatrix} \), what is \( \mathbf{s}_1 \)?

Question 4 of 5

To find the state distribution after 5 steps, you compute:

Question 5 of 5

The steady-state vector \( \mathbf{q} \) satisfies which equation?