Mathematics in action: Flipping coins

Our second post about probability is about flipping coins and random walks. Once again, I’ve used random numbers from, but I’ve represented the coin flips as 1 for heads and −1 for tails. The expected mean is therefore 0 (I actually got 0.0034), and the expected variance is s − 02 = 1, where s = 1 is the mean of the squares of the numbers −1 and 1 (for the variance, I actually got 1.000088).

We then consider a random walk where we repeatedly flip a coin and walk a block west if it’s tails and a block east if it’s heads. In particular, we consider doing so 144 times. How far would we expect to get that way? Well, on average, nowhere – we are adding 144 coin flips, and the mean distance travelled will be 0. The coloured lines in the diagram above show ten example random walks (with time running vertically upwards). These finish up between 18 blocks west and 20 blocks east of the starting point, so the mean of 0 represents an average of outcomes where we wind up several blocks west or east.

Since we can add variances, the variance for the random walk will be the variance of a single step times the number of steps. Alternatively, the standard deviation will be the standard deviation of a single step times the square root of the number of steps. In this case, the expected standard deviation of the random walk is 12 (for the ten random walks in the diagram above, I actually got 14.55; for a larger sample, 12.086). The width of the bell curve in the diagram illustrates the theoretical standard deviation (the height of the bell curve is not meaningful).

The expected absolute value of the distance travelled depends on the mean value of half a bell curve: it is 12 × sqrt(2/π) = 9.5746 (I actually got 12.6; for a larger sample, 9.631). So, for our random walk, we can expect to wind up around 10 blocks from the starting point – sometimes more, sometimes less. Naturally, this is just a simple example – there’s a lot more interesting mathematics in the theory of random walks, especially when we consider travelling in more than one dimension.


One thought on “Mathematics in action: Flipping coins

  1. Pingback: Mathematics in action: Risky Random Walks | Scientific Gems

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s