Cards Until Two Colours Remain
Question
A deck has green, blue and red cards, shuffled uniformly at random. You draw cards one at a time without replacement, and stop as soon as one colour has run out, so that only two colours are left in the deck.
(a) What is the expected number of cards left in the deck?
(b) What is the expected number of cards drawn?
Solution
Try it yourself first. Open a hint if you get stuck.
Hint 1
Don't try to find when you stop. Instead, for one card, ask: what has to happen for it to still be in the deck at the end? Then add up over all cards.
Hint 2
A green card is still in the deck exactly when all the blue cards, or all the red cards, were drawn before it. Look at that green card together with the blue cards: in a random shuffle it is equally likely to be anywhere among these cards. What is the chance it comes last?
Show solution
Step 1: When is a card still in the deck? You stop right after the last card of some colour is drawn. So a card is still in the deck exactly when some other colour was completely drawn before it. (Its own colour can't be the one that ran out, since the card itself is still there.)
So by linearity of expectation,
Step 2: One green card. Two things can put a green card after a whole colour:
- All 25 blue cards come before it. Look only at this green card and the blue cards. In a random shuffle, the green card is equally likely to be in any of the places among them, so it is last with probability .
- All 40 red cards come before it: probability , by the same argument.
- Both happen, all blue and red cards before it: probability .
By inclusion–exclusion,
Step 3: Blue and red cards, the same way.
Step 4: Add up over all cards.
Answers:
(a) .
(b) Every card is either drawn or left, so .
In general, with , and cards of the three colours,
Why so few cards are left: each colour's last card is usually near the bottom of the deck, so even the first colour to run out does so late.