Technopedia

The technologist’s encyclopedia

Martingales

A martingale is a stochastic process whose conditional expectation of the future, given the past, equals the present value: E[Xt+1∣X0,…,Xt]=Xt\mathbb{E}[X_{t+1} \mid X_0,\dots,X_t] = X_t. It formalizes a “fair game” with no trend.

Key results: optional stopping theorem, Doob’s inequalities, martingale convergence theorems; the tool behind proofs of the strong law of large numbers and hitting-time estimates for Markov chains.

Builds on Random variables and expectation and Conditional probability.

Why it matters

A martingale is the precise mathematical statement that “no strategy can beat a fair game.” Once you can recognize a quantity as a martingale, three powerful conclusions come for free:

The rest of this page builds the machinery in order: the definition and its fair-game intuition, stopping times, the inequalities and convergence theorems that make the machinery usable, and the canonical examples that show the property cuts across every family of stochastic process.

Authoritative sources

Definition and the fair-game intuition

Definition. Let (Xt)t≥0(X_t)_{t \ge 0} be a stochastic process and Ft=σ(X0,…,Xt)\mathcal{F}_t = \sigma(X_0,\dots,X_t) the information available up to time tt (the filtration). Then:

In each case the process must be adapted (XtX_t is measurable w.r.t. Ft\mathcal{F}_t — you can observe it at time tt), integrable (E[∣Xt∣]<∞\mathbb{E}[|X_t|] < \infty), and the conditional expectation must exist.

Details

Step 1 — Read the definition as a prediction rule. The conditional expectation E[Xt+1∣Ft]\mathbb{E}[X_{t+1} \mid \mathcal{F}_t] is the best (mean-square) prediction of the next value using everything you know so far. A martingale says: the best prediction of the future is exactly where you are now. There is no edge to exploit, no trend to ride. A submartingale says the future is, on average, at least as large as the present (a favorable game); a supermartingale says at most as large (an unfavorable game). The martingale is the knife-edge between the two.

Step 2 — The symmetric random walk is the prototype. Let X0=0X_0 = 0 and let Xn=∑i=1nεiX_n = \sum_{i=1}^{n} \varepsilon_i where the εi\varepsilon_i are i.i.d. with P(εi=+1)=P(εi=−1)=12\mathbb{P}(\varepsilon_i = +1) = \mathbb{P}(\varepsilon_i = -1) = \tfrac{1}{2}. This is the gambler’s fortune after nn fair coin flips. Given the whole past, the next increment εn+1\varepsilon_{n+1} is still a fair coin, so

E[Xn+1∣X0,…,Xn]=E[Xn+εn+1∣X0,…,Xn]=Xn+E[εn+1]=Xn+0=Xn.\mathbb{E}[X_{n+1} \mid X_0,\dots,X_n] = \mathbb{E}[X_n + \varepsilon_{n+1} \mid X_0,\dots,X_n] = X_n + \mathbb{E}[\varepsilon_{n+1}] = X_n + 0 = X_n.

The walk is a martingale. Notice the variance grows (Var(Xn)=n\mathrm{Var}(X_n) = n), so the path wanders farther and farther from zero even though its mean stays pinned at zero: no trend, but plenty of spread.

Step 3 — A biased walk is a submartingale. If instead P(εi=+1)=p>12\mathbb{P}(\varepsilon_i = +1) = p > \tfrac{1}{2}, then E[εi]=2p−1>0\mathbb{E}[\varepsilon_i] = 2p - 1 > 0 and E[Xn+1∣Fn]=Xn+(2p−1)>Xn\mathbb{E}[X_{n+1} \mid \mathcal{F}_n] = X_n + (2p-1) > X_n: the walk is a submartingale with a genuine upward drift. The martingale is exactly the p=12p = \tfrac{1}{2} case.

Example. A gambler starts with a fortune of 100 and bets 1 unit on a fair coin each round. Their fortune XnX_n is a martingale: after any history, the expected fortune one round later is exactly the current fortune. The expected fortune is always 100, no matter how long they play — yet the probability of eventually going broke is 11 (a fact the convergence theorems below make precise).

