b2KIT

Markov Chain Simulator

Define transition matrices and simulate Markov chains. Visualize state diagrams, steady-state distributions, and absorption probabilities.

Tested tool guide Tested browser tools Checked August 16, 2026

What Markov Chain Simulator does, with a checked example

Enter named states, one-step transition probabilities, an initial state or distribution, and a step count. The simulator advances the distribution through the chain, represents nonzero transitions in a directed state diagram, reports steady-state distributions, and calculates eventual absorption probabilities for absorbing models. The common input error is transposing the matrix: each row describes every possible next state from one current state and must total 1. A steady-state result is a balance solution, not proof that every initial distribution converges to it.

Worked example

A concrete input and expected output from the current implementation.

Input

States: Start, Done
Rows = current state; columns = next state
Transition matrix:
0 1
0 1
Initial distribution: 1 0
Steps: 2

Expected output

Step 1 distribution: Start 0, Done 1
Step 2 distribution: Start 0, Done 1
Steady-state distribution: Start 0, Done 1
Absorption probability for Done, starting from Start: 1

From Start, the only one-step transition goes to Done. Done has a probability-1 self-loop, so it is absorbing; after the first step the chain stays there forever, making both the stationary mass and eventual absorption probability 1 at Done.

How the result is produced

1

Advancing the chain

The transition matrix represents one-step conditional probabilities. With states in the displayed order, each entry in row i and column j is the probability of moving from state i to state j. For a row distribution p, one step is pP and n steps is pP^n. Nonzero entries become labeled arrows in the state diagram, including diagonal self-loops.

2

Steady states and absorption

A steady-state distribution pi satisfies piP = pi and its entries sum to 1. In an absorbing model, a state is absorbing when its self-transition probability is 1. Eventual absorption probabilities are determined recursively from transient states, using boundary value 1 at the selected absorbing state and 0 at competing absorbing states.

Good uses

  • Forecast how a population moves among customer, credit-rating, health, or equipment-condition states over a fixed number of transitions.
  • Check the long-run distribution implied by a proposed stochastic transition matrix.
  • Calculate the chance that a random walk or workflow eventually reaches each terminal state.

Limits and checks

  • Every transition probability must be between 0 and 1, and each row must total 1. Reversing the state order changes the model.
  • A stationary distribution may be nonunique, and periodic or reducible chains need not converge to one distribution from every starting point.
  • An absorption probability describes an eventual destination, not the likely number of steps before arrival. Probability 1 does not mean immediate absorption.

Common questions

How is a steady-state distribution different from an absorption probability?

A steady-state distribution is unchanged by one more transition and can assign mass to nonabsorbing recurrent states. An absorption probability instead asks where a chain eventually gets trapped, given a particular starting state or distribution. They coincide in the example because Done is the sole closed destination, but they need not coincide in a model with several recurrent classes.

Can this simulator show that observed data really follows a Markov chain?

No. The simulator answers probability questions for the matrix supplied; it does not establish that observations depend only on the current state, that transition probabilities stay constant over time, or that the chosen states capture enough history. Estimate and test those modeling assumptions separately before treating its long-run or absorption results as evidence about a real process.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools