# Visualizing random walks

Today, a science lesson delivered via Mathematica. Imagine a pawn on a chessboard. Instead of marching steadily forth, this pawn has gone renegade. In fact, it has gone completely mad, and without respect to the rules, is shuttling randomly forward and backward. Every time it is your turn, it is equally likely to:

- not move at all,
- move forward,
- move backward.

Such a monstrously aimless behavior is called in mathematics a random walkWikipedia.

Here is some Mathematica code to simulate a random walk, and to collect the statistics of many such simulations.

What does a random walk look like? If time is vertical and the progress of the random walker is horizontal, one particle performing 50 steps of a *random walk* looks something like this:

What about if one superimposes many such *walks*?

As you can see, with 5000 particles, the identity of each particle has begun to blur away, and now the whole *ensemble* starts to look a little bit more like a blob of ink diffusing on blotting paper.

*This is not an accident*. That is exactly what ink diffusing on blotting paper is: a near infinite number of molecules of ink, each one buffeted hither and thither by thermal vibrations, each performing what is called in the biz Brownian motionWikipedia.

In fact, one of Einstein’s achievements (other than the various flavors of relativity, of course) was to show mathematically how this Brownian motion relates to the underlying atomic nature of matter.