Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Core concepts

Markov Chain

About 3990 characters Updated Nov 30, 2026 27 views AI wiki

A Markov chain is a stochastic process that satisfies the "memoryless" property: the next state of the system depends only on the current state, not on the historical path by which the current state was reached. It is a classic building block of probability theory and one of the most fundamental mathematical languages in fields such as reinforcement learning, natural language processing, and diffusion generative models.

Core Principles

A Markov chain consists of two parts: a state space S and a transition probability matrix P. The element P(i,j) of the matrix denotes the probability of "currently being in state i and moving to state j next", and the elements of each row must sum to 1. The evolution of the whole system can be written as a row vector repeatedly multiplied by the matrix: pi(t+1) = pi(t) x P.

Its core assumption is the "Markov property", namely P(X(t+1) | X(t), X(t-1), ..., X(0)) = P(X(t+1) | X(t)). In reality this assumption is often only an approximation, but what it buys is extremely strong computability: the joint probability of an entire trajectory can be split into a product of local transition probabilities, and complex historical dependence is compressed into a finite state.

It is worth noting that a Markov chain can be "discrete-time", with states evolving step by step at fixed intervals, or "continuous-time", in which case a transition rate matrix replaces the transition probability matrix and the dwell time in a state follows an exponential distribution; this version is called a continuous-time Markov chain in engineering and is widely used in system reliability analysis and chemical reaction kinetics modeling.

The long-term behavior of the chain is characterized by the "stationary distribution". Under certain conditions (irreducible, aperiodic, positive recurrent), regardless of the initial distribution, after enough transitions the distribution converges to the same pi, satisfying pi = pi P. This is the so-called "forgetting of initial conditions", and it is the theoretical basis that lets Markov chain Monte Carlo methods work.

Key Points

Three points must be kept distinct. The state space can be discrete (such as weather being sunny, rainy, or cloudy) or continuous (such as the pixel space in diffusion models); the transition matrix determines the dynamics, and rows summing to one is a hard constraint whose violation means it is not a probabilistic model; the stationary distribution is a "long-run proportion" rather than a "final state", since the chain never stops at a single point, only the visiting frequency of each state stabilizes.

Methods for judging convergence include the detailed balance condition pi(i)P(i,j) = pi(j)P(j,i), which is the design principle of Metropolis-Hastings sampling, and the mixing time, which measures how quickly the chain approaches the stationary distribution, with a larger spectral gap meaning faster convergence. In practice, diagnosis is often done by running chains with several random seeds and observing whether sample statistics stabilize.

Common Misconceptions

The most common misunderstanding is treating "memorylessness" as "completely unrelated to history". The correct reading is that all historical information is already carried by the current state: as long as the state is defined sufficiently fully, discarding history loses no information; but if the state definition is incomplete, for example predicting tomorrow using only "current temperature" while ignoring pressure and season, the Markov assumption is being misapplied.

Another misconception is assuming all Markov chains converge. Periodic chains (such as one that necessarily bounces back and forth between two points) do not converge to a single-point distribution; only their time average converges. Some also confuse Markov chains with hidden Markov models, whose states are not visible and can only be inferred indirectly from observations, requiring the forward algorithm or the Viterbi algorithm for inference and decoding.

Also beware the intuition that "a bigger state is better". Inflating the state space makes the transition matrix grow quadratically in size, and the data needed to estimate each transition probability surges along with it; when data are limited, coarse but stable modeling often beats fine-grained but sparse modeling.

Application Scenarios

n-gram modeling in language models, PageRank web ranking, acoustic decoding in speech recognition, queueing theory and service-system modeling, the noising and denoising process of diffusion models, Markov chain Monte Carlo sampling, environment transition modeling in reinforcement learning, and customer-churn state transition analysis.