Variation & Martingales

Chapter 1 ended with bad news: a Brownian path is too rough to have a slope anywhere. This chapter finds what does behave well, and it is exactly what the new calculus will be built on.

2.1Quadratic Variation

Cut the time from 0 to 1 into n equal pieces. In each piece, measure how much the path rises or falls. Then add up those changes in two ways: their sizes, and their squares.

Predict first: As the ruler gets finer, what will happen to the sum of squared rises?

The grey curve is one Brownian path. The orange line is our "ruler": straight segments joining the path's values at the cut points. Drag n up. The path never changes, only the ruler gets finer. Watch the two totals below it.

$$\sum_{i=1}^{n} \lvert \Delta W_i \rvert \;\longrightarrow\; \infty, \qquad \sum_{i=1}^{n} (\Delta W_i)^2 \;\longrightarrow\; t \qquad \text{as } n \to \infty$$
$n$
The number of equal pieces the time interval is cut into. The slider sets it.
$\Delta W_i$
The rise of the path across piece number $i$: its value at the piece's right end minus its value at the left end. It is negative if the path fell.
$\sum_{i=1}^{n}$
"Add up, for $i = 1, 2, \dots, n$": one term for every piece. The Greek letter Σ ("sigma") stands for sum.
$\lvert \Delta W_i \rvert$
The size of the rise, ignoring whether it went up or down. Adding these up measures how much ground the path covers. For a curve, that is its total up-and-down travel, called its total variation.
$(\Delta W_i)^2$
The rise multiplied by itself. Adding these up gives the quadratic variation ("quadratic" means "squared").
$t$
The length of the time interval, here $t = 1$.
$\longrightarrow \infty$, $\longrightarrow t$
"Grows without limit" and "settles down to exactly $t$" as the pieces get finer.

In plain words: each piece has width $1/n$, so by section 1.3 its rise is about $\sqrt{1/n}$. That is much bigger than $1/n$. Add up $n$ of those sizes and you get about $\sqrt n$, which grows forever: a Brownian path is infinitely long, so its length can't even be measured. Squares tell a different story. Each squared rise averages exactly $1/n$ (section 1.2), so $n$ of them average exactly 1. And because there are so many independent pieces, their random ups and downs cancel out, the same way many coin flips average out to half heads. So a random path gives a sum of squares that is not random at all: exactly $t$.

Each panel adds up its sum from left to right, so its height at time $t$ is the total up to $t$. The purple panel rescales to fit, so read its "total" label. The blue panel has a fixed scale, and the dashed diagonal marks the value $t$.

Going deeper: the precise statement

Theorem. For partitions $0 = t_0 < t_1 < \dots < t_n = t$ whose largest gap tends to 0, $\sum_i (W_{t_{i+1}} - W_{t_i})^2 \to t$. The convergence holds in mean square, and with probability 1 if the gaps shrink fast enough, as with the halving partitions used here. We write $[W]_t = t$.

Proof sketch. The sum has mean $\sum_i (t_{i+1} - t_i) = t$. Because the pieces are independent, its variance is $\sum_i 2(t_{i+1} - t_i)^2 \le 2t \cdot \max_i (t_{i+1} - t_i) \to 0$. A quantity whose variance tends to 0 converges to its mean.

By contrast, the total variation $\sum_i \lvert W_{t_{i+1}} - W_{t_i} \rvert$ tends to infinity with probability 1. That is why the Riemann–Stieltjes integral of ordinary calculus can't be used with $dW$.

Reference: Shreve, Stochastic Calculus for Finance II, §3.4.

