Search

Search papers and lessons

Martingale

Level 3 · 15 min read

A martingale is a random process that is fair at every step: given everything that has happened so far, its expected next value equals its current value.

On this page

  • Colour = topic mix
  • Probability
  • Calculus
  • Stochastic processes
  • Discrete math
  • Sign in to see your progress

TL;DR

A martingale is a random process that plays a fair game. Read its value as your fortune after each round. Given everything that has happened so far, your expected fortune after the next round equals your fortune now. There is no average drift up and no average drift down. The word comes from a doubling betting system, and the idea now sits underneath much of probability theory.

Where you'll see it: in the theory of fair games, in the pricing of financial assets (where prices discounted for interest are martingales under a standard pricing measure), and in proofs about how long random algorithms run and how far they stray from their average behaviour.

Intuition

A fair game

Start with 10 dollars. Flip a fair coin: win one dollar on heads, lose one dollar on tails. Your fortune after the flip is random, but its average is 10, the same as before. Whatever happened in earlier flips, the next flip has an average change of zero. The sequence of fortunes is a martingale.

Change the coin so heads comes up 60% of the time, and the average change is now positive every round. That game is a submartingale: it favours you. A game that favours the house is a supermartingale. The martingale is the boundary case of a game that favours nobody.

The present is the best forecast

The defining feature is not that the future is unpredictable. It is that the best forecast of the next value, given the full history, is the current value. Like a forecast that says "tomorrow's expected temperature is today's temperature", it commits to a centre and says nothing about the direction of the next step.

This matters because it is a statement about averages. A single path of a martingale can go up a lot or down a lot. The claim is only that across all the ways the next step could go, the probabilities balance out.

Why it is worth a name

Many quantities that are not fair in an obvious way become fair after a correction. Remove a known drift and what is left may be a martingale. Once a process is known to be a martingale, a small set of powerful theorems applies, and those theorems tell you things like "no clever stopping rule can turn a fair game into a profitable one". That last point is the heart of why martingales matter.

The structure of information over time is shown below. Each step reveals a little more of the story, and a martingale's forecast depends only on what has been revealed so far.

flowchart LR
  F0[Time 0: nothing revealed yet] --> F1[Time 1: first step known]
  F1 --> F2[Time 2: first two steps known]
  F2 --> F3[Later times: more steps known]

The math

Information over time

Let Fn\mathcal{F}_n be the collection of events you can answer yes or no to, using only what has happened up to and including step nn. The sequence F0⊆F1⊆F2⊆⋯\mathcal{F}_0 \subseteq \mathcal{F}_1 \subseteq \mathcal{F}_2 \subseteq \cdots is called a filtration. It grows, because nothing is forgotten. A process XnX_n is adapted to the filtration if its value is known by time nn, that is, XnX_n is determined by the information in Fn\mathcal{F}_n.

Definition

Definition: Martingale

A sequence of random variables X0,X1,X2,…X_0, X_1, X_2, \dots adapted to a filtration F0⊆F1⊆⋯\mathcal{F}_0 \subseteq \mathcal{F}_1 \subseteq \cdots is a martingale if

  1. E[ ∣Xn∣ ]<∞\mathbb{E}[\,|X_n|\,] \lt \infty for every nn, and
  2. E[Xn+1∣Fn]=Xn\mathbb{E}[X_{n+1} \mid \mathcal{F}_n] = X_n for every nn.

The second condition uses conditional expectation. The average of the next value is taken given the whole history Fn\mathcal{F}_n, not just given the current value XnX_n. Conditioning on XnX_n alone is a weaker property, and it does not give the theorems below.

Replace the equality with ≥\geq and you have a submartingale. Replace it with ≤\leq and you have a supermartingale. Equivalently, a martingale is a process whose increments Dn+1=Xn+1−XnD_{n+1} = X_{n+1} - X_n have zero conditional mean: E[Dn+1∣Fn]=0\mathbb{E}[D_{n+1} \mid \mathcal{F}_n] = 0.

The constant mean

A martingale has the same average at every time. Take expectations of the second condition, and use the law of total expectation (the average of a conditional average is the overall average):

