CONTENTS

Solution: Quadratic Variation by Simulation

Part 1 — Single-path quadratic variation

# Python import numpy as np rng = np.random.default_rng(42) def simulate_path(n, T=1.0): dt = T / n dW = rng.normal(0, np.sqrt(dt), size=n) return dW for n in [10, 100, 1000, 10000]: dW = simulate_path(n) Q_n = np.sum(dW ** 2) print(f"n = {n:5d} Q_n = {Q_n:.4f}") # n = 10 Q_n = 0.8761 # n = 100 Q_n = 0.9635 # n = 1000 Q_n = 0.9975 # n = 10000 Q_n = 0.9942

QnQ_n hovers around T=1T = 1 already at n=100n = 100 and is within a fraction of a percent at n=10,000n = 10{,}000. The convergence is clear and fast.

Part 2 — First-order variation

# Python rng = np.random.default_rng(42) for n in [10, 100, 1000, 10000]: dW = simulate_path(n) V_n = np.sum(np.abs(dW)) print(f"n = {n:5d} V_n = {V_n:.4f}") # n = 10 V_n = 2.4067 # n = 100 V_n = 7.9212 # n = 1000 V_n = 25.2168 # n = 10000 V_n = 79.7416

VnV_n grows roughly as n\sqrt{n}: going from n=100n = 100 to n=10,000n = 10{,}000 (a factor of 100) increases VnV_n by a factor of about 10. This is consistent with the theoretical result

E[Vn]=nE[ΔW]=n2Δtπ=2nπT\mathbb{E}[V_n] = n \cdot \mathbb{E}[|\Delta W|] = n \cdot \sqrt{\tfrac{2\Delta t}{\pi}} = \sqrt{\tfrac{2n}{\pi}} \cdot \sqrt{T}
(using E[Z]=2/π\mathbb{E}[|Z|] = \sqrt{2/\pi} for ZN(0,1)Z \sim \mathcal{N}(0, 1)), which diverges as nn \to \infty. Total variation is infinite in the refinement limit — this is the rigorous fact behind the claim that WW is not of bounded variation.

Part 3 — Empirical distribution of QnQ_n

# Python rng = np.random.default_rng(0) N = 1000 n = 1000 T = 1.0 Q_samples = np.empty(N) for k in range(N): dW = rng.normal(0, np.sqrt(T / n), size=n) Q_samples[k] = np.sum(dW ** 2) mean_Q = Q_samples.mean() std_Q = Q_samples.std(ddof=1) theoretical_std = np.sqrt(2 * T**2 / n) print(f"Empirical mean(Q_n) = {mean_Q:.4f} (theoretical 1.0000)") print(f"Empirical std(Q_n) = {std_Q:.4f} (theoretical {theoretical_std:.4f})") # Empirical mean(Q_n) = 1.0012 (theoretical 1.0000) # Empirical std(Q_n) = 0.0446 (theoretical 0.0447)
The mean is indistinguishable from T=1T = 1 and the standard deviation matches 2T2/n=2/10000.0447\sqrt{2T^2/n} = \sqrt{2/1000} \approx 0.0447 to three decimal places. At finite nn, QnQ_n is a random quantity — it fluctuates around TT with spread 2T2/n\sqrt{2T^2/n}. The convergence QnTQ_n \to T in L2L^2 is exactly the statement that this spread vanishes as nn \to \infty.

Part 4 — Why both statements are consistent

The two sums behave differently because of how they weight increments of typical size Δt\sqrt{\Delta t}. Each ΔWiΔt|\Delta W_i| \sim \sqrt{\Delta t}, so:

  • First-order variation: Vn=ΔWinΔt=nTV_n = \sum |\Delta W_i| \sim n \cdot \sqrt{\Delta t} = \sqrt{n}\cdot\sqrt{T} \to \infty.
  • Quadratic variation: Qn=(ΔWi)2nΔt=TQ_n = \sum (\Delta W_i)^2 \sim n \cdot \Delta t = T (finite).
The squaring converts a term of size Δt\sqrt{\Delta t} into one of size Δt\Delta t, which when summed n=T/Δtn = T/\Delta t times yields exactly TT. The absolute value does not, so the sum of absolute increments blows up. This is the defining signature of a rough path: infinite variation at first order, finite variation at order 2.

Takeaways

  • Quadratic variation converges to TT fast. At n=1000n = 1000 the relative error is already sub-percent — this is why "(dW)2=dt (dW)^2 = dt" is such a useful calculus rule in practice.
  • First-order variation diverges. This is the rigorous reason the Itô integral fdW\int f\,dW cannot be defined pathwise as a Riemann-Stieltjes integral — WW has no finite variation to integrate against.
  • QnQ_n is random for finite nn and deterministic in the limit. The standard deviation 2T2/n\sqrt{2T^2/n} is a useful diagnostic: when simulating a discretised SDE, the pathwise "energy" (ΔW)2\sum(\Delta W)^2 should be close to TT, and its fluctuation quantifies your time-step resolution.
  • This exercise is the numerical foundation of Itô's lemma. The 12f(X)dt\frac{1}{2}f''(X)\,dt correction in Itô's lemma is there because (ΔW)2T\sum(\Delta W)^2 \to T, not zero.
Solution — Quadratic Variation by Simulation | q4quant.studio