Skip to content
LeetQuant
QT02 Advanced Probability and Brainteasers

QT02 · Advanced Probability and Brainteasers · Lesson 5 of 5

Multi-Stage Probability Problems

A structured method for problems that need several rounds of conditioning: states, absorbing states, first-step equations and self-similarity, applied to tennis, series, craps and drawing until a condition.

18 min

The objective

Many interview questions are not one conditioning step but a chain of them: a game with several phases, a match that can go on indefinitely, a draw that continues until something happens. Candidates go wrong by trying to sum over every path. The objective is a method that works every time.

The method

  1. Define the state. What is the minimum you must remember to continue the game? In tennis it is the score, and from 3–3 onwards only the difference. Fewer states means fewer equations.
  2. Mark the absorbing states and their values (win = 1, loss = 0, or a payoff).
  3. Write first-step equations. For each state ss, condition on what happens next: V(s)=∑s′P(s→s′) V(s′)V(s) = \sum_{s'} P(s \to s')\,V(s'), plus 1 per step if you want an expected time.
  4. Exploit self-similarity. If a state recurs (deuce, a re-roll, "start again"), it appears on both sides of its own equation; solve for it.
  5. Use races. If only the first of two events matters, P(A before B)=P(A)P(A)+P(B)P(A \text{ before } B) = \frac{P(A)}{P(A) + P(B)} per trial, ignoring trials where neither happens.
  6. Sanity-check at p=12p = \frac12, p→0p \to 0 and p→1p \to 1, and check that the probabilities of all absorbing outcomes add to 1.

Separate the problem into phases with a clean hand-off. The answer is then the sum over ways of entering the final phase, each multiplied by that phase's value.

Worked example

winning a tennis game

You win each point independently with probability p=0.55p = 0.55. A game is won by the first player to 4 points with a lead of at least 2. What is your probability of winning the game, and how many points does a game last on average once it reaches deuce?

Show solution

Phase 1: before 3–3. You win without deuce if you reach 4 points while the opponent has 0, 1 or 2. Your 4th point is the last point played, so the opponent's points are placed among the earlier ones:

P(4–0)=p4,P(4–1)=(41)p4q,P(4–2)=(52)p4q2,P(4\text{–}0) = p^4, \quad P(4\text{–}1) = \binom41 p^4 q, \quad P(4\text{–}2) = \binom52 p^4 q^2 ,

with q=1−pq = 1 - p. The game reaches 3–3 (deuce) with probability (63)p3q3=20p3q3\binom63 p^3 q^3 = 20 p^3 q^3.

Phase 2: from deuce. The state is the score difference: 00 (deuce), +1+1, −1-1, and absorbing ±2\pm 2. Look at the next two points: you win both with probability p2p^2, lose both with q2q^2, or split them with 2pq2pq and return to deuce. Deuce recurs, so

D=p2+2pq D⟹D=p21−2pq=p2p2+q2.D = p^2 + 2pq\,D \quad\Longrightarrow\quad D = \frac{p^2}{1 - 2pq} = \frac{p^2}{p^2 + q^2} .

Combine. With p=0.55p = 0.55: p4≈0.0915p^4 \approx 0.0915, 4p4q≈0.16474p^4q \approx 0.1647, 10p4q2≈0.185310p^4q^2 \approx 0.1853, 20p3q3≈0.303220p^3q^3 \approx 0.3032, and D=0.30250.3025+0.2025=121202≈0.599D = \frac{0.3025}{0.3025 + 0.2025} = \frac{121}{202} \approx 0.599. So

P(game)≈0.0915+0.1647+0.1853+0.3032×0.599≈0.623.P(\text{game}) \approx 0.0915 + 0.1647 + 0.1853 + 0.3032 \times 0.599 \approx 0.623 .

A 55% edge per point becomes about 62% per game: longer contests amplify an edge.

Expected length from deuce. Each two-point block ends the game with probability p2+q2p^2 + q^2, so the number of blocks is geometric with mean 1p2+q2\frac{1}{p^2+q^2}, and the expected number of points is 2p2+q2=400101≈3.96\frac{2}{p^2 + q^2} = \frac{400}{101} \approx 3.96.

Checks. At p=12p = \frac12, D=12D = \frac12 and the game probability is 12\frac12 by symmetry. As p→1p \to 1, D→1D \to 1. A brute-force recursion over all scores gives the same 5035039980800000≈0.6231\frac{50350399}{80800000} \approx 0.6231.

Best-of series: pretend every game is played

In a best-of-7, the first to 4 wins. Summing over how the series ends gives

P(win)=∑k=03(3+kk)p4qk,P(\text{win}) = \sum_{k=0}^{3} \binom{3 + k}{k} p^4 q^k ,

where kk is the number of games you lose and your 4th win is the final game. A cleaner route: imagine all 7 games are played even after the series is decided. Extra games cannot change who reached 4 first, and you win the series exactly when you win at least 4 of the 7. So P(win)=P(Bin(7,p)≥4)P(\text{win}) = P(\text{Bin}(7, p) \ge 4). At p=0.55p = 0.55 both give ≈0.608\approx 0.608.

The same trick handles conditional questions. In an even series (p=12p = \frac12) you are down 0–2 in a best-of-7: play the remaining 5 games out, and you need at least 4 of them, so the probability is (54)+(55)25=632=316\frac{\binom54 + \binom55}{2^5} = \frac{6}{32} = \frac{3}{16}.

Worked example

the pass line in craps

Roll two dice. On the first roll you win with 7 or 11 and lose with 2, 3 or 12. Any other total (4, 5, 6, 8, 9, 10) becomes your point: you then roll repeatedly, winning if the point comes again before a 7 and losing if a 7 comes first. What is your probability of winning?

Show solution

Phase 1, the come-out roll. Totals of ss have probability 6−∣s−7∣36\frac{6 - |s - 7|}{36}. You win at once with probability P(7)+P(11)=6+236=836P(7) + P(11) = \frac{6 + 2}{36} = \frac{8}{36}.

Phase 2, a race. With point kk, every roll that is neither kk nor 7 is irrelevant, so

P(make point k)=P(k)P(k)+P(7).P(\text{make point } k) = \frac{P(k)}{P(k) + P(7)} .

This gives 33+6=13\frac{3}{3 + 6} = \frac13 for 4 or 10, 44+6=25\frac{4}{4+6} = \frac25 for 5 or 9, and 55+6=511\frac{5}{5+6} = \frac{5}{11} for 6 or 8.

Combine by conditioning on the point, using the symmetry P(k)=P(14−k)P(k) = P(14 - k):

P(win)=836+2(336⋅13+436⋅25+536⋅511)=244495≈0.493.P(\text{win}) = \frac{8}{36} + 2\left(\frac{3}{36}\cdot\frac13 + \frac{4}{36}\cdot\frac25 + \frac{5}{36}\cdot\frac{5}{11}\right) = \frac{244}{495} \approx 0.493 .

The structure is the lesson: a one-shot phase that either ends the game or sets a state, then a race whose answer depends only on that state. The house edge is 1−2×0.493≈1.4%1 - 2 \times 0.493 \approx 1.4\% of the stake.

Drawing until a condition: condition on the right event

"Roll a die until you get a 6. Given that every roll was even, what is the expected number of rolls?" The tempting answer is 3: restricted to the even faces {2,4,6}\{2, 4, 6\}, a 6 comes with probability 13\frac13 per roll. That is wrong, because the conditioning event is not "rolls are drawn from the even faces"; it is "no odd face appeared before the first 6", and long sequences are much less likely to survive it.

Do it properly. Each roll is a 6 with probability 16\frac16, a 2 or 4 with probability 13\frac13, and odd with probability 12\frac12. The game reaches a 6 at roll nn with all rolls even with probability (13)n−116(\frac13)^{n-1}\frac16. Summing, P(all even)=1/61−1/3=14P(\text{all even}) = \frac{1/6}{1 - 1/3} = \frac14, which is the race of 6 against an odd face: 11+3\frac{1}{1 + 3}. Then

E[N∣all even]=∑nn (13)n−1161/4=23⋅1(1−13)2=32.\mathbb E[N \mid \text{all even}] = \frac{\sum_n n\,(\frac13)^{n-1}\frac16}{1/4} = \frac23 \cdot \frac{1}{(1 - \frac13)^2} = \frac32 .

A quicker view: P(N=n∣all even)∝(13)n−1P(N = n \mid \text{all even}) \propto (\frac13)^{n-1}, which is a geometric distribution with continuation probability 13\frac13, so success probability 23\frac23 per roll and mean 32\frac32. Conditioning on survival selects short runs. A simulation of 300,000 runs gives 1.50.

Knowledge check

You win each point with probability 23\frac23. The game is at deuce (you must get two points ahead). What is your probability of winning the game?

Knowledge check

Two evenly matched teams play a best-of-7 series, and one team has lost the first two games. What is its probability of winning the series?

Knowledge check

You roll a fair die until the first 6. Given that no odd number appeared, what is the expected number of rolls?

Key takeaways

  • Define the smallest state that lets the game continue, mark the absorbing states, and write one first-step equation per state.
  • A recurring state (deuce, a re-roll) appears on both sides of its own equation: deuce gives D=p2p2+q2D = \frac{p^2}{p^2+q^2}.
  • Split the problem into phases and combine: P(enter final phase in each way) × value of that phase.
  • For best-of series, imagine all games are played: P(win best of 2n−12n-1) = P(Bin(2n−12n-1, pp) ≥ nn).
  • Races ignore irrelevant trials: P(A before B) = P(A) / (P(A) + P(B)).
  • Conditioning on how a process ended selects short paths; recompute the distribution under the condition instead of changing the per-step odds by intuition.

Practice problems

Finished reading?

Answer the 3 knowledge checks to complete this lesson (0 done).