E[Xn+1]=E[E[Xn+1∣Fn]]=E[Xn].\mathbb{E}[X_{n+1}] = \mathbb{E}\left[\mathbb{E}[X_{n+1} \mid \mathcal{F}_n]\right] = \mathbb{E}[X_n].

Repeating this step gives E[Xn]=E[X0]\mathbb{E}[X_n] = \mathbb{E}[X_0] for every nn. The average fortune in the coin game stays at 10, as the intuition promised.

Example process: the symmetric random walk

Let ξ1,ξ2,…\xi_1, \xi_2, \dots be independent steps, each equal to +1+1 or −1-1 with probability one half. Let S0=0S_0 = 0 and Sn=ξ1+⋯+ξnS_n = \xi_1 + \cdots + \xi_n. The filtration Fn\mathcal{F}_n is everything the first nn steps reveal.

Since SnS_n is known from Fn\mathcal{F}_n and the next step ξn+1\xi_{n+1} is independent of the past with mean zero,

E[Sn+1∣Fn]=Sn+E[ξn+1]=Sn.\mathbb{E}[S_{n+1} \mid \mathcal{F}_n] = S_n + \mathbb{E}[\xi_{n+1}] = S_n.

So SnS_n is a martingale. The square is not. Expand the square of the next position:

E[Sn+12∣Fn]=Sn2+2Sn E[ξn+1]+E[ξn+12]=Sn2+1,\mathbb{E}[S_{n+1}^2 \mid \mathcal{F}_n] = S_n^2 + 2S_n\,\mathbb{E}[\xi_{n+1}] + \mathbb{E}[\xi_{n+1}^2] = S_n^2 + 1,

using ξ2=1\xi^2 = 1 always. Then Mn=Sn2−nM_n = S_n^2 - n satisfies E[Mn+1∣Fn]=Sn2+1−(n+1)=Mn\mathbb{E}[M_{n+1} \mid \mathcal{F}_n] = S_n^2 + 1 - (n+1) = M_n. The square grows by exactly one on average each step, and subtracting nn removes that drift. This is the discrete version of a fact about random walks and Brownian motion: the process Wt2−tW_t^2 - t is a martingale in continuous time.

Example process: the Pólya urn

An urn starts with one red ball and one blue ball. Draw a ball at random, return it, and add one more ball of the same colour. Let rr be the number of red balls and tt the total, so after nn draws t=n+2t = n + 2. The red fraction is Rn=r/tR_n = r/t.

After the next draw, the red count is r+1r+1 with probability r/tr/t and stays rr otherwise, and the total becomes t+1t+1. So

E[Rn+1∣Fn]=rt⋅r+1t+1+(1−rt)rt+1=rt⋅t+1t+1=Rn.\mathbb{E}[R_{n+1} \mid \mathcal{F}_n] = \frac{r}{t}\cdot\frac{r+1}{t+1} + \left(1 - \frac{r}{t}\right)\frac{r}{t+1} = \frac{r}{t}\cdot\frac{t+1}{t+1} = R_n.

Here the numerator over the common denominator t(t+1)t(t+1) is r(r+1)+(t−r) r=r(t+1)r(r+1) + (t-r)\,r = r(t+1), which cancels the factor t+1t+1. The red fraction is a martingale. It lies between 0 and 1, and a bounded martingale always converges to a limit, so the red fraction settles to a random value rather than to a fixed number.

Stopping times and optional stopping

A stopping time TT is a rule for deciding when to stop that uses only the information so far: the event T≤nT \le n must be known from Fn\mathcal{F}_n. "Stop when you are ahead by 10 dollars" is a stopping time. "Stop on the day just before the price falls" is not, because it needs the future.

The optional stopping theorem, in its bounded form, says: if XnX_n is a martingale and TT is a stopping time that never exceeds a fixed number NN, then

E[XT]=E[X0].\mathbb{E}[X_T] = \mathbb{E}[X_0].

No strategy that stops using only the past can turn a fair game into a profitable one, as long as the stopping time is bounded. A second common version allows an unbounded TT provided it is finite with probability 1 and the martingale stopped at TT stays between two fixed numbers. The gambler's ruin example below uses the second version. Without conditions like these the theorem can fail, and that is how the doubling paradox in the tradeoffs section arises.

