probability puzzles
hard | probability |
You are taking out candies one by one from a jar that has red candies, blue candies, and green candies in it. What is the probability that there is at least blue candy and green candy left in the jar when you have taken out all the red candies?
Assume that the candies of the same color are indistinguishable from one another.
Consider the sequences of 60 candies, in which red candies finish before blue and green.
7/12
We will reach this formula by considering the complete sequence of 60 candies.
Any scenario that satisfies the given question will match one of the following two:
-
The candy in this sequence is green, and some blue candy exists before this and after the last red candy.
-
The candy is blue, and some green candy exists before this and after the last red candy.
In the first scenario, let be the event that the candy is green. Let be the event that there is a blue candy before that but after the last red. Since these two events are not independent, we want to calculate:
because the candy will be one of 30 greens, and there are a total of 60 choices.
is the probability of finding a blue candy after the last red, given that the candy is green. Now remove all green candies from consideration, there are 30 candies (10 red & 20 blue). Imagine a random sequence of these 30 candies (it might be scattered anywhere from position 1 to , but still, it is a random sequence of 30 candies only). The probability that the one of these is blue is .
Thus .
Similarly, for the second scenario, let be the event that the candy is blue and let be the event that there is a green candy before that but after the last red. We want to calculate
Since these two scenarios are mutually exclusive, the probability of union is the sum of these probabilities.
Hence the answer:
Not convinced? Here is a simulation script that shows the probability converging to 7/12.