Markov Chain Calculator
Work with a Markov chain: n-step transition probabilities, the distribution after n steps, the stationary distribution and absorbing states, with exact fractions.
About the Markov Chain Calculator
A Markov chain moves between states with fixed probabilities that depend only on the current state. The n-step transition probabilities are the entries of Pⁿ, and a starting distribution p₀ becomes p₀Pⁿ after n steps.
A stationary distribution π satisfies πP = π with its entries adding to 1; for a regular chain every starting distribution converges to it.
The formula
pₙ = p₀Pⁿ; πP = π, Σπᵢ = 1
- Absorbing state
- Pᵢᵢ = 1: once there, the chain stays
Worked example
P = [[0.7, 0.3], [0.4, 0.6]]
- πP = π: 0.3π₁ = 0.4π₂
- π = (4/7, 3/7)
Questions people ask
Do I need decimals?
No: fractions keep the answer exact, and decimals like 0.7 are read exactly too.
What is a steady state?
A distribution π with πP = π: once the chain reaches it, the probabilities stop changing. A regular chain settles to the same steady state from any starting point.