skip to content

Markov Chains

Systems that remember only their current state: transition matrices, stationary distributions, absorbing states and expected time to absorption. Interviewers use chains for user-lifecycle questions.

on this pageshow

questions

6

What does the Markov property mean for a chain that models users as trial, paid or churned?

level: juniorimportance: must knowfreq 82%

answer

  1. future depends on present only
  2. history adds nothing given now
  3. same matrix row for everyone in a state
  4. memory lives in the state you design

basics

~20 s

The Markov property says the next state depends only on the current state, not on the path taken to reach it. A user in the paid state has the same transition probabilities regardless of how long ago they upgraded.

solid answer

~40 s

Formally, `P(X_next = j | X_now = i, and the whole earlier history) = P(X_next = j | X_now = i)`. Given where a user is today, how they got there adds no information about where they go tomorrow. In a trial/paid/churned chain that means one row of the transition matrix applies to every user currently in `paid`, whether they upgraded last month or three years ago. The pay-off is that the entire process is described by one small matrix plus a starting distribution. The catch is that this is a modelling assumption, not a fact about users: if churn risk really does depend on tenure, the honest fix is to enrich the state — split `paid` into `paid-first-month` and `paid-established` — so the state carries the memory the model needs.

go deeper

for a junior

Be ready to state the property in one sentence and give an example: given a user is in trial today, the route they took to get there does not change tomorrow's probabilities.

for a middle

Explain what the property buys you mechanically — the whole process collapses to one transition matrix plus a starting distribution — and distinguish it from time-homogeneity.

for a senior

Show how you would test the assumption against real lifecycle data and how you would enlarge the state space when tenure or the previous state clearly matters.

for a principal

Own the tradeoff between a small interpretable state space that violates the assumption slightly and a large faithful one that nobody can estimate reliably from the data you have.

## The statement A discrete-time Markov chain is a sequence of random states `X_0, X_1, X_2, ...` drawn from a finite set of possible states. The **Markov property** is a conditional-independence claim about that sequence: ``` P(X_(n+1) = j | X_n = i, X_(n-1) = ..., ..., X_0 = ...) = P(X_(n+1) = j | X_n = i) ``` In words: conditioned on the present state, the future is independent of the past. This is often called *memorylessness*, which misleads people. The process is not forgetful in general — it is forgetful *given the current state*. The current state is allowed to carry as much history as you choose to encode in it. ## What it buys you If the property holds and the transition probabilities do not change over time, every question about the chain reduces to two objects: a **transition matrix** `P`, where `P[i][j] = P(next = j | now = i)` and each row sums to 1, and an initial distribution over states. Multi-step forecasts, long-run shares and expected times all follow from those. Without the property you would need probabilities conditioned on entire histories, and the number of histories grows exponentially with the horizon. ## A concrete lifecycle chain Take monthly states `trial`, `paid`, `churned` with - from `trial`: stay 0.5, go to `paid` 0.3, go to `churned` 0.2 - from `paid`: stay 0.9, go to `churned` 0.1 - from `churned`: stay 1.0 (an absorbing state) The Markov claim here is strong and testable: every user sitting in `trial` this month faces the same 0.3 chance of converting, regardless of whether it is their first week or their fifth extension, and regardless of what marketing touchpoints preceded it. Any two users in the same state are interchangeable as far as the model is concerned. ## How it fails, and how to repair it Three common violations, each with a standard repair. 1. **Duration dependence.** Conversion probability falls the longer someone lingers in trial. Repair: split the state by tenure (`trial-week-1`, `trial-week-2+`). The enlarged chain is Markov again because the tenure information now lives in the state. 2. **Path dependence.** A user who downgraded from `paid` back to `trial` churns at a different rate from a first-time trialist. Repair: define states as pairs (previous, current) — a **second-order** chain rewritten as a first-order chain on a bigger state space. 3. **Heterogeneous users.** Two populations with different churn rates are mixed together, so the aggregate transition rate drifts as the mix changes. Repair: add a segment dimension to the state, or fit separate chains. There is also a genuinely different model class — **semi-Markov** processes — where you keep the jump structure but let the time spent in a state follow an arbitrary distribution instead of a geometric one. Reaching for that is legitimate when durations, not destinations, are the interesting part. ## Markov property versus time-homogeneity These are two separate assumptions and interviewers like to see them separated. The Markov property is about *what* you condition on: the present state alone. **Time-homogeneity** is about *whether the numbers move*: `P(X_(n+1) = j | X_n = i)` is the same for every `n`. A chain can be Markov but seasonal — churn probabilities that rise every December are still Markov, they just need a time-indexed matrix `P_n`. Almost every textbook result about transition-matrix powers assumes homogeneity, so if your process is seasonal you either model it per-period or stratify. ## Checking it against data The practical test is to estimate transitions two ways: unconditionally from the current state, and conditioned on something the model claims is irrelevant (previous state, tenure bucket, acquisition channel). If those conditional transition rates differ materially, the first-order Markov assumption on your current state space is wrong, and the answer is a richer state space rather than abandoning the framework. ## What interviewers listen for A weak answer recites 'the future depends only on the present'. A strong answer adds the second half: the state is a design choice, so the property is something you engineer into the model, and you can say concretely how you would enlarge the state when the data says the assumption is broken.

  • Does the Markov property mean the process has no memory at all?
    No. It restricts *where* memory lives, not how much there is. The current state can encode as much history as you want — tenure buckets, the previous state, a segment label. Once that information sits in the state, conditioning on the older history adds nothing, and the chain is Markov by construction.
  • How would you detect that the first-order Markov assumption is violated in your data?
    Estimate transition rates conditioned on something the model says is irrelevant: the previous state, months-in-state, or acquisition channel. If users in `paid` convert to `churned` at 4% in month one and 12% at renewal, the rates differ by tenure and the assumption fails. The repair is to split the state, not to drop the model.
  • What is the difference between the Markov property and time-homogeneity?
    The Markov property says the next step depends only on the current state. Time-homogeneity says the transition probabilities are the same at every step. A chain with seasonal churn — higher every December — can satisfy the Markov property while violating homogeneity, and then a single fixed transition matrix is the wrong tool.

saying these in an interview costs you the question

  • Claims a Markov chain remembers nothing at all
  • Treats the property as a fact about data rather than a modelling choice
  • Conditions on the entire path when computing the next step
  • Confuses the Markov property with independence of successive states
  • Cannot name a repair when tenure clearly matters

context

open as a page

What does a Markov chain's stationary distribution tell you about a random surfer's long-run page visits?

level: middleimportance: must knowfreq 70%

basics

~20 s

A stationary distribution is a probability vector pi satisfying pi = pi P, so one more step leaves it unchanged. For an ergodic chain it is unique and gives the long-run share of steps spent on each page.

open as a page

Given a sunny/rainy transition matrix, how do you compute the chance of rain two days from now?

level: middleimportance: should knowfreq 62%

basics

~20 s

Raise the transition matrix to the second power. Entry (i, j) of P squared is the probability of being in state j two steps after starting in state i, so read the sunny-to-rainy entry of that matrix.

open as a page

Does every finite Markov chain converge to the same long-run distribution regardless of where it starts?

level: seniorimportance: should knowfreq 45%

basics

~20 s

No. Convergence to one limiting distribution from any start requires the chain to be irreducible and aperiodic. A chain that strictly alternates between two states, or one that splits into groups that cannot reach each other, never settles.

open as a page

In a trial/paid/churned chain with churn absorbing, how do you compute the expected months until churn?

level: seniorimportance: should knowfreq 52%

basics

~20 s

Take the submatrix Q of transitions among the non-absorbing states and solve (I - Q) t = 1, where 1 is a vector of ones. The trial entry of t is the expected number of months before the user churns.

open as a page

What assumptions define a Poisson process for support calls arriving through the day?

level: middleimportance: nice to knowfreq 36%

basics

~20 s

Calls must arrive one at a time, counts in non-overlapping time windows must be independent, and the average arrival rate must be constant. Those assumptions make the count in any window Poisson and the gaps between calls exponential.

open as a page