03 / Probability theory

Random paths.
A predictable shape.

A single fair walk is unpredictable. Across many independent walks, the final positions gather into a distribution we can calculate exactly.

The law of a fair walk

Independent steps · equal chances
Exact probabilitySimulated frequency
The exact distribution of a fair random walkEndpoint probabilities after 24 independent plus-one or minus-one steps. The distribution is symmetric around zero.00.10.2-24-1201224Probability / relative frequencyFinal position

Each path starts at zero. Every step is independently +1 or −1, with equal probability.

Expected position0
Variance24
Simulated paths0
Sample mean—

Count the up steps.

Let KK count the up steps in nn independent trials. There are n−Kn-K down steps, so the final position is:

Sn=K−(n−K)=2K−nS_n=K-(n-K)=2K-n
K∼Binomial⁡ ⁣(n,12)K\sim\operatorname{Binomial}\!\left(n,\tfrac12\right)

Choosing exactly jj up steps gives the exact probability of ending at 2j−n2j-n:

P(Sn=2j−n)=(nj)2−n\mathbb P(S_n=2j-n)=\binom nj 2^{-n}

This holds for j=0,1,…,nj=0,1,\ldots,n. Only every other integer is reachable. Since these controls use even step counts, every endpoint is even.

Read the distribution as numbers
Every reachable endpoint is included. Frequencies are counts divided by the number of simulated paths.
Final positionExact probabilityFrequency
-245.960e-8—
-220.000001—
-200.000016—
-180.000121—
-160.000633—
-140.002533—
-120.008023—
-100.020629—
-80.043837—
-60.077933—
-40.116900—
-20.148782—
00.161180—
20.148782—
40.116900—
60.077933—
80.043837—
100.020629—
120.008023—
140.002533—
160.000633—
180.000121—
200.000016—
220.000001—
245.960e-8—

Zero mean is not zero risk.

Each step has mean zero and variance one. Independence makes the variances add:

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

The standard deviation grows with the square root of the number of steps. More steps spread the distribution out, even though its center stays at zero.

Snn  →  d    N(0,1)\frac{S_n}{\sqrt n}\;\xrightarrow{\;d\;}\;\mathcal N(0,1)

The central limit theorem explains the emerging bell shape after rescaling. The bars here show exact binomial probabilities, not a normal approximation.

Add several batches. The simulated bars tend toward the exact distribution, but individual batches can move farther away. Convergence does not mean steady improvement.

Simulation uses browser pseudorandom numbers and is capped at 10,000 paths per step count. This is a fair mathematical walk, not a model of roulette or a prediction of financial returns.