A random walk is a path made of random steps, such as a drunk walker, a particle or a gambler’s balance. The random walk calculator gives the mean position, the standard deviation, the expected distance from the start, the root-mean-square distance and the probability of returning to the start for a walk on a line.
How the calculation works
- Enter the number of steps and the length of each step. The walker moves forward or backward on a line.
- Enter the probability of a step forward. Use 50 % for a symmetric walk, where forward and backward are equally likely.
- The position after n steps is L (2k − n), where k is the number of forward steps. The mean is n L (2p − 1) and the standard deviation is L √(4 n p (1 − p)).
- The calculator also gives the expected distance from the start with a normal approximation, the root-mean-square distance and the probability of being back at the start after an even number of steps.
Example
A walker takes 20 steps of 1 ft, and each step goes forward with a probability of 55 %. The expected position is 20 × 1 × (2 × 0.55 − 1) = 2.00 ft and the standard deviation is √(4 × 20 × 0.55 × 0.45) = 4.45 ft. The expected distance from the start is 3.90 ft, and the root-mean-square distance is √(19.8 + 4) = 4.88 ft. The chance to be back at the start after 20 steps is C(20, 10) × 0.55¹⁰ × 0.45¹⁰ = 15.93 %.
Why it matters
The calculator helps students of probability, physics and finance, game designers and curious people to see how a random walk spreads with the number of steps, and how a small bias changes the result. It makes the square root law clear and gives exact values for the position and the return probability.
Good to know
The walk is on a line, with steps of fixed length and independent steps of the same probability. Walks in two or three dimensions, steps of random length and walls such as the ruin of a gambler are different problems. The expected distance uses a normal approximation, so it is less exact for few steps. The return probability is exact and is zero for an odd number of steps.
Related tools
The gambler’s ruin calculator adds absorbing barriers, the Markov chain calculator handles transitions between states, the expected value calculator averages the outcomes of a random process, and the binomial calculator gives the chance of a number of forward steps.