hard puzzles
hard | probability |
You are given an urn with 100 balls (50 black and 50 white). You pick balls from urn one by one without replacements until all the balls are out. A black followed by a white or a white followed by a black is "a colour change". Calculate the expected number of colour-changes if the balls are being picked randomly from the urn.
Linearity of expectation
50
Each time we draw, there could be a possible color-switch, except the first time we draw, hence 99 possible switches.
Let be an indicator variable, value 1 if position has a colour change and zero otherwise, note that goes from to .
Total number of switches,
The expected number of color switches is denoted by the sum of these variables, i.e
Linearity of expectation states that the expected value of the sum of random variables is equal to the sum of their individual expected values.
Hence the answer is
Note that each is identical, and the expected value is equal for each , i.e,
Hence
Also, we can calculate the expected value,
Probability of any given color change is (either first is R second is B, or first is B and second is R)
Finally, the answer is
Note: 's are not independent, but since all the balls are drawn randomly, the probability-distribution is identical for each draw. For instance, if you are given no information about the previous colors, and I ask 'what is the probability that 5th draw has a color change?', your answer will not depend on '5', instead the answer will be same for any index.