E[X_n] = 0 (no drift) n X_n one sample path of a symmetric random walk (a martingale)

Authoritative sources

Example problem

A coin is biased with P(heads)=0.6\mathbb{P}(\text{heads}) = 0.6. A player gains 1 unit on heads and loses 1 unit on tails, starting at X0=0X_0 = 0. Is (Xn)(X_n) a martingale, a submartingale, or a supermartingale? Compute E[X10]\mathbb{E}[X_{10}].

Solution

Each increment εi\varepsilon_i has E[εi]=1(0.6)+(−1)(0.4)=0.2>0\mathbb{E}[\varepsilon_i] = 1(0.6) + (-1)(0.4) = 0.2 > 0. Hence E[Xn+1∣Fn]=Xn+0.2>Xn\mathbb{E}[X_{n+1} \mid \mathcal{F}_n] = X_n + 0.2 > X_n, so (Xn)(X_n) is a submartingale (a favorable game). The expected fortune after 10 rounds is E[X10]=10⋅0.2=2\mathbb{E}[X_{10}] = 10 \cdot 0.2 = 2 units.

Stopping times and the optional stopping theorem

Stopping time. A random time τ\tau is a stopping time (with respect to Ft\mathcal{F}_t) if the event {τ≤t}\{\tau \le t\} is determined by the information up to time tt — i.e. {τ≤t}∈Ft\{\tau \le t\} \in \mathcal{F}_t for every tt. You can decide to stop at τ\tau using only what you have seen so far, never by peeking into the future.

Optional stopping theorem (OST). If (Xt)(X_t) is a martingale and τ\tau is a stopping time satisfying suitable conditions (e.g. τ\tau is bounded, or τ<∞\tau < \infty a.s. with XτX_{\tau} integrable and the stopped process uniformly integrable), then

E[Xτ]=E[X0].\mathbb{E}[X_{\tau}] = \mathbb{E}[X_0].

The stopped process Xt∧τX_{t \wedge \tau} (frozen at τ\tau) is itself a martingale.

Details

Step 1 — Why stopping times are the right notion of “a rule.” A strategy that says “stop when your fortune first hits 150” is a stopping time: at each moment you can check whether the target has been reached using only the past. A rule like “stop at the time of the maximum” is not a stopping time, because you cannot know a time is the maximum until you see the future. The OST applies only to the honest kind.

Step 2 — The theorem in one line. For a martingale, the expected value is constant in time: E[Xt]=E[X0]\mathbb{E}[X_t] = \mathbb{E}[X_0]. If you freeze the process at a well-behaved stopping time τ\tau, the frozen value XτX_{\tau} still has the same expectation. Fairness is preserved by any legitimate stopping rule.

Step 3 — The conditions are not decoration. The classic trap is a stopping time that is almost surely finite but whose stopped value is not integrable, or whose tail carries enough mass to break the equality. The next example is the canonical demonstration.

The gambler’s-ruin counterexample. A gambler plays a fair coin, gaining or losing 1 unit per round, starting at X0=0X_0 = 0. They adopt the rule: stop when the fortune first reaches +100+100 or −50-50. Let τ\tau be that stopping time. The walk is a martingale and τ<∞\tau < \infty a.s. (a symmetric walk hits either boundary with probability 11), so it is tempting to conclude E[Xτ]=E[X0]=0\mathbb{E}[X_{\tau}] = \mathbb{E}[X_0] = 0.

But Xτ∈{+100,−50}X_{\tau} \in \{+100, -50\}, so E[Xτ]=100 p+(−50)(1−p)\mathbb{E}[X_{\tau}] = 100\,p + (-50)(1-p) where p=P(Xτ=+100)p = \mathbb{P}(X_{\tau} = +100). Setting this to 00 gives 100p=50(1−p)100p = 50(1-p), i.e. p=13p = \tfrac{1}{3}. So the gambler reaches +100+100 with probability only 13\tfrac{1}{3} and −50-50 with probability 23\tfrac{2}{3}. The OST does hold here (the stopped value is bounded, hence integrable), and it correctly predicts the 13\tfrac{1}{3} win probability — the “counterexample” is to the naive reading that “I’ll stop as soon as I’m ahead, so I’m guaranteed to win.” The rule does not create an edge; it only reshapes the distribution.

