Joe has two bottles of seasick pills, each stocked with 40 pills, which he takes with him on his ocean voyage.
During the trip, each time he takes a pill he chooses one of the two bottles at random with equal probability. Eventually one will run out and he's left with the other. When whichever is the first to run out does so, what's the expected value of the number of pills left in the other bottle?
Let m and n be the number of pills in each bottle and f(m,n) be the expected number of pills left in one bottle when the other runs out. We seek f(40,40)
Note the following
f(m,n)=f(n,m) since the bottles are interchangeable.
f(m,0)=m if one bottle is empty the other has m pills.
f(m,n)=[f(m-1,n)+f(m,n-1)]/2 since there's an equal chance of taking from either bottle.
This is enough to solve the problem.
As an aside, also note f(n,n)=f(n-1,n)=f(n-1,n)
In working on a closed form I was able to show
f(n,1)=x-1+1/(2^(x-1))
f(n,2)=x-2+(x+4)/(2^x)
but got no further before switching to a computer.
Pascal's triangle is in there somewhere.
It's easy enough to make a spreadsheet where the first row and column run from 0 to 40 and each other cell is the average of the cells immediately above and to the left.
f(40,40)=7.114230302
|
Posted by Jer
on 2020-08-19 14:22:11 |