You are in an open field with two coins and you alternate flipping the coins and taking steps by the following rules:
If both coins are heads, then you take one step north.
If both coins are tails, then you take one step south.
If the first coin is heads and the second coin is tails, then you take one step west.
If the first coin is tails and the second coin is heads, then you take one step east.
Assuming that nothing is in your way and that the two coins are fair coins, then the probability that after 2 0 steps you are back to where you started is q p where p and q are relatively prime integers. Find p + q .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Moving in each of the cardinal directions is equally likely. To return to the starting position after 2 0 steps, you need to have taken an equal number ( n each, say) of East and West steps and an equal number ( 1 0 − n each) of North and South steps. Thus the probability of getting back to the start is 4 2 0 1 n = 0 ∑ 1 0 n ! × n ! × ( 1 0 − n ) ! × ( 1 0 − n ) ! 2 0 ! = 6 8 7 1 9 4 7 6 7 3 6 2 1 3 3 4 2 3 7 2 1 making the answer 2 1 3 3 4 2 3 7 2 1 + 6 8 7 1 9 4 7 6 7 3 6 = 7 0 8 5 2 9 0 0 4 5 7 .
In the 2 N step case, this sum (the probability of returning home) turns out to be P ( 2 N ) = ( 4 N 1 ( N 2 N ) ) 2 .
Using Stirling's approximation for the binomial coefficient, for large N this becomes the rather surprising P ( 2 N ) ≈ π N 1 . Because we're dealing with squares of factorials, "large" doesn't even mean all that large - for example, in this case ( N = 1 0 ), the exact probability is 0 . 0 3 1 0 4 5 … whereas we have 1 0 π 1 = 0 . 0 3 1 8 3 0 … , a relative error of just 2 . 5 % .
So, this gives a way to calculate π - maybe not the most efficient, though. You could even combine it with getting to know a new city, as long as its streets form a grid.
Log in to reply
That's a pretty neat way to calculate pi that I did not know about before!
Another point of interest is that ( N 2 N ) are the center numbers of Pascal's Triangle.
Just to add to Chris Lewis's comment, one way to see that P ( 2 N ) = 4 2 N 1 ( N 2 N ) 2 is to realize that the first coin must come up heads exactly N out of 2 N times, and the second coin must come up heads exactly N out of 2 N times.
Log in to reply
That's a nice way of looking at it - makes me think that may have been the intention behind the problem.
To get back to where you started, you must have an equal amount of north steps and south steps, and an equal amount of west steps and east steps. If there are 2 n steps, then you could have n north, n south, 0 west, and 0 east steps in any order for a total of n ! n ! 0 ! 0 ! ( 2 n ) ! different ways, or you could have n − 1 north, n − 1 south, 1 west, and 1 east steps in any order for a total of ( n − 1 ) ! ( n − 1 ) ! 1 ! 1 ! ( 2 n ) ! different ways, and so on, until 0 north, 0 south, n west, and n east steps in any order for a total of 0 ! 0 ! n ! n ! ( 2 n ) ! different ways. In summary:
W = k = 0 ∑ n ( ( n − k ) ! ) 2 ( k ! ) 2 ( 2 n ) !
which can be shown inductively to be equal to
W = ( n ! n ! ( 2 n ) ! ) 2
For 2 0 steps, there are ( 1 0 ! 1 0 ! ( 2 ⋅ 1 0 ) ! ) 2 = 3 4 1 3 4 7 7 9 5 3 6 ways to get back to where you have started out of a total of 4 2 0 = 1 0 9 9 5 1 1 6 2 7 7 7 6 ways , for a probability of 6 8 7 1 9 4 7 6 7 3 6 2 1 3 3 4 2 3 7 2 1 . Therefore, p = 2 1 3 3 4 2 3 7 2 1 , q = 6 8 7 1 9 4 7 6 7 3 6 , and p + q = 7 0 8 5 2 9 0 0 4 5 7 .
In the calculation for 3 4 1 3 4 7 7 9 5 3 6 , all the 2 0 s should be 1 0 s. (The total number of steps is represented by 2 n , not n .)
Problem Loading...
Note Loading...
Set Loading...
Because to move North/West the first flip must be heads and to move South/East it must be tails, there has to be an equal number of heads flipped on the first flip as tails. This gives ( 1 0 2 0 ) ways to flip the first coin and get back to where you started.
Likewise, to move North/East, the second flip must be heads, and to move South/West, it must be tails. This means there are ( 1 0 2 0 ) ways to flip the second coin and end up back where you started.
Because there are 4 2 0 ways to perform all of the flips, the probability of returning to the start becomes 4 2 0 ( 1 0 2 0 ) 2 = 6 8 7 1 9 4 7 6 7 3 6 2 1 3 3 4 2 3 7 2 1
so the answer is 7 0 8 5 2 9 0 0 4 5 7 .