The genuinely dangerous version: a gambler who stops at the first time the fortune is positive (rule τ=inf⁡{n:Xn>0}\tau = \inf\{n : X_n > 0\}) has Xτ=+1X_{\tau} = +1 always, so E[Xτ]=1≠0=E[X0]\mathbb{E}[X_{\tau}] = 1 \ne 0 = \mathbb{E}[X_0]. The OST’s hypotheses fail: although τ<∞\tau < \infty a.s., the stopped process is not uniformly integrable and E[τ]=∞\mathbb{E}[\tau] = \infty. This is the “you can’t beat a fair game, but you can make the expected stopping time infinite” paradox.

Authoritative sources

Example problem

A fair random walk starts at X0=20X_0 = 20 and is stopped when it first hits 00 or 100100. What is the probability it hits 100100 before 00?

Solution

The walk is a martingale and the stopping time is bounded in the sense that the stopped value lies in {0,100}\{0, 100\} (integrable), so the OST applies: E[Xτ]=X0=20\mathbb{E}[X_{\tau}] = X_0 = 20. Writing p=P(Xτ=100)p = \mathbb{P}(X_{\tau} = 100), we have 100 p+0 (1−p)=20100\,p + 0\,(1-p) = 20, hence p=0.2p = 0.2. The gambler wins with probability 15\tfrac{1}{5}.

Doob’s maximal inequality

Doob’s maximal inequality. If (Xt)t≥0(X_t)_{t \ge 0} is a nonnegative submartingale, then for every a>0a > 0 and every horizon TT,

P(sup⁡0≤t≤TXt≥a)≤E[XT]a.\mathbb{P}\Big(\sup_{0 \le t \le T} X_t \ge a\Big) \le \frac{\mathbb{E}[X_T]}{a}.

For a martingale, E[XT]=E[X0]\mathbb{E}[X_T] = \mathbb{E}[X_0], so the bound is simply P(sup⁡0≤t≤TXt≥a)≤E[X0]/a\mathbb{P}(\sup_{0 \le t \le T} X_t \ge a) \le \mathbb{E}[X_0]/a. The LpL^p version (Doob’s LpL^p inequality): if (Xt)(X_t) is a submartingale with p>1p > 1, then

E[sup⁡0≤t≤T∣Xt∣p]≤(pp−1)pE[∣XT∣p].\mathbb{E}\Big[\sup_{0 \le t \le T} |X_t|^p\Big] \le \Big(\frac{p}{p-1}\Big)^p \mathbb{E}[|X_T|^p].
Details

Step 1 — What the inequality controls. A martingale has constant mean, but its path can spike far above that mean before settling. Doob’s inequality bounds the probability of such a spike in terms of the terminal (or initial) size: the chance the running maximum ever exceeds aa is at most the mean divided by aa. It is the maximal-function analogue of Markov’s inequality.

Step 2 — The idea of the proof (upcrossings). The proof counts how often the path upcrosses a level [a,b][a, b] (goes from below aa to above bb). For a submartingale, each upcrossing must be “paid for” by an increase in the process, and the total number of upcrossings is bounded by the total increase divided by the gap b−ab - a. Letting b↓ab \downarrow a converts the upcrossing count into a bound on the maximum. This is the same “energy accounting” that underlies the convergence theorems.

Step 3 — Why it is useful. Doob’s inequality is the workhorse that turns “the mean is controlled” into “the whole path is controlled with high probability.” It is the key step in proving the martingale convergence theorems and in establishing almost-sure versions of limit theorems.

Example. Let Xt=StX_t = S_t be a symmetric random walk (a martingale, hence a submartingale in absolute value via ∣Xt∣|X_t|). Doob’s inequality says the probability the walk ever reaches +50+50 before a fixed horizon is at most E[∣XT∣]/50\mathbb{E}[|X_T|]/50, a quantity that grows only like T/50\sqrt{T}/50 — so the chance of a huge spike stays small for moderate TT.

