Wald's equation

In statistics, Wald's equation relates the expectation of a random sum of i.i.d. random variables to the expected number of terms in the sum and the random variables' common expectation.

Let X1, X2, ..., XN be a sequence of N i.i.d. random variables distributed identically to some random variable X, such that
 * 1) N > 0 is itself a random variable (integer-valued),
 * 2) the expectation of X, E(X) < ∞, and
 * 3) E(N) < ∞.

Then
 * $$\operatorname{E}\left(\sum_{i=1}^{N}X_i\right)=\operatorname{E}(N)\operatorname{E}(X).$$

In the general case, the random number N can be a stopping time for the stochastic process { Xi, i = 1, 2, ... }.