In probability theory, Wald's equation, Wald's identity or Wald's lemma is an important identity that simplifies the calculation of the expected value of the sum of a random number of random quantities. In its simplest form, it relates the expectation of a sum of randomly many finite-mean, independent and identically distributed random variables to the expected number of terms in the sum and the random variables' common expectation under the condition that the number of terms in the sum is independent of the summands. The equation is named after the mathematician Abraham Wald. An identity for the second moment is given by the Blackwell–Girshick equation. Basic version Let be a sequence of real-valued, independent and identically distributed random variables and let be an integer-value random variable that is independent of the sequence . Suppose that and the have finite expectations. Then Example Roll a six-sided dice. Take the number on the die (call it ) and roll that number of six-sided dice to get the numbers , and add up their values. By Wald's equation, the resulting value on average is General version Let be an infinite sequence of real-valued random variables and let be a nonnegative integer-valued random variable. Assume that: . are all integrable (finite-mean) random variables, . for every natural number , and . the infinite series satisfies Then the random sums are integrable and If, in addition, . all have the same expectation, and . has finite expectation, then Remark: Usually, the name Wald's equation refers to this last equality. Discussion of assumptions Clearly, assumption () is needed to formulate assumption () and Wald's equation. Assumption () controls the amount of dependence allowed between the sequence and the number of terms; see the counterexample below for the necessity. Note that assumption () is satisfied when is a stopping time for the sequence . Assumption () is of more technical nature, implying absolute convergence and therefore allowing arbitrary rearrangement of an infinite series in the proof. If assumption () is satisfied, then assumption () can be strengthened to the simpler condition . there exists a real constant such that for all natural numbers . Indeed, using assumption (), and the last series equals the expectation of [Proof], which is finite by assumption (). Therefore, () and () imply assumption (). Assume in addition to () and () that . is independent of the sequence and . there