A random walk in one dimension

This Physlet demonstrates some of the statistical properties of a random walker in one dimension. If you are interested in reading the source code or changing the applet, see OneDimensionalWalk.java. For JavaScripts users, you can also read the simulation's documentation.

Random walks are used to describe a variety of physical phenomena, ranging from diffusion (think of an ink drop spreading in water) to the conformation of polymers consisting of long molecular chains.

The applet illustrates a random walk in one dimension. Starting at the origin, a walker takes N steps, at each step going to the right with probability p and to the left with probability (1 - p). Each step is the same length and independent of the previous one. Where does the walker end up after N steps? Because of the many random choices of the walker, the final position of the walker varies each time the simulation is done. Are some positions more likely than others?

We can determine the answer to this question by performing a large number of trials, where each trial consists of a N step walk. At the end of each trial, the displacement x of the walker from the origin is recorded. We then construct a histogram for the number of times that the displacement x is recorded for a given number of trials. The probability that the walker will be a distance x from the origin after N steps is proportional to the histogram. Such a probability distribution provides a prediction of the likely outcome of any walk of N steps.

The applet allows you to construct a histogram by performing a large number of trials - the default maximum is 1000 trials. At the end of each trial, the appropriate histogram entry is incremented. A checkbox allows you to toggle between seeing or hiding the walker. It might be instructive to view the first few trials and then hide the walker to speed up the simulation. The default probability is p = 1/2 which represents an equal probability of going to the right or to the left and generates a symmetric distribution. You should determine how changing p alters the histogram. Finally, the number of steps N (default value is N = 15) can also be changed. Note that the horizontal axis ranges from -N to N.

Show Walker Show Histogram Values
Number of steps N:
Probability of going right p:
Maximum number of trials:


Questions

  1. How does the histogram change, if at all, as the number of trials increases for fixed N? Describe the qualitative changes of the histogram for increasing values of N.

  2. What is the most probable value of x for p = 1/2 and N = 15 and N = 30?

  3. What is the approximate “width” of the distribution for p = 1/2 and N = 15? Define the width visually. One way to do so is to determine the value of x at which the value of the histogram is one-half its maximum value. How does the width change as a function of N for fixed p?
The applet was developed by Shubha Tewari and Macneil Shonle. This site is maintained by Macneil Shonle and Harvey Gould.

Updated 7 October 1999.
Back to the main page.