Markov Chains: State Diagrams and Steady State
Problem
Weather model: if sunny today, P(sunny tomorrow) = 0.8. If rainy today, P(sunny tomorrow) = 0.4. Draw the state diagram and find the long-run probability of sunny weather.
Explanation
What is a Markov chain?
A Markov chain is a random process that moves between a finite set of states step by step, where the next state depends only on the current state — not the full history. That "memoryless" property is called the Markov property.
The chain is fully described by a transition matrix , where . Each row sums to 1 (some next-state must happen).
The weather model
States: S (sunny), R (rainy).
| From \ To | S | R | |-----------|-----|-----| | S | 0.8 | 0.2 | | R | 0.4 | 0.6 |
So .
(Since tables do not render here, read it as: , , , .)
Step-by-step — steady-state probabilities
The steady-state (or stationary) distribution satisfies and . It's the long-run fraction of days spent in each state.
Step 1 — Write the balance equations. For each state, the flow in equals the flow out:
Step 2 — Simplify. Rearranging the first equation:
Step 3 — Apply :
So in the long run, — about 67% of days are sunny.
Two-step transition
. Equivalently, compute the entry of .
Verification
Plug back into :
Common mistakes
- Forgetting rows sum to 1. Every row is a probability distribution over next states.
- Confusing "state" with "observation." A hidden-Markov model has hidden states and observations; a plain Markov chain's state is directly observable.
- Assuming a unique steady state. You need the chain to be irreducible (every state reachable from every other) and aperiodic. Our weather chain is both.
Try it in the visualization
Adjust the two transition probabilities and watch the state diagram, the matrix, and the steady-state bar chart all update together. Step the chain one day at a time to watch it converge toward .
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.