All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
Two Pill Bottles (Posted on 2020-08-19) Difficulty: 3 of 5
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?

See The Solution Submitted by Charlie    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Google Sheets | Comment 3 of 6 |
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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information