Search

Search papers and lessons

Random Walk

Level 2 · 9 min read

A random walk is a path built by adding up independent random steps, so its position after n steps spreads out like the square root of n.

On this page

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

TL;DR

A random walk is a path made by repeatedly adding a random step. Start at zero, flip a fair coin, step right on heads and left on tails, and repeat. Where you are after many steps is a sum of many small random pieces, so it wanders, but in a predictable way: the typical distance from the start grows like the square root of the number of steps.

Random walks are the simplest model of anything that moves by accumulating unpredictable nudges, and they are the building block behind many stochastic processes.

Where you'll see it: in the price model behind option pricing, in the jitter of a particle in a fluid, in the noise a diffusion model adds to an image one step at a time, and in the proposal moves of Monte Carlo samplers.

Intuition

A drunk on a line

Picture someone leaving a lamp post, stumbling one step forward or one step back at random. After one step they are one unit away. After four steps they could be anywhere from four units away to the post itself. The question a random walk answers is how far they get, typically, as the steps pile up.

The key observation is that each step is independent of the ones before it. The walker has no memory and no destination. Yet the position is not random in a shapeless way. Most of the probability sits near the start, and the chance of ending very far away falls off quickly.

−30−20−10010203000.10.20.30.4position after n stepsdensity
  • n = 4 steps
  • n = 16 steps
  • n = 100 steps
Smooth Gaussian approximations of where the walker is. The spread grows like the square root of n: quadrupling the steps only doubles the typical distance.

Why the square root

Each step adds a little uncertainty, and independent uncertainties add up in variance, not in distance. Think of it as the same rule as the central limit theorem: a total built from many independent pieces is roughly a bell curve, and its width is set by how much the pieces vary in total. The steps are the same size every time, so the spread grows in proportion to the square root of the step count. This square-root growth is the signature of a random walk. It is what separates diffusion, where things spread out slowly, from straight-line motion, where distance grows in direct proportion to time.

The math

The simple symmetric random walk

Let X1,X2,…X_1, X_2, \dots be independent random steps, each equal to +1+1 or −1-1 with probability 1/21/2 each. Here XiX_i is the step at time ii. The walk is

S0=0,Sn=X1+X2+⋯+Xn.S_0 = 0, \qquad S_n = X_1 + X_2 + \cdots + X_n.

Here SnS_n is the walker's position after nn steps. Each XiX_i is a Bernoulli trial rescaled from {0,1}\{0, 1\} to {−1,+1}\{-1, +1\}: writing Bi=(Xi+1)/2B_i = (X_i + 1)/2 gives a fair coin, so Sn=2(B1+⋯+Bn)−nS_n = 2(B_1 + \cdots + B_n) - n. This ties the walk directly to the binomial distribution of counts.

Mean and variance

A single step has mean E[Xi]=0\mathbb{E}[X_i] = 0 and variance E[Xi2]=1\mathbb{E}[X_i^2] = 1. Because the steps are independent, the variances add:

E[Sn]=0,Var(Sn)=n.\mathbb{E}[S_n] = 0, \qquad \mathrm{Var}(S_n) = n.

The average position stays at zero, which is why the walk has no drift. The variance grows linearly in nn, so the typical distance is n\sqrt{n}. After 100 steps the spread is about 10, not 100.

Approximately Gaussian

Because SnS_n is a sum of many independent pieces, the central limit theorem says that for large nn

Snn≈N(0,1).\frac{S_n}{\sqrt{n}} \approx \mathcal{N}(0, 1).

This is why the plot above is a bell curve. The approximation is what makes random walks easy to analyse with Gaussian tools.

Returning to the start

The probability that the walk is back at zero after 2m2m steps is exactly

P(S2m=0)=(2mm)14m.P(S_{2m} = 0) = \binom{2m}{m} \frac{1}{4^m}.

The walk can only sit at zero after an even number of steps, since each step changes the parity of the position. For large mm, Stirling's approximation simplifies this to

P(S2m=0)≈1πm.P(S_{2m} = 0) \approx \frac{1}{\sqrt{\pi m}}.

The probability of being home decays, but only slowly. Summing these probabilities over all mm gives infinity, which has a famous consequence explained in the next section.

Recurrence

Let rr be the probability that a walk started at zero eventually returns to zero. In one dimension, the walk returns with probability 11: it always comes back, although the expected waiting time is infinite. In two dimensions, the same holds. In three dimensions, the return probability is about 0.340.34, so the walk escapes forever with probability about 0.660.66. This was proved by George Pólya in 1921, and it is one of the cleanest facts about random walks.

Worked examples

Example
Counting paths for four steps

Take four steps. The possible positions and their probabilities:

  1. There are 24=162^4 = 16 equally likely step sequences.
  2. To end at 00 you need two +1+1 steps and two −1-1 steps. There are (42)=6\binom{4}{2} = 6 such sequences.
  3. So P(S4=0)=6/16=0.375P(S_4 = 0) = 6/16 = 0.375.
  4. To end at +4+4 you need all four steps to be +1+1. There is only one sequence, so P(S4=4)=1/16=0.0625P(S_4 = 4) = 1/16 = 0.0625.
  5. Interpretation: four steps leave the walker exactly home more than a third of the time, but reaching the farthest point is rare.
Example
Typical distance after 100 steps

Consider a walk of n=100n = 100 steps.

  1. The variance is Var(S100)=100\mathrm{Var}(S_{100}) = 100, so the standard deviation is 100=10\sqrt{100} = 10.
  2. Using the Gaussian approximation, the chance of being within two standard deviations of zero is about 0.950.95. So P(∣S100∣≤20)≈0.95P(|S_{100}| \le 20) \approx 0.95.
  3. Interpretation: after 100 steps you are almost certainly within 20 units of the start, even though you took 100 steps. The typical distance is about 10, a tenth of the number of steps.
Example
A realistic check: return to zero

Use the approximation P(S2m=0)≈1/πmP(S_{2m} = 0) \approx 1/\sqrt{\pi m} with m=5m = 5, so ten steps.

  1. The exact value is (105)/45=252/1024≈0.246\binom{10}{5}/4^5 = 252/1024 \approx 0.246.
  2. The approximation gives 1/5π=1/15.71≈0.2521/\sqrt{5\pi} = 1/\sqrt{15.71} \approx 0.252.
  3. The two agree to within about 3 percent, so the simple formula is good enough for quick estimates.

Tradeoffs and failure modes

A random walk is the right model when increments are independent and roughly the same size. It is the wrong model in several common situations:

SituationProblemBetter choice
Steps depend on the past (momentum, mean reversion)Independence is violated[[markov-chain
Mean reversion (a quantity pulled back to a level)A plain walk wanders off without boundOrnstein-Uhlenbeck process, or a [[stationary-process
Occasional huge steps (infinite variance)Variances no longer add to a finite number, so the square-root rule failsHeavy-tailed step distributions, such as Lévy flights
Long-run prediction of the position itselfThe walk has no expected directionModels of drift, plus the walk for the noise around it

Some practical traps:

  • Zero drift is not zero risk. The average position is zero, but the spread grows. A gambler with a fair coin is expected to end where they started, yet they can still go broke along the way.
  • Do not read a single path as a trend. A walk can drift far in one direction for a long stretch purely by chance.
  • The Gaussian is an approximation. It is good for large nn and for the bulk of the distribution. Exact tail probabilities need the binomial count.

History

The name "random walk" came from Karl Pearson in 1905, who asked in the journal Nature about the distribution of the distance a drunkard reaches after a number of random steps. Lord Rayleigh replied that the problem was closely related to his earlier work on random vibrations.

The idea had a quieter earlier life in physics and finance. In 1900 Louis Bachelier used a random walk as the model of stock price changes in his doctoral thesis, Théorie de la spéculation, which is widely cited as the first mathematical treatment of financial markets. Albert Einstein's 1905 analysis of Brownian motion, the jitter of pollen grains in water, showed that a random walk of many tiny molecular kicks gives a spread proportional to the square root of time, and it gave a way to measure the size of atoms.

George Pólya's 1921 result on recurrence in one, two and three dimensions made the walk a central object of probability theory. It caught on because the same simple model describes a particle in a fluid, a price series, an animal's search path and a Monte Carlo proposal, and because its square-root law is easy to check.

Check yourself

QuestionA walk takes 4 independent fair ±1\pm 1 steps. What is the probability it ends at −2-2?Show answer

To end at −2-2 you need three −1-1 steps and one +1+1 step. There are (41)=4\binom{4}{1} = 4 such sequences out of 1616, so the probability is 4/16=0.254/16 = 0.25.

QuestionWhy does the spread of a random walk grow like n\sqrt{n} and not like nn?Show answer

The steps are independent and have mean zero, so their variances add: Var(Sn)=n\mathrm{Var}(S_n) = n. The standard deviation is the square root of the variance, which is n\sqrt{n}. Distances, not variances, scale with the square root, so the typical distance grows like n\sqrt{n}.

QuestionAfter 400 steps of a fair ±1\pm 1 walk, what is the standard deviation of the position, and roughly how far is the walk from zero 95 percent of the time?Show answer

The variance is 400400, so the standard deviation is 2020. Under the Gaussian approximation, about 95 percent of the mass lies within two standard deviations, so the walk is within about 4040 units of zero 95 percent of the time.

QuestionA two-dimensional random walk always returns to its starting point eventually, but a three-dimensional one may not. Explain the difference in one sentence.Show answer

In two dimensions the walk revisits the same neighbourhood so often that it returns with certainty, while in three dimensions there is enough room that the walk can escape forever with probability about 0.660.66.

QuestionA stock's daily changes are modelled as independent fair ±1\pm 1 moves. Why might a trader who believes in trend-following be surprised by the model, and what assumption would they need to change?Show answer

The model assumes each move is independent of the past, so there is no momentum to exploit. A trader who sees trends is assuming dependence between steps, which means the model needs a Markov or autocorrelated structure rather than independent increments.

Sources