Worked examples

Example
The fair coin fortune
  1. Start with X0=10X_0 = 10 dollars.
  2. After one flip, X1X_1 is 11 or 9, each with probability one half. So E[X1]=12(11)+12(9)=10\mathbb{E}[X_1] = \tfrac{1}{2}(11) + \tfrac{1}{2}(9) = 10.
  3. After two flips, X2X_2 is 12, 10, 10 or 8, each with probability one quarter. So E[X2]=14(12+10+10+8)=10\mathbb{E}[X_2] = \tfrac{1}{4}(12 + 10 + 10 + 8) = 10.
  4. Interpretation: a single path can end at 8 or 12, but the average is pinned at 10 at every step. No betting pattern changes that average.
Example
The Pólya urn with numbers
  1. Start with 1 red and 1 blue, so R0=1/2R_0 = 1/2.
  2. After the first draw, the urn has 2 red and 1 blue with probability 1/2, giving R1=2/3R_1 = 2/3. It has 1 red and 2 blue with probability 1/2, giving R1=1/3R_1 = 1/3.
  3. Check the martingale property at the first step: E[R1]=12⋅23+12⋅13=12=R0\mathbb{E}[R_1] = \tfrac{1}{2}\cdot\tfrac{2}{3} + \tfrac{1}{2}\cdot\tfrac{1}{3} = \tfrac{1}{2} = R_0.
  4. Now condition on R1=2/3R_1 = 2/3 (the urn has 2 red and 1 blue). A red draw gives 3 red out of 4, so R2=3/4R_2 = 3/4, with probability 2/32/3. A blue draw gives 2 red out of 4, so R2=1/2R_2 = 1/2, with probability 1/31/3.
  5. Then E[R2∣R1=2/3]=23⋅34+13⋅12=12+16=23=R1\mathbb{E}[R_2 \mid R_1 = 2/3] = \tfrac{2}{3}\cdot\tfrac{3}{4} + \tfrac{1}{3}\cdot\tfrac{1}{2} = \tfrac{1}{2} + \tfrac{1}{6} = \tfrac{2}{3} = R_1.
  6. Interpretation: whatever the early draws were, the expected next red fraction equals the current one. The fraction drifts randomly but does not drift on average.
Example
Gambler's ruin, with a stopping time

Start a symmetric random walk at a=3a = 3 and stop as soon as it reaches 0 or 10. Call the stopping time TT. The walk SnS_n is a martingale. The time TT is not bounded by a fixed number, but it is finite with probability 1 and the walk stopped at TT never leaves [0,10][0, 10], so the second version of optional stopping applies.

  1. Let pp be the probability the walk reaches 10 before 0. At the stopping time, STS_T is 10 with probability pp and 0 with probability 1−p1 - p.
  2. Optional stopping gives E[ST]=S0=3\mathbb{E}[S_T] = S_0 = 3.
  3. Compute the left side: E[ST]=10p+0(1−p)=10p\mathbb{E}[S_T] = 10p + 0(1-p) = 10p.
  4. Solve: 10p=310p = 3, so p=0.3p = 0.3.
  5. Interpretation: starting at 3 in a 0-to-10 interval, the walk has a 30% chance of hitting 10 first. The general answer is a/Na/N, which is the line plotted below.
024681000.20.40.60.81starting position aprobability
  • P(reach 10 before 0) = a/10
Gambler's ruin for a symmetric walk stopped at 0 or 10. Starting at 3, the marked point gives probability 0.3.

Tradeoffs and failure modes

A martingale is a model of fairness, so the real question is when the model is wrong and when its theorems do not apply.

SituationWhat goes wrongBetter choice
Doubling bets after each loss (the historical "martingale" system)Each bet is fair, yet the total risk is huge.Count the chance of ruin, not only the expected gain (see below).
A stopping rule that peeks at the futureOptional stopping fails and the expected gain is no longer zero.Stop only on information available at the time.
Unbounded stopping times or heavy-tailed stepsThe simple theorem can fail, as in the doubling case.Check integrability conditions, or use a bounded horizon.
Assuming zero drift for real dataReal prices and signals have trends.Model the drift explicitly, as a submartingale or after detrending.
Conditioning on the current value onlyThe property can fail in general.Condition on the full history, as the definition requires.

