What is a Markov chain?
A Markov chain is a discrete-time stochastic process \(\{X_0, X_1, X_2, \ldots\}\) that takes values in a finite set of states and satisfies the Markov property, or "memorylessness":
$$P(X_{n+1} = j \mid X_0, X_1, \ldots, X_n) = P(X_{n+1} = j \mid X_n) = p_{ij}$$
The probability of moving to the next state depends only on the present state, not on how it was reached. This greatly simplifies the mathematical analysis without sacrificing realism in many applications.
The complete behavior of the chain is fully specified by the transition matrix \(P\), where the element \(p_{ij}\) is the probability of moving from state \(i\) to state \(j\) in one step:
$$P = \begin{pmatrix} p_{11} & p_{12} & \cdots & p_{1n} \\ p_{21} & p_{22} & \cdots & p_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ p_{n1} & p_{n2} & \cdots & p_{nn} \end{pmatrix}, \quad \sum_{j=1}^{n} p_{ij} = 1 \text{ for every } i$$
Each row of the transition matrix is a probability distribution: the values are non-negative and sum to 1. This makes \(P\) a stochastic matrix (or Markov matrix).
Stationary distribution
A stationary distribution (or equilibrium distribution) is a probability vector \(\pi = (\pi_1, \pi_2, \ldots, \pi_n)\) such that:
$$\pi P = \pi \quad \text{with} \quad \sum_{i=1}^{n} \pi_i = 1, \quad \pi_i \geq 0$$
Intuitively, if the chain is in the stationary distribution at time \(n\), it will remain in that distribution forever. In practice, it represents the long-run fraction of time the chain spends in each state.
Existence and uniqueness conditions
- Irreducibility: every state is reachable from every other state (the chain is a strongly connected graph). This guarantees that a unique stationary distribution exists.
- Aperiodicity: no state has a period greater than 1. Together with irreducibility, this guarantees the convergence of the state distribution toward \(\pi\) regardless of the initial state.
- A chain that is both irreducible and aperiodic is called ergodic. For ergodic chains, \(\pi\) is the unique stationary distribution and the chain converges to it.
Absorbing state: the Customer / Churn preset
In the Customer preset, the "Churn" state is an absorbing state: \(p_{\text{churn}, \text{churn}} = 1\). Once a customer leaves, they don't come back. This makes the chain non-ergodic: eventually every customer ends up in Churn. The stationary distribution assigns probability 1 to that state and 0 to the rest.