# A modified version of apples and oranges logic

Question: You have 3 baskets, one with apples, one with oranges and one with both apples and oranges mixed. Each basket is closed and is labeled with ‘Apples’, ‘Oranges’ and ‘Apples and Oranges’. However, each of these labels is always placed incorrectly. How would you pick only one fruit from a basket to place the labels correctly on all the baskets? This happens to be usually the basic version of the problem Modification: What if no basket is labelled can we still label all the baskets. And if so how?

Analysis: Well its easy to label one of the 3 baskets as apples or oranges after 3 picks one each from one basket. But now we have a dilemma how to chose which is the random basket and which is the specific one(apples or oranges) from the two remaining baskets. And in the worst case all our picks will result in the same output. So I was wondering if there is any way we could label them and if not the worst case can we at least get a relation based on the distribution and probability of the apples and oranges in the random basket.

• you got me thinking of swept Away in Runescape!! Pesky lil' newts. – Nyk 232 Jul 11 '15 at 0:15

Well, as you have said, there is a risk to pick always the same fruit from the "apples and oranges" basket. So there is no certain answer, except if you pick all fruits from one basket.

If you pick one fruit from each basket, you must have one of one fruit and 2 of the other. Let's say you pick 1 apple and 2 oranges. The apple comes from the "apples only" basket. You cannot identify the 2 remaining baskets where you picked an orange.

We need to do some assumptions. We can safely assume that the mixed basket is either of the unidentified baskets with equal probability. But what is the distribution of the quantity of each fruit in the mixed basket? I will assume the mixed basket contains N fruits, each of them having equal probability to be an orange or an apple. Then it is simple. If at any time you pick an apple from the 2 remaining baskets, you have found the mixed basket and you can identify all baskets. If not, the more oranges you pick from a basket the more unlikely it is that it is the mixed basket. If you pick $a$ oranges from basket A and $b$ oranges from basket b, the probability that A is the mixed basket is ${1/2^a\over 1/2^a + 1/2^b} = {2^b\over 2^a+2^b}$ .

But the distribution can be different. If for instance the mixed basket contains an equal number of oranges and apples, then the exact probability will depend on how many fruits there were to begin with.

But regardless of the distribution, the rule still holds that the more of the same fruit you pick from a basket, the more unlikely it is to be the mixed basket.

• But you do have to pick the fruits from the two baskets alternatively right? – AbsoluteSith Sep 14 '14 at 18:29
• Yes. The basket where you have taken the fewest fruits is more likely to be the mixed basket. So, picking from that basket is more informative. – Florian F Sep 14 '14 at 19:18
• I got a down vote on this one. No idea why... lol – Florian F Jan 19 '17 at 20:33

Just to add further clarification, the first part of the solution is easy with just one fruit picked, instead of three. credit goes to Swept Away where I first ran into this scenario.

! this takes into the fact that ALL LABELS ARE WRONG!!!! Let's have label A be apples, label O be oranges, and label B be both, as given below:
Let x = [a] [b] [o], or [b] [a] [o] or any permutation of the three.
Step 1: Choose a fruit from the crate labeled B. Whichever fruit it is, take the appropriate label and place it there.
Step 2: Now, the two remaining boxes contain either both, or the opposite of the fruit you grabbed (if you got an apple, then oranges and both are left; if you got an orange, then apples and both are left).
Step 3: Now, one of the remaining labels will match the fruit that's left, so just switch the other two labels and you're done!