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

Home > Probability
At the grocery store (Posted on 2005-06-05) Difficulty: 3 of 5
You are at the grocery store buying a bag of oranges. The oranges are pre-bagged and all bags are sold at the same price.

All bags have the same number of oranges, but they do not weigh the same. You would not like to be cheated, or in other words, to not buy a bag below the median weight.

You begin by grabbing a bag with each hand to compare them. Once you decide on the heavier one you discard the one that feels lighter, keeping the one that feels heavier in your other hand, and pick up another bag with your free hand to make another comparison and continue the process.

Given that you are right about which bag is heavier 90% of the time (for simplicity assume your chances of misjudging the heavier of two bags are independent of their weight difference). How many bags will you have to pick up to be 85% certain that you are not being cheated?.

The number of bags to choose from is very large and there are no bags whose weight is equal to the median weight.

  Submitted by ajosin    
Rating: 4.0000 (1 votes)
Solution: (Hide)
Four bags.

Assume that after grabbing a certain number of bags n, you have p(n) chances of having a good bag. After you grab your next bag and do your 90% efficient comparison, there are three ways to end up with a good bag in your hand. Each has the following probability of happening;

1.- You had a good bag and grabbed a good one; p(n)*0.5

2.- You had a good bag, grabbed a bad one, and kept the good one; p(n)*0.5*0.9

3.- You had a bad bag, grabbed a good one, and kept the good one; (1-p(n))*0.5*0.9

Add these up and your new chances of having a good bag after grabing n+1 are,

p(n+1) = p(n)*0.5 + p(n)*0.5*0.9 + (1-p(n))*0.5*0.9 = 0.45 + 0.5*p(n)

Which is a recursive formula for p(n) which can be solved taking into account that p(1) = 0.5,

p(n) = 0.9 - 0.4*(0.5)^(n-1).

Which gives 85% for n = 4.

I would also recomend a look at Tristan's solution where he very elegantly uses only two terms, instead of three, to derive the recursive formula.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Hints/TipsStill another solution out there...ajosin2005-06-07 15:37:05
No SubjectSteve Herman2005-06-06 16:41:13
SolutionAnother solutionTristan2005-06-05 19:30:30
SolutionsolutionCharlie2005-06-05 17:37:23
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