The objective
Card and urn questions look like they need long sums over draw orders. Almost all of them collapse once you see the right symmetry. By the end of this lesson you should, for any "draw without replacement" question, ask first: which positions or objects are interchangeable, and what does that make equal?
Exchangeability: every position looks like the first
Shuffle a deck of cards, of them red. The colours read from the top form a sequence . The draws are dependent (seeing a red makes the next red less likely), but they are exchangeable: every rearrangement of a colour sequence has the same probability, because every ordering of the deck does.
The consequence interviewers test most:
Proof in one line: swapping the cards in positions and is a bijection on shuffles that preserves probability, so position has the same distribution as position . The same swap shows that any pair of positions behaves like positions and , so for any .
This is why drawing straws is fair whatever your turn, and why "the 7th card is red" is no harder than "the 1st card is red". Notice what the statement is not: it is unconditional. Once you have seen some cards, the remaining positions are exchangeable among themselves, with the updated counts.
Without replacement: counts and moments
The number of reds in the first cards is hypergeometric:
Do not compute its moments from this formula. Write and use the two exchangeability facts above. With ,
The factor is the finite population correction: the indicators are slightly negatively correlated, so the variance is below the binomial one, and it is when (you have seen every card, so for certain).
Gaps and positions
The Counting module showed that special cards cut the other into gaps of equal expected size, so the first special card sits at expected position (10.6 for the first ace). The same argument places the -th special card at
since special cards and gaps lie at or before it. The second ace is at on average. Reds in a 26/26 deck: the first red is at .
Worked example
the card after the first ace
Shuffle a standard deck and turn cards over until the first ace appears. Is the next card more likely to be the ace of spades or the two of clubs?
Show solutionHide solution
Intuition says the two of clubs, since the ace of spades might be the first ace. Test that by building the deck in two stages, which is a standard trick for these questions.
Two of clubs. Take it out and shuffle the other 51 cards. Inserting it into one of the 52 slots uniformly at random gives a uniformly shuffled deck. Exactly one slot, the one just after the first ace of the 51-card deck, puts it right after the first ace. Probability .
Ace of spades. Take it out and shuffle the other 51, which contain 3 aces. Insert it uniformly into one of 52 slots. If it lands before the first of the three aces, it becomes the first ace and the card after it is not itself. If it lands later, the first ace is the first of the three, and the ace of spades follows it only if it lands in the slot right after that ace. Again exactly one slot works: probability .
So the two are equally likely, each , and so is every other card. A simulation of 400,000 shuffles gives frequencies of about 0.019 for both, matching .
The method to say out loud: "remove the card I care about, shuffle the rest, insert it at a uniform slot, and count the slots that work". It turns a conditioning nightmare into counting one slot.
Pólya's urn
An urn holds red and black balls. Each step you draw a ball, then return it together with one extra ball of the same colour. Success breeds success, so it looks as if early luck should bias everything. Three facts make these questions easy.
1. The draws are exchangeable. The probability of a particular sequence with reds and blacks is
because the numerators for red only ever increase when a red is drawn, and likewise for black, whatever the order. The denominator grows by one each step regardless. Only the counts matter, not the order.
2. So every draw has the same marginal. By exchangeability, for every . The red fraction in the urn is a martingale: its expected next value equals its current value.
3. From one of each, the count is uniform. With , a sequence with reds in draws has probability , and there are such sequences, so
The long-run red fraction is Uniform(0, 1) (Beta(, ) in general). Each run of the urn settles on a fraction, but which one is completely random.
Conditioning keeps the structure: after a red first draw from , the future is just a Pólya urn started at , so every later draw is red with probability .
Worked example
Pólya's urn after ten draws
An urn starts with one red and one black ball and follows Pólya's rule. (a) What is the probability that exactly 5 of the first 10 draws are red? (b) Given the first draw is red, what is the probability the third draw is red? (c) Given the first draw is red, what is the probability that the next two are both red?
Show solutionHide solution
(a) By the uniform law, each count has probability , so the answer is . Compare a fair coin, where 5 heads in 10 has probability : the urn spreads the count out because early draws feed back.
(b) After a red draw the urn is , a fresh Pólya urn. Its draws are exchangeable, so its second draw (the overall third) is red with the same probability as its first: . No need to condition on the second draw.
(c) Here exchangeability is not enough, because we need a joint probability. Multiply along the path: . (Check with the sequence formula: , divided by , gives .)
Red-black card games and stopping
The betting version. A 26/26 deck is turned over one card at a time. At any moment before the last card you may say "stop", and you win if the next card is red. Can timing beat ?
No. Whenever you stop, the next card is red with probability equal to the current red fraction of the remaining deck, and by exchangeability of the remaining cards that is the same as the probability that the last card is red. So every strategy wins with the probability that the last card of the deck is red: . Equivalently, the red fraction is a martingale and no stopping rule changes its expected value. When an interviewer asks you to "find the optimal strategy" here, the answer is that none is better than any other, and the argument is the point.
The scoring version. Now you score for each red turned and for each black, and you may stop at any time and keep your score. You can always guarantee (play to the end), and stopping when ahead can lock in gains. Let be the value of continuing optimally with reds and blacks left. Then , , and
This is the template for every optimal stopping problem: value of stopping now versus expected value of one more step, solved backwards from the boundary.
Worked example
the scoring game with two of each
A deck has 2 red and 2 black cards. You turn cards one at a time, scoring per red and per black, and may stop whenever you like. What is the value of the game, and when should you stop?
Show solutionHide solution
Build up from small decks. The value counts only future score, so it depends only on the cards left.
- : red first (prob. ) gives , then stop; black first gives . Continuing is worth , so .
- : red gives , black gives . Continuing is worth .
- : red gives , black gives . Continuing is worth , so : you are indifferent, and may as well stop.
- .
So the game is worth . The strategy: turn the first card. If it is red you are with left, which is worth , so stop. If it is black, keep going: is favourable.
For the full 26/26 deck the same recursion gives . The optimal rule never stops while level or behind, and stops when the lead is large relative to the cards left: a lead of 2 or 3 is enough with 4 to 8 cards left, about 4 with half the deck left, and about 6 with 30 or more left.
Knowledge check
A box has 10 red and 5 blue chips, drawn one at a time without replacement. What is the probability that the 7th chip drawn is red?
Knowledge check
A Pólya urn starts with one red and one black ball. What is the probability that none of the first 4 draws is red?
Knowledge check
A 26/26 deck is turned over one card at a time. You may say 'stop' at any point before the last card, and win if the next card is red. What is the best winning probability you can achieve?
Knowledge check
What is the expected position of the second ace in a shuffled 52-card deck?
Key takeaways
- Draws without replacement are dependent but exchangeable: any position, or set of positions, has the same distribution as the first ones.
- Get hypergeometric moments from indicators: mean , variance .
- For "which card comes after X" questions, remove the card, shuffle the rest and insert it into a uniform slot.
- Pólya's urn is exchangeable, its colour fraction is a martingale, and from the red count after draws is uniform on .
- No stopping rule beats a martingale (the betting red-black game is worth ). When stopping does matter, write value = max(stop, continue) and solve backwards from the boundary.
Practice problems
Finished reading?
Answer the 4 knowledge checks to complete this lesson (0 done).