Statistics Homework 11 — Brownian Motion
Problem Statement
In previous homeworks, we explored discrete random walks (Homework 7) with steps of \(\pm 1\) at discrete time points, and Poisson processes (Homework 10) that introduced continuous time with discrete jumps. Now we take the final step: a continuous-time, continuous-space random walk—the celebrated Brownian motion (also known as the Wiener process).
Brownian motion is the mathematical limit of a random walk as both the time step and the spatial step size approach zero in a coordinated manner. Instead of discrete \(\pm 1\) jumps, each increment follows a Normal (Gaussian) distribution. This process is fundamental in fields ranging from mathematical finance (modeling stock prices) to physics (describing diffusion) to cybersecurity (modeling stochastic attack patterns and system reliability).
The recursive formula for our simulation is: \[ Y_t = Y_{t-1} + Z_t, \quad Z_t \sim \mathcal{N}(\mu, \sigma^2) \] where \(Z_t\) represents the normally-distributed increment at each time step.
From Discrete to Continuous: The Limiting Process
The Discrete Random Walk Revisited
Recall the simple symmetric random walk from Homework 7, where at each discrete time step \(n\), the position changes by \(\pm 1\) with equal probability (analogous to a fair coin flip): \[ S_n = S_{n-1} + X_n, \quad X_n \in \{-1, +1\} \text{ with } P(X_n = +1) = P(X_n = -1) = \frac{1}{2} \]
The key statistics of this process after \(n\) steps are:
- Expected value: \(\mathbb{E}[S_n] = 0\)
- Variance: \(\text{Var}(S_n) = n\)
- Standard deviation: \(\sigma_{S_n} = \sqrt{n}\)
Donsker's Invariance Principle
Donsker's theorem (also called the Functional Central Limit Theorem) establishes that the properly rescaled random walk converges to Brownian motion. Specifically, if we define the rescaled process: \[ W^{(n)}(t) = \frac{1}{\sqrt{n}} S_{\lfloor nt \rfloor}, \quad t \in [0, 1] \] then as \(n \to \infty\), the process \(W^{(n)}(t)\) converges in distribution to a standard Brownian motion \(W(t)\).
The rescaling factor \(\frac{1}{\sqrt{n}}\) is crucial: it ensures that the variance at time \(t = 1\) remains equal to 1, regardless of the number of steps \(n\).
Standard Brownian Motion: Definition
A standard Brownian motion (or Wiener process) \(\{W(t)\}_{t \geq 0}\) is a continuous-time stochastic process satisfying:
- Initial condition: \(W(0) = 0\) almost surely
- Independent increments: For \(0 \leq s < t\), the increment \(W(t) - W(s)\) is independent of the process up to time \(s\)
- Gaussian increments: For \(0 \leq s < t\), we have \(W(t) - W(s) \sim \mathcal{N}(0, t - s)\)
- Continuous paths: The sample paths \(t \mapsto W(t)\) are continuous almost surely
These properties imply that:
- \(W(t) \sim \mathcal{N}(0, t)\) for any \(t > 0\)
- \(\mathbb{E}[W(t)] = 0\) and \(\text{Var}(W(t)) = t\)
- The covariance structure is \(\text{Cov}(W(s), W(t)) = \min(s, t)\)
Brownian Motion with Drift
General Form
The Brownian motion with drift extends the standard Wiener process by adding a deterministic linear trend: \[ Y(t) = \mu t + \sigma W(t) \] where:
- \(\mu\) is the drift coefficient (rate of deterministic growth)
- \(\sigma\) is the volatility (diffusion coefficient)
- \(W(t)\) is the standard Brownian motion
Statistical Properties
For the process with drift: \[ \mathbb{E}[Y(t)] = \mu t \] \[ \text{Var}(Y(t)) = \sigma^2 t \] \[ Y(t) \sim \mathcal{N}(\mu t, \sigma^2 t) \]
The drift parameter \(\mu\) controls the expected direction of the trajectory:
- \(\mu > 0\): upward trend (positive drift)
- \(\mu = 0\): no trend (symmetric diffusion)
- \(\mu < 0\): downward trend (negative drift)
Discrete-Time Simulation
To simulate Brownian motion on a computer, we discretize time into \(n\) steps with time increment \(\Delta t = T/n\). At each step: \[ Y_{t+\Delta t} = Y_t + \mu \Delta t + \sigma \sqrt{\Delta t} \cdot Z, \quad Z \sim \mathcal{N}(0, 1) \]
Equivalently, the increment at each step follows: \[ \Delta Y \sim \mathcal{N}(\mu \Delta t, \sigma^2 \Delta t) \]
The factor \(\sqrt{\Delta t}\) in the noise term is essential for correct scaling—it ensures that the variance of the process grows linearly with time, as required by the continuous-time limit.
Generating Normal Random Variables: The Box-Muller Transform
The Challenge
Simulating Brownian motion requires generating normally distributed random numbers. However, most programming environments provide only uniformly distributed random numbers on \([0, 1]\). The Box-Muller transform is an elegant method to convert uniform random variables into standard normal random variables.
Mathematical Derivation
Given two independent uniform random variables \(U_1, U_2 \sim \text{Uniform}(0, 1)\), the Box-Muller transform produces two independent standard normal random variables: \[ Z_1 = \sqrt{-2 \ln U_1} \cdot \cos(2\pi U_2) \] \[ Z_2 = \sqrt{-2 \ln U_1} \cdot \sin(2\pi U_2) \]
The proof relies on the polar representation of two-dimensional Gaussian distributions. If \(Z_1\) and \(Z_2\) are independent \(\mathcal{N}(0,1)\) random variables, then:
- The squared radius \(R^2 = Z_1^2 + Z_2^2 \sim \chi^2_2 = \text{Exp}(1/2)\)
- The angle \(\Theta = \arctan(Z_2/Z_1) \sim \text{Uniform}(0, 2\pi)\)
- \(R\) and \(\Theta\) are independent
The Box-Muller transform inverts this relationship: from uniform radius and angle, we recover Cartesian coordinates that are standard normal.
General Normal Generation
To generate \(X \sim \mathcal{N}(\mu, \sigma^2)\) from a standard normal \(Z \sim \mathcal{N}(0, 1)\): \[ X = \mu + \sigma Z \] This is a linear transformation that shifts the mean and scales the variance appropriately.
Alternative Methods
Other methods for normal generation include:
- Inverse CDF method: \(Z = \Phi^{-1}(U)\) using the probit function, but requires computing the inverse of the error function
- Ziggurat algorithm: Faster for high-performance applications, uses precomputed lookup tables
- Marsaglia polar method: A variant of Box-Muller that avoids trigonometric functions
Properties of Brownian Motion Paths
Continuity and Non-Differentiability
Brownian motion paths exhibit a remarkable dichotomy:
- Continuous everywhere: The paths have no jumps or discontinuities
- Differentiable nowhere: The paths are so irregular that they have no derivative at any point
This non-differentiability arises because the increments over any interval, no matter how small, have non-trivial variance. Intuitively, the path exhibits high-frequency fluctuations at every scale.
Self-Similarity and Scaling
Brownian motion exhibits statistical self-similarity: zooming in on any portion of a path reveals structure that is statistically identical to the whole path. Mathematically: \[ \{W(ct)\}_{t \geq 0} \stackrel{d}{=} \{c^{1/2} W(t)\}_{t \geq 0} \] for any \(c > 0\). This property is fundamental to fractal geometry and has deep implications in mathematical finance.
Quadratic Variation
Unlike smooth functions, Brownian motion has non-zero quadratic variation. For a partition \(0 = t_0 < t_1 < \cdots < t_n = T\): \[ \sum_{i=1}^{n} [W(t_i) - W(t_{i-1})]^2 \xrightarrow{n \to \infty} T \] almost surely. This property is crucial in stochastic calculus (Itô calculus) and financial mathematics.
Recurrence and Transience
In one dimension, Brownian motion is recurrent: the process returns to any neighborhood of its starting point infinitely often with probability 1. However, in dimensions \(\geq 3\), Brownian motion is transient: it eventually escapes to infinity.
Applications in Cybersecurity and Computer Science
Modeling System Performance
Brownian motion models are used to analyze:
- Cumulative system degradation: Hardware reliability over time, where small random fluctuations accumulate
- Network latency: Continuous fluctuations in packet transmission times
- Resource consumption: Memory usage or CPU load with stochastic variation
Stochastic Models for Security
In security contexts, Brownian motion appears in:
- Attack pattern modeling: Continuous-time evolution of attack intensity
- Risk score dynamics: Security posture that fluctuates over time
- Anomaly detection: Deviations from expected Brownian behavior signal potential attacks
Financial Cryptography
The famous Black-Scholes model for option pricing assumes that asset prices follow geometric Brownian motion: \[ dS_t = \mu S_t \, dt + \sigma S_t \, dW_t \] This model underpins much of modern quantitative finance, including cryptocurrency derivatives and DeFi protocols.
Randomized Algorithms
Brownian motion provides theoretical foundations for:
- Random walks on graphs: Used in network analysis, PageRank, and Markov Chain Monte Carlo
- Stochastic optimization: Simulated annealing and other optimization heuristics
- Randomized testing: Fuzzing strategies that explore program state spaces
Interactive Simulation: Brownian Motion Trajectories
This simulation generates multiple realizations of Brownian motion with drift. Each trajectory follows \(Y_t = Y_{t-1} + Z_t\) where \(Z_t \sim \mathcal{N}(\mu \Delta t, \sigma^2 \Delta t)\). The Normal increments are generated using the Box-Muller transform from uniform random numbers. Adjust the parameters to explore how drift, volatility, and time discretization affect the process behavior.
Expected rate of change per unit time
Standard deviation of increments (diffusion coefficient)
Total simulation time [0, T]
Discretization fineness (Δt = T/n)
Number of independent realizations
For reproducible simulations
Click "Generate Trajectories" to begin simulation...
Trajectory Visualization
Final Position Distribution
The empirical distribution of \(Y(T)\) values across all trajectories (bars) compared with the theoretical \(\mathcal{N}(\mu T, \sigma^2 T)\) density (red curve).
Box-Muller Transform Demonstration
This visualization shows the transformation from uniform random pairs \((U_1, U_2)\) to normal random pairs \((Z_1, Z_2)\) using the Box-Muller method.
Understanding the Simulation: Each trajectory starts at \(Y(0) = 0\) and evolves via normally-distributed increments \(Z_t \sim \mathcal{N}(\mu \Delta t, \sigma^2 \Delta t)\). The drift \(\mu\) tilts trajectories upward (\(\mu > 0\)) or downward (\(\mu < 0\)), while volatility \(\sigma\) controls the spread. As the number of time steps \(n\) increases, the discretization becomes finer, yielding smoother approximations to true continuous Brownian motion. The Box-Muller transform generates these Normal increments from uniform random numbers.
Observations and Questions
Click on each question to reveal the answer and deepen your understanding.
Conclusion
Brownian motion represents the pinnacle of random walk theory: a continuous-time, continuous-space stochastic process that arises as the natural limit of discrete random walks. Its defining properties—independent Gaussian increments, continuous paths, and characteristic \(\sqrt{t}\) scaling—make it a fundamental model in probability theory, physics, and mathematical finance.
The simulation techniques developed here—particularly the Box-Muller transform for generating normal random variables—are essential tools in computational statistics and Monte Carlo methods. By implementing and visualizing Brownian motion, we gain intuition about stochastic processes that pervade models of uncertainty across engineering, science, and security applications.
Key takeaways:
- Normal increments replace the discrete \(\pm 1\) steps, enabling continuous paths
- Drift \(\mu\) controls the expected trajectory direction
- Volatility \(\sigma\) controls the spread and uncertainty
- The Box-Muller transform converts uniform randomness to Gaussian randomness
- Brownian motion is the scaling limit of discrete random walks (Donsker's theorem)
References
- Mörters, P. & Peres, Y. (2010). Brownian Motion. Cambridge University Press.
- Karatzas, I. & Shreve, S. E. (1991). Brownian Motion and Stochastic Calculus (2nd ed.). Springer.
- Øksendal, B. (2003). Stochastic Differential Equations: An Introduction with Applications (6th ed.). Springer.
- Box, G. E. P. & Muller, M. E. (1958). A note on the generation of random normal deviates. The Annals of Mathematical Statistics, 29(2), 610–611.