This article is from the Puzzles FAQ, by Chris Cole chris@questrel.questrel.com and Matthew Daly mwdaly@pobox.com with numerous contributions by others.
Waldo and Basil are exactly m blocks west and n blocks north from
Central Park, and always go with the green light until they run out of
options. Assuming that the probability of the light being green is 1/2
in each direction, that if the light is green in one direction it is
red in the other, and that the lights are not synchronized, find the
expected number of red lights that Waldo and Basil will encounter.
probability/lights.s
Let E(m,n) be this number, and let (x)C(y) = x!/(y! (x-y)!). A model
for this problem is the following nxm grid:
^ B---+---+---+ ... +---+---+---+ (m,0)
| | | | | | | | |
N +---+---+---+ ... +---+---+---+ (m,1)
<--W + E--> : : : : : : : :
S +---+---+---+ ... +---+---+---+ (m,n-1)
| | | | | | | | |
v +---+---+---+ ... +---+---+---E (m,n)
m-1
-----
\
E(m,n) = > ( 1/2 )^(n+k+1) * (n+k)C(n) * (m-k+1)/2
/
-----
k=0
n-1
-----
\
+ > ( 1/2 )^(m+k+1) * (m+k)C(m) * (n-k+1)/2 .
/
-----
k=0
n-1
-----
\
f(m,n) = > ( 1/2 )^k * (m+k)C(m) * k
/
-----
k=0
and
n-1
-----
\
g(m,n) = > ( 1/2 )^k * (m+k)C(m) .
/
-----
k=0
n
-----
\
f(m,n)/2 = > ( 1/2 )^k * (m+k-1)C(m) * (k-1)
/
-----
k=1
and since f(m,n)/2 = f(m,n) - f(m,n)/2, we get that
n-1
-----
\
f(m,n)/2 = > ( 1/2 )^k * ( (m+k)C(m) * k - (m+k-1)C(m) * (k-1) )
/
-----
k=1
- (1/2)^n * (m+n-1)C(m) * (n-1)
n-2
-----
\
= > ( 1/2 )^(k+1) * (m+k)C(m) * (m+1)
/
-----
k=0
 
Continue to: