On this page
You roll a fair die, keep a running total, and stop the moment a six appears. What total should you expect? The number of rolls is random and depends on the rolls themselves, so it seems you cannot simply multiply. Wald's identity says you can, as long as your rule for stopping never looks ahead.
What does Wald's identity say?
Abraham Wald published the result in 1944 in "On cumulative sums of random variables" in The Annals of Mathematical Statistics (DOI 10.1214/aoms/1177731235).
Wald's identity states that if X₁, X₂, … are independent and identically distributed (i.i.d.) with finite mean E[X], and N is a stopping time with finite mean, then E[X₁ + … + X_N] = E[N]·E[X] (Wald's equation). A general version allows independent terms with different distributions if they share the mean and E|X_n| stays bounded.
A stopping time is a rule for the number of terms N where the decision "stop after step n" uses only the first n values, never a later one.
How do you use Wald's identity on a die rolled until a six?
One roll has mean E[X] = (1 + 2 + 3 + 4 + 5 + 6)/6 = 3.5.
The number of rolls N is geometric with success probability p = 1/6, and a geometric count has mean 1/p (geometric distribution), so E[N] = 6.
N is a stopping time: after each roll you can see whether it was a six.
Wald's identity gives an expected total of 6 × 3.5 = 21.
You can check this without Wald. Every roll before the six is a 1, 2, 3, 4 or 5, equally likely, so those rolls average 3. On average there are 5 of them, worth 15, and the last roll is always 6, making 21. The same waiting time drives our post on who rolls a six first between two players.
Why doesn't N need to be independent of the rolls?
Here N plainly depends on the rolls: a six ends the game. The simplest textbook version assumes N is independent of the X's, but for i.i.d. terms the general version only needs N to be a stopping time with finite mean (Wald's equation). The proof shows why.
Write the total as S = X₁·1{N ≥ 1} + X₂·1{N ≥ 2} + …, where 1{N ≥ n} is 1 if roll n is made and 0 if not. The event N ≥ n means "no six in the first n − 1 rolls", which is settled before roll n happens. So X_n is independent of it, and E[X_n·1{N ≥ n}] = E[X]·P(N ≥ n).
Add over n using linearity of expectation with indicator variables: E[S] = E[X]·(P(N ≥ 1) + P(N ≥ 2) + …) = E[X]·E[N], because that tail sum is the mean of a count. (Summing infinitely many terms this way needs bounded sizes and finite E[N].) What matters is not that N ignores the rolls, only that each roll is independent of whether it gets counted. The same idea, phrased as fair games, is the optional stopping theorem for martingales.
What goes wrong when N peeks at the future?
Change the rule: stop one roll *before* the first six, so the six is never added. To decide to stop after roll n you now need to see roll n + 1, so this is not a stopping time, and the conditions of Wald's equation no longer hold.
Used blindly, Wald would give 5 × 3.5 = 17.5, since the count now has mean 5. The true answer is 15, because every counted roll is a 1 to 5 and averages 3. The rule looks ahead and quietly drops the high roll, so the rolls it keeps are biased low.
A second failure comes from the size of the terms. Let X_n be +2ⁿ or −2ⁿ with equal chance, and stop at the first plus. Each X_n has mean 0, so Wald would predict 0, yet every run ends at exactly +2 (for example −2 − 4 + 8 = 2). The terms are independent but not identically distributed, and N is a stopping time here; what fails is the condition that the expected sizes of the counted terms add up to a finite number, as in the counterexamples to Wald's equation.
A three-question check before you multiply
Are the terms independent, each with the same finite mean?
Can you decide to stop after step n using steps 1 to n only?
Is E[N] finite, with the terms' average sizes bounded?
If all three are yes, the expected total is E[N]·E[X]. If the second fails, compute directly, as in the peeking example.
If stopping times or geometric waiting times still feel shaky, the Fermi Concept Library gives every concept in mathematics its own lesson and its place in the map. For practice, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
Next time a sum has a random number of terms, ask whether the stopping rule looks ahead; that one question decides whether you can multiply.