The doubling strategy shows the trap. Bet 1 dollar, then 2 after a loss, then 4, and so on, stopping at the first win. If the first win comes at round kk, the bets lost total 2k−1−12^{k-1} - 1 and the win returns 2k−12^{k-1}, so the net gain is exactly +1. If the first NN rounds all lose, which has probability 2−N2^{-N}, the net loss is 2N−12^N - 1. The expected net gain is

(1−2−N)⋅1+2−N⋅(−(2N−1))=(1−2−N)−(1−2−N)=0.(1 - 2^{-N})\cdot 1 + 2^{-N}\cdot\left(-(2^N - 1)\right) = (1 - 2^{-N}) - (1 - 2^{-N}) = 0.

The expected gain is zero, as a fair game should be. But with N=10N = 10 you win 1 dollar with probability about 0.999, and you lose 1023 dollars with probability about 0.001. The strategy is fair on average and deadly in practice. If you play only up to round NN, the stopping time is bounded and the theorem gives exactly this zero. Playing until the first win is unbounded and the stopped fortune has no lower limit, so the theorem's conditions fail, and the guaranteed +1 is not a free lunch because it needs unlimited funds.

History

The word "martingale" was used in 18th-century France for the doubling betting system above, and the gambler's version of the idea is older than its mathematics. The mathematical term was introduced by Jean Ville in the late 1930s, as part of the work that made probability a study of random processes. Paul Lévy had earlier studied processes with a similar fair-game property, and Joseph Doob built most of the core theory in the 1940s. His 1953 book Stochastic Processes made martingales central, including the convergence theorem for bounded martingales and the optional stopping results.

Martingales came into finance around 1979 to 1981, when Harrison, Kreps and Pliska showed that the absence of arbitrage can be expressed as the existence of a martingale pricing measure. That gave the theory its most famous practical use, and it is why the phrase "fair price" in finance means something precise.

Check yourself

QuestionRecall: state the two conditions for a sequence X0,X1,…X_0, X_1, \dots to be a martingale with respect to a filtration Fn\mathcal{F}_n.Show answer

The sequence must be adapted to the filtration, with E[∣Xn∣]<∞\mathbb{E}[|X_n|] \lt \infty for every nn. Also, E[Xn+1∣Fn]=Xn\mathbb{E}[X_{n+1} \mid \mathcal{F}_n] = X_n for every nn: given the whole history up to step nn, the expected next value equals the current value.

QuestionComputation: a symmetric walk starts at 4 and stops on reaching 0 or 10. What is the probability it reaches 10 first?Show answer

Let pp be that probability. Optional stopping gives E[ST]=4\mathbb{E}[S_T] = 4, and STS_T is 10 with probability pp and 0 otherwise, so 10p=410p = 4 and p=0.4p = 0.4. This is the general formula a/Na/N with a=4a = 4 and N=10N = 10.

QuestionWhy: the doubling strategy has zero expected gain on every bet. Why can it still ruin a gambler?Show answer

The expected gain is zero, but the distribution is extremely lopsided. Most of the time the gambler gains a small amount, and with small probability the loss is enormous. The bankroll needed to survive the rare long losing streak grows exponentially, and the stopping rule (stop at the first win) has no bound on the losses along the way, so the optional stopping theorem's conditions fail and it does not protect against this. Expected value alone hides the risk.

QuestionApplied: a rule says to keep betting on a fair coin until you are 3 dollars ahead, or until 100 flips have passed, whichever comes first. Starting from 0 dollars, is the expected final fortune 0?Show answer

Yes. The rule is a stopping time, and it is bounded by 100 flips, so the bounded optional stopping theorem applies. The expected final fortune equals the starting fortune of 0. The 100-flip limit is what makes the result hold: without it, the rule is the unbounded case and the theorem would not guarantee the answer.

Sources