Authoritative sources

Example problem

A nonnegative submartingale (Xt)(X_t) satisfies E[X0]=4\mathbb{E}[X_0] = 4. Use Doob’s maximal inequality to bound P(sup⁡t≥0Xt≥20)\mathbb{P}(\sup_{t \ge 0} X_t \ge 20).

Solution

By Doob’s maximal inequality, P(sup⁡t≥0Xt≥20)≤E[X0]/20=4/20=0.2\mathbb{P}(\sup_{t \ge 0} X_t \ge 20) \le \mathbb{E}[X_0]/20 = 4/20 = 0.2. So the probability the process ever reaches 2020 is at most 20%20\%.

Martingale convergence theorems

Martingale convergence theorem. If (Xt)t≥0(X_t)_{t \ge 0} is a martingale with sup⁡tE[∣Xt∣]<∞\sup_t \mathbb{E}[|X_t|] < \infty (an L1L^1-bounded martingale), then XtX_t converges almost surely to a finite random variable X∞X_\infty as t→∞t \to \infty. If in addition the family {Xt}\{X_t\} is uniformly integrable, then the convergence also holds in L1L^1, i.e. E[∣Xt−X∞∣]→0\mathbb{E}[|X_t - X_\infty|] \to 0.

Details

Step 1 — Bounded mean forces convergence. An L1L^1-bounded martingale cannot keep oscillating forever: the upcrossing argument of Doob’s inequality shows the expected number of upcrossings of any level [a,b][a,b] is finite, which forces the path to settle down. Hence Xt→X∞X_t \to X_\infty a.s.

Step 2 — Uniform integrability upgrades the mode of convergence. Almost-sure convergence alone does not guarantee that expectations converge (E[Xt]→E[X∞]\mathbb{E}[X_t] \to \mathbb{E}[X_\infty]). Uniform integrability rules out “mass escaping to the tail,” and then Xt→X∞X_t \to X_\infty in L1L^1, so E[X∞]=E[X0]\mathbb{E}[X_\infty] = \mathbb{E}[X_0].

Step 3 — Connection to the strong law of large numbers. Let X1,X2,…X_1, X_2, \dots be i.i.d. with E[∣X1∣]<∞\mathbb{E}[|X_1|] < \infty and E[X1]=0\mathbb{E}[X_1] = 0, and set Sn=X1+⋯+XnS_n = X_1 + \dots + X_n. Then (Sn)(S_n) is a martingale. The strong law of large numbers, Sn/n→0S_n/n \to 0 a.s., is a direct corollary of the martingale convergence theorem applied to the normalized martingale (see Limit theorems). Martingale convergence is thus the general engine behind the almost-sure stabilization of averages.

Example. The gambler’s fortune XnX_n in a fair game is an L1L^1-bounded martingale only if the fortune is bounded; an unbounded fair walk has E[∣Xn∣]→∞\mathbb{E}[|X_n|] \to \infty, so the theorem’s hypothesis fails and the walk does not converge — it wanders off to ±∞\pm\infty in the sense that it visits every level infinitely often.

Authoritative sources

Example problem

Let (Xn)(X_n) be a martingale with sup⁡nE[∣Xn∣]≤5\sup_n \mathbb{E}[|X_n|] \le 5. Does XnX_n converge almost surely? If the family is also uniformly integrable, what can you say about E[X∞]\mathbb{E}[X_\infty]?

Solution

Yes: (Xn)(X_n) is L1L^1-bounded, so by the martingale convergence theorem Xn→X∞X_n \to X_\infty a.s. for some finite X∞X_\infty. If the family is also uniformly integrable, the convergence is in L1L^1, and therefore E[X∞]=E[X0]\mathbb{E}[X_\infty] = \mathbb{E}[X_0] (the mean is preserved in the limit).

Canonical examples

The martingale property is not a family of processes but a structural property that members of every family can have. The three examples below show how it cuts across the discrete-time, counting, and continuous families.

Details