Show the code (Python + NumPy)
import numpy as np
rng = np.random.default_rng(4)
N = 2 ** 16
W = np.concatenate([[0], np.cumsum(rng.normal(0, np.sqrt(1 / N), N))])   # one path on [0, 1]
for n in (4, 256, 65_536):
    dW = np.diff(W[:: N // n])                        # rises over n equal pieces
    print(f"n = {n:>6}: sum |dW| = {np.abs(dW).sum():8.2f}   sum dW^2 = {(dW ** 2).sum():.4f}")

Output when we ran it:

n =      4: sum |dW| =     1.90   sum dW^2 = 1.0518
n =    256: sum |dW| =    12.22   sum dW^2 = 0.9188
n =  65536: sum |dW| =   204.54   sum dW^2 = 0.9988

2.2Martingales

Suppose you have watched a Brownian path up to some moment s. What is your best forecast for where it will be later? Freeze the orange path at time s, and let the computer play out 400 possible futures from that point (60 are drawn in grey). The thick blue line is their average.

Predict first: Switch to W². Where will the average of the futures go?

Drag s anywhere. Then switch to $W^2$, and finally to $W^2 - t$.

$$\mathbb{E}\big[\, W_t \;\big|\; \mathcal{F}_s \big] = W_s \quad\text{and}\quad \mathbb{E}\big[\, W_t^2 - t \;\big|\; \mathcal{F}_s \big] = W_s^2 - s \qquad (s \le t)$$
$s,\ t$
"Now" ($s$, the freeze time) and a later time $t$. The chart runs to $t = 1$.
$\mathbb{E}[\;\cdot\;]$
The expected value: the average over all possible futures. The blue line estimates it with 400 simulated futures.
$\big|\ \mathcal{F}_s$
"Given everything that has happened up to time $s$". The bar means "given", and $\mathcal{F}_s$ stands for the whole history of the path so far (the orange part).
$W_s$
Where the path is at the freeze time: the orange dot.
$W_t^2 - t$
The path's value squared, minus the time. Squares are never negative, so $W^2$ tends to drift upward. It drifts at exactly rate 1 (section 1.2: the average squared rise equals elapsed time), and subtracting $t$ cancels that drift.
martingale
A random process whose best forecast of any future value is simply its current value: $\mathbb{E}[\text{later} \mid \text{history}] = \text{now}$.

In plain words: Brownian motion is a fair game. Whatever path it took to get here, its next move is as likely to be up as down, so on average the futures stay exactly where you are now: the blue line runs flat along the dashed line. $W^2$ is not fair: it tilts upward by exactly the time remaining. Subtract the time, and $W^2 - t$ is fair again. That "minus $t$" is the quadratic variation from section 2.1 showing up in disguise.

Orange: the history up to $s$. Grey: possible futures. Blue: their average. Dashed: the frozen value carried forward.

Going deeper: the precise statement

Definition. A process $M_t$ is a martingale with respect to the history (filtration) $\mathcal F_t$ if it depends only on the history up to time $t$, has $\mathbb E\lvert M_t \rvert < \infty$, and satisfies $\mathbb E[M_t \mid \mathcal F_s] = M_s$ for all $s \le t$.

Examples from Brownian motion: $W_t$, $W_t^2 - t$, and $\exp(\lambda W_t - \tfrac12 \lambda^2 t)$ for any number $\lambda$. The last one reappears as the Girsanov weight in section 6.2.

Lévy's characterisation. A continuous martingale $M$ with $M_0 = 0$ for which $M_t^2 - t$ is also a martingale must be a Brownian motion. The two martingales in this section are therefore enough to pin Brownian motion down completely.

Reference: Shreve, Stochastic Calculus for Finance II, §2.3 and §3.3; Lévy's characterisation is §4.6.3.

Show the code (Python + NumPy)
import numpy as np
rng = np.random.default_rng(5)
s, W_s = 0.4, 0.3                                    # freeze time and the value there
W_1 = W_s + rng.normal(0, np.sqrt(1 - s), 100_000)   # possible values at t = 1
print(f"E[W_1]       = {W_1.mean():.3f}  (W_s = {W_s})")
print(f"E[W_1^2]     = {(W_1 ** 2).mean():.3f}  (W_s^2 + 1 - s = {W_s ** 2 + 1 - s:.3f})")
print(f"E[W_1^2 - 1] = {(W_1 ** 2 - 1).mean():.3f}  (W_s^2 - s = {W_s ** 2 - s:.3f})")

Output when we ran it:

E[W_1]       = 0.301  (W_s = 0.3)
E[W_1^2]     = 0.689  (W_s^2 + 1 - s = 0.690)
E[W_1^2 - 1] = -0.311  (W_s^2 - s = -0.310)

2.3Reflection Principle

How likely is a Brownian path to reach a level $a$ at some point before time 1? Counting that directly seems hard, because you'd have to watch every moment. The reflection principle turns it into an easy question about where the path ends.

Predict first: Drag the level to a = 1. About what fraction of paths reach it before t = 1?

Drag the level $a$. Grey paths never reach it, blue paths do. When the orange path first touches the level, its future is mirrored in the level (dashed): every rise becomes a fall and every fall a rise.

$$P\Big(\max_{s \le t} W_s \ge a\Big) \;=\; 2\,P\big(W_t \ge a\big) \qquad (a > 0)$$
$a$
The level, above the starting point 0. The slider sets it.
$\max_{s \le t} W_s$
The highest point the path reaches at any time $s$ up to $t$ (here $t = 1$).
$P(\;\cdot\;)$
The probability: the fraction of all possible paths for which the statement in brackets is true. The stats line estimates it by counting 3,000 simulated paths.
$P(\max \ge a)$
The fraction of paths that reach the level at some point: the blue ones.
$P(W_t \ge a)$
The fraction of paths that end at or above the level. This is easy to compute, because $W_t$ follows a bell curve (section 1.1). It is the area under the bell curve to the right of $a$.

In plain words: take any path that reaches the level but ends below it. Mirror everything after its first touch, and you get a path that ends above the level. From the moment of first touch, the path's future is a fresh Brownian motion that ignores its past (section 1.2), and rises and falls are symmetric. So the mirrored future is exactly as likely as the original one. So the paths that reach the level split evenly into two equal-sized groups: those ending above it, and their mirror twins ending below. Counting only the paths that end above the level and doubling the count gives all the paths that reached it.

The level is checked at 2,000 time points per path, so a path that brushes the level between two checks is missed. That makes "reached" read slightly low, typically by about one percentage point, which is about the size of the random noise.

Going deeper: the precise statement

Precise statement. Let $M_t = \max_{s \le t} W_s$. For $a > 0$ and $b \le a$: $P(M_t \ge a,\ W_t \le b) = P(W_t \ge 2a - b)$. Setting $b = a$ and adding $P(W_t \ge a)$ gives the formula in this section.

Why it works: the strong Markov property. At the first hitting time $\tau_a = \min\{t : W_t = a\}$, which is a random time, the future $W_{\tau_a + s} - a$ is a fresh Brownian motion, independent of everything before $\tau_a$. Its mirror image is therefore just as likely.

A surprising consequence. $\tau_a$ has density $\dfrac{a}{\sqrt{2\pi t^3}}\, e^{-a^2/2t}$. Every level is reached eventually, with probability 1, yet the average waiting time is infinite.

References: Shreve, Stochastic Calculus for Finance II, §3.7. Mörters & Peres, Brownian Motion, §2.2.

Show the code (Python + NumPy)
import numpy as np
from math import erf, sqrt
rng = np.random.default_rng(6)
paths, steps, a = 10_000, 1_000, 1.0
W = np.cumsum(rng.normal(0, sqrt(1 / steps), (paths, steps)), axis=1)
reached = (W.max(axis=1) >= a).mean()                 # ever touched level a
ended_above = (W[:, -1] >= a).mean()
theory = 2 * (1 - 0.5 * (1 + erf(a / sqrt(2))))
print(f"reached a: {reached:.3f}   2 x ended above: {2 * ended_above:.3f}   theory: {theory:.3f}")

Output when we ran it:

reached a: 0.302   2 x ended above: 0.314   theory: 0.317

Chapter recap

Quick questions on this chapter's big ideas. Each answer is explained as soon as you choose.

1. Cut the interval from 0 to 2 into many tiny pieces. The sum of squared rises of a Brownian path approaches…

2. Which of these is a martingale (a fair game)?

3. About 10% of Brownian paths end above a level a at time 1. What fraction reach a at some moment before time 1?