Tuesday, August 24, 2010

Random Walk!

This is something that I discovered in my lab manual for lower div Thermodynamics - we didn't do it in class at all, in fact it's horrible that it wasn't even mentioned (not only because it's very interesting, but because it plays a major role in thermodynamics)!

It is known as the Random Walk "experiment" or "hypothesis".

The experiment is this:
You are standing on a city block in a city such as Philadelphia (so that all the streets are in a rectangular grid), and you hold a coin in your hand.
You flip the coin: if it comes up heads, you walk a block West; if it comes tails, you walk a block East. (And it is assumed that all the blocks are of equal length).
So you do this a great number of times (or until you get tired).

Where are you?

Think about this. Most people would think - rather logically - that you will end up in your original place! This seems logical because you could make the argument that the coin will come up heads and equal number of times that it will come up tails. And therefore, you will walk the same number of blocks West as you will East, with the net result being that you will end up exactly where you began!

Unfortunately, and very surprisingly, this is NOT the case.
You do not end up in the same place. Would you be surprised if I told you that you will end up approximately the square root of the number of flips away from your origin? (As the number of flips and trials you do becomes large).

How can this be? Well there is a mathematical proof which i will present for you. But I also ecnourage you to run some tests of this phenomenon! (You don't actually have to go outside and do this, a simple coin and pencil will do - or a computer program, which would be much faster).

Here is the python code that I used to test this:


Try it yourself! And if you don't have Python, it is extremely easy to download from phython.org (I use version 2.6.5)
A good way to see the results is to do manyRandWalk(1000,10000). It'll take a few seconds, but you can see that it is very accurate.

And I actually should note that, on average, it is computed that this will not exactly approach sqrt(n), where n is the number of flips. It is, for statistical reasons about 4/5 of that, so 0.8*sqrt(n) is actually correct. Which you will see if you run the program! i got about 81.43 and 77.876 on my first couple tries. and the exact answer should be around 80!

and, if you were wondering, here is the mathematical proof. this was actually a proof by Feynman from his Lectures on Physics. and if you're wondering how this pertains to physics, i'll write a little about that after the short proof:

let D(n) be the distance travelled after n coin tosses. and let a + number be distance travelled west, and - be distance traveled east.
then D(1) is guaranteed to be ±1. or we can say
D(1)² = 1

we also know, by the same logic, that
D(n+1) = D(n) ± 1, then
D(n+1)² = D(n)² ± 2D(n) + 1

here, feynman uses some arguement (which escapes me at the moment) as to why the "± 2D(n)" can be ignored or eliminated. as best as i can remember, it had to do with the two forms cancelling out for large n, which would seem reasonable. but anyway, continuing thusly (and trusting Feynman at this point):
[edit: i did some work on this, not too long after publishing this post, and it is very clear that, on the average, the ± 2D(n) term will be zero. it's actually just painfully obvious and should be intuitive. but note that making this simplification means that you accept that all the following work is only on the average. that is to say, when i will show that D(2)² = 2, it seems contradictory to say that D(2) = ±1.414... (an irrational number) because it should obviously be either 0 or ±2! this is an average! so while this may have been a little too detailed, i just thought it was interesting! and now the proof:]

D(n+1)² = D(n)² + 1
and since we know that D(1)² = 1, we can find D(2)²:
D(2)² = D(1)² + 1 = 1 + 1 = 2
and D(3)²:
D(3)² = D(2)² + 1 = 2 + 1 = 3
and D(4)²:
D(4)² = D(3)² + 1 = 3 + 1 = 4
etc...
doing this, we find that
D(n)² = n, or
D(n) = √n

and that is how it is done! i do encourage you to try it out on your computer (or it is even easy enough to program on your calculator).

now just a little bit as to why this is physically relevant. imagine a random walk - not back and forth in 1 dimension - but all around space in 3 dimensions. consider also that a gaseous molecule travels roughly randomly through space. you should now see that a random walk in 3 dimensions is actually useful for estimating the path - or displacement - of a gas!
while this may not necessarily be as exciting a revelation, random walks are referenced in a variety of other topics such as Path Integration - very Feynman!

anyway, i hope you found this topic as curious and stimulating as i did!

No comments:

Post a Comment