Step 1 — One property, many families. The martingale condition only asks that the conditional mean of the increment vanish. It does not care whether the increments are Gaussian (Brownian), Poisson (compensated counting), or arbitrary (martingale-difference). That is why a single set of tools — optional stopping, Doob’s inequalities, convergence theorems — applies uniformly across all of stochastic processes.

Step 2 — Compensating a drift is the general recipe. Whenever a process has a predictable drift, subtracting the accumulated drift yields a martingale. The Poisson process NtN_t drifts up at rate λ\lambda; Nt−λtN_t - \lambda t does not. A biased random walk XnX_n drifts at 2p−12p-1 per step; Xn−n(2p−1)X_n - n(2p-1) is a martingale. This “compensation” is the bridge between submartingales (drifting up) and martingales (drift-free).

Step 3 — Martingale-difference sequences are the atoms. Every discrete-time martingale is a sum of martingale-difference terms: Xn−Xn−1X_n - X_{n-1} has conditional mean zero. Conversely, summing any martingale-difference sequence gives a martingale. So the discrete theory reduces to understanding zero-conditional-mean increments, which is exactly the content of the fair-game definition.

Example. A Poisson process with rate λ=2\lambda = 2 has E[Nt]=2t\mathbb{E}[N_t] = 2t. The compensated process Mt=Nt−2tM_t = N_t - 2t satisfies E[Mt∣Fs]=E[Nt]−2t−(Ns−2s)=(2t−2s)−(Ns−2s)=Ns−2s=Ms\mathbb{E}[M_t \mid \mathcal{F}_s] = \mathbb{E}[N_t] - 2t - (N_s - 2s) = (2t - 2s) - (N_s - 2s) = N_s - 2s = M_s for t≥st \ge s: a martingale with mean zero and variance Var(Mt)=Var(Nt)=2t\mathrm{Var}(M_t) = \mathrm{Var}(N_t) = 2t.

Authoritative sources

Example problem

Let (Nt)(N_t) be a Poisson process with rate λ=5\lambda = 5. Show that Mt=Nt−5tM_t = N_t - 5t is a martingale, and compute Var(M3)\mathrm{Var}(M_3).

Solution

For t≥st \ge s, E[Nt−Ns∣Fs]=λ(t−s)=5(t−s)\mathbb{E}[N_t - N_s \mid \mathcal{F}_s] = \lambda(t-s) = 5(t-s), so E[Mt∣Fs]=E[Nt]−5t−(Ns−5s)=5t−5t−Ns+5s=Ns−5s=Ms\mathbb{E}[M_t \mid \mathcal{F}_s] = \mathbb{E}[N_t] - 5t - (N_s - 5s) = 5t - 5t - N_s + 5s = N_s - 5s = M_s. Hence (Mt)(M_t) is a martingale. Since Mt=Nt−5tM_t = N_t - 5t and 5t5t is deterministic, Var(M3)=Var(N3)=λ⋅3=15\mathrm{Var}(M_3) = \mathrm{Var}(N_3) = \lambda \cdot 3 = 15.

Quizz

Quizz

A player starts with a fortune of 30 and plays a fair coin, winning or losing 1 unit per round. They stop as soon as their fortune reaches either 0 (broke) or 100.

(a) Identify the martingale and the stopping time, and justify that the optional stopping theorem applies.

(b) What is the probability the player reaches 100 before going broke?

Solution

(a) The fortune (Xn)(X_n) is a symmetric random walk, hence a martingale. The stopping time τ=inf⁡{n:Xn∈{0,100}}\tau = \inf\{n : X_n \in \{0, 100\}\} is a stopping time (decidable from the past), and the stopped value Xτ∈{0,100}X_{\tau} \in \{0, 100\} is bounded, hence integrable. The OST applies.

(b) By the OST, E[Xτ]=X0=30\mathbb{E}[X_{\tau}] = X_0 = 30. Writing p=P(Xτ=100)p = \mathbb{P}(X_{\tau} = 100), we get 100 p+0 (1−p)=30100\,p + 0\,(1-p) = 30, so p=0.3p = 0.3. The player reaches 100 with probability 30%30\% and goes broke with probability 70%70\% — the fair game gives no edge, only a reshaping of the outcome distribution.