Maths for Machines
0 of 10 lessons done100 questions

Lesson 1 of 10

Random walks and Brownian motion

A random walk takes random steps on a clock. Brownian motion is its continuous-time, properly scaled limit.

Core lesson · about 5 minutes · 3 guided parts

A child flips a coin every second: heads steps right, tails steps left. Speed up the flips and shrink each step to see a jittery continuous path.

Your learning route

Build the idea one piece at a time

  1. Discrete random walks
  2. Brownian motion as a scaling limit
  3. Scale a random walk into Brownian units
Random walks and Brownian motion, made visible
tiny random moves form a modelled path

Discrete random walks

Independent step effects add in the mean, while their uncertainty adds in variance.

Let Sₙ be the sum of independent steps X₁ through Xₙ, where each step is +1 with probability p and −1 otherwise.

E[Sₙ]=n(2p−1); for a fair walk the mean is 0 and Var(Sₙ)=n.

Typical distance grows like √n, not n, because positive and negative steps cancel partly.

Write each step as +1 or −1 and add them. For a fair walk, positive and negative means cancel, but squared uncertainty cannot cancel, so n independent step variances add to n.

Standard deviation is the square root of variance, which makes typical displacement grow like sqrt(n). After 100 fair steps, being around 10 places from the start is ordinary, while 100 places would require every step to point the same way.

Positions share history: S_20 contains all ten steps already inside S_10. That is why increments from disjoint time intervals can be independent even though the positions S_10 and S_20 are not.

Random walks model cumulative measurement error, inventory changes, and simplified price moves. They are useful baselines because the variance scaling is explicit; persistent trends, boundaries, and dependent steps must be added when reality shows them.

In symbolsSₙ=ΣᵢXᵢ; fair walk: E[Sₙ]=0 and Var(Sₙ)=n

Worked example

For a fair ±1 random walk after 25 steps, find the mean and standard deviation of position.

  1. Each step has mean 0 and variance 1.
  2. Independent variances add, so Var(S₂₅)=25.
  3. The standard deviation is √25=5.

Answer: Mean 0; standard deviation 5

Brownian motion as a scaling limit

Brownian motion has continuous paths but new Gaussian noise at every time scale, making paths almost surely nowhere differentiable.

Standard Brownian motion has W₀=0, independent increments, and Wₜ−Wₛ~N(0,t−s) for t>s.

Its covariance is Cov(Wₛ,Wₜ)=min(s,t), and increments scale like √Δt.

Brownian motion is an idealized model; real data can have jumps, memory, bounded speeds, or changing variance.

Brownian motion keeps the same square-root scaling while making time continuous. Over a gap Δt, the increment is normal with variance Δt and standard deviation sqrt(Δt), no matter where the interval starts.

Independent increments mean future changes are independent of the completed past, not that the future position forgets the current position. Wₜ equals its current level plus a fresh increment.

Continuity and roughness coexist: the path has no jumps, yet it wiggles so intensely at every scale that an ordinary velocity derivative almost surely does not exist. Stochastic calculus was built for exactly this behavior.

Diffusion models add carefully scaled Gaussian noise over many small steps until data becomes nearly noise, then learn a reverse denoising direction. Brownian scaling explains why each noise increment uses sqrt(Δt), while the learned drift tells how the distribution should move.

In symbolsWₜ−Wₛ ~ N(0, t−s)

Worked example

For standard Brownian motion, what are the mean and variance of W₅−W₂?

  1. The time gap is 5−2=3.
  2. A Brownian increment has mean 0.
  3. Its variance equals the time gap, so it is 3.

Answer: Mean 0; variance 3

Practical deep dive for this lesson

Scale a random walk into Brownian units

To obtain a nontrivial continuous limit, speed up the number of steps while shrinking each step by the square root of that number.

After n fair steps, variance is n. Dividing position by sqrt(n) makes variance one, so the scaled process neither explodes nor collapses as n grows.

For time t, use roughly nt steps and scale by 1/sqrt(n). The resulting variance is nt/n≈t, matching the defining Brownian increment variance.

This scaling explains the sqrt(dt) noise in simulations. Using dt would make accumulated variance vanish; using an unscaled fixed jump would make paths explode as time steps become numerous.

In symbolsW(t) ≈ S at step floor(nt) divided by √n

Worked example

A scaled fair walk uses n=400 steps per unit time. What raw-step count and position scale represent t=2.25?

  1. Compute the step count floor(400×2.25)=900.
  2. Compute the spatial denominator sqrt(400)=20.
  3. Represent the Brownian position by S_900/20.
  4. Check its variance: Var(S_900/20)=900/400=2.25, matching t.

Answer: Use 900 steps and scale position by 1/20

Check your picture

What is Cov(W₂,W₇) for standard Brownian motion?

Reveal answer

min(2,7)=2

This lesson versus the whole chapter

Your topic-specific practical example is above.

The final lesson collects five longer chapter-wide workflows for machine learning, LLMs, trading, physics, and everyday decisions.

Formula shelf

Symbols with meaning

Brownian incrementWₜ−Wₛ ~ N(0,t−s)

Independent Gaussian change with variance equal to elapsed time.

Markov evolutionπₙ=π₀Pⁿ

Move a state distribution through n transitions.

Martingale conditionE[Mₜ₊₁ | 𝔽ₜ]=Mₜ

Conditional fair-game property.

Itô isometryE(∫H dW)²=E∫H²dt

Variance rule for square-integrable Itô integrals.

Itô's lemmadf=(fₜ+afₓ+½b²fₓₓ)dt+bfₓdW

Chain rule corrected for quadratic variation.

Multidimensional generator𝓛f=a·∇f+½tr(BBᵀ Hess f)

Local expected change of a smooth test function.

Stratonovich conversiona(Itô)=a(Stratonovich)+½bb′

Move the midpoint-integral correction into scalar drift.

Euler–MaruyamaΔX≈aΔt+b√Δt Z

Discrete simulation step for an Itô SDE.

Fokker–Planck∂p/∂t=−∇·(ap)+½Σᵢⱼ∂ᵢⱼ(Dᵢⱼp)

Forward evolution of a diffusion's probability density.

Feynman–Kac∂u/∂t+𝓛u−cu=0

Backward PDE for a discounted future expectation.

GBM solutionSₜ=S₀exp[(μ−σ²/2)t+σWₜ]

Positive lognormal solution under constant-coefficient GBM assumptions.

Before moving on

You are ready when you can…

  • Relate random walks to Brownian scaling
  • Compute Markov transitions and stationary distributions
  • Recognize stopping times and state valid optional-stopping and martingale-convergence conditions
  • Apply one- and multidimensional Itô formulas and convert scalar Stratonovich equations
  • Distinguish strong from weak solutions and strong from weak numerical error
  • Use generators and the Fokker–Planck equation to connect paths with densities
  • Explain the assumptions and roles of Girsanov and Feynman–Kac
  • Read, simulate, solve simple SDEs, and critique GBM assumptions