Nijdam (Dutch Wikipedia user) β https://commons.wikimedia.org/wiki/File:NYW-Markovketen-Muis.gif · CC BY-SA 3.0 / GFDL · Wikimedia Commons
When a problem asks “in the long run, what fraction of time does the chain spend in state $X$?”, you want the stationary distribution $\pi$, the unique probability vector satisfying $\pi = \pi P$. For finite irreducible aperiodic chains, $\pi_i$ is exactly the long-run fraction of time the chain spends in state $i$. Recipe: write $P$, write balance equations, add $\sum \pi_i = 1$, solve. Distinct from first-step analysis (which anchors at absorbing boundaries to compute hitting probabilities).
β Intro Β· expand
Try first (productive failure)
Before the worked example: spend 60 seconds taking your best shot at this.
A guess is fine β being briefly wrong about a problem makes the explanation
land harder when you read it. This appears once per tutorial; skip
if you already know the trick.
60s
β Try first Β· expand
Worked example
A weather model has two states: Sunny (S) and Rainy (R). If today is sunny, tomorrow is sunny with probability $0.8$. If today is rainy, tomorrow is rainy with probability $0.6$. In the long run, what fraction of days are sunny?
β Worked example Β· expand
Practice 1 of 3Type a fraction, decimal, or expression β mathjs parses it.
β Practice Β· expand
More examples
A handful of harder problems on the same theme. Click any prompt to reveal the solution sketch.
Recolouring marbles. A box holds $n$ marbles, each a different colour (one of each). Repeat the following step: draw two marbles uniformly at random, repaint the first so it matches the colour of the second, and put both back. What is the expected number of steps until every marble in the box shares one common colour?
$E[N] = (n - 1)^2$. Track the count $X_k$ of marbles of the dominant colour. From state $i$ the chain moves to $i + 1$ with probability $\tfrac{i(n - i)}{n(n - 1)}$, to $i - 1$ with the same probability, otherwise stays. The hitting time to $n$ from $X_0 = 1$ satisfies $E[N_i] = E[N_{i-1}] + \tfrac{n(n - 1)}{i(n - i)}$. Telescoping gives $E[N] = (n - 1)^2$.
+ More examples Β· expand
Reflection
What cues tell you it’s a stationary-distribution question rather than a first-step-analysis (hitting time / absorption) question? And after you write $\pi = \pi P$, why do you always need to add $\sum \pi_i = 1$?