The law of the unconscious statistician computes the expected value of a measurable function of a random variable directly from the original probability distribution. If is an integrable random variable, then
Use for a probability mass function, or for a probability density function. There is no need to derive the probability distribution of first. The identity is the integration rule for a pushforward measure, and also holds with an infinite value when is nonnegative. [ref].
For taking with probabilities , choosing gives . Its variance is therefore . Squaring the expected value would instead give , because squaring does not commute with averaging.
Linearity of expectation Created 2026-09-24 Updated 2026-10-14
For integrable random variables on the same probability space and fixed real numbers , linearity of expectation states
The random variables can be dependent random variables. The formula follows by the linearity of integration; a finite linear combination of integrable random variables remains integrable. For example, if takes with probabilities , then and are dependent random variables, yet .
An especially useful application counts how many events occur. Put , an indicator random variable, and . Since , we get . There is no need to compute the whole probability distribution of , or to assume independence. For a uniform random permutation of objects, each object stays fixed with probability , so the fixed point count of a uniform random permutation has expected value one for every . [ref].
Linearity of expectation concerns addition and multiplication by fixed scalars. Products instead satisfy under the hypotheses of expectation of a product of independent random variables. For the example above, , whereas . Applying a nonlinear function before averaging can therefore change the answer substantially; use the law of the unconscious statistician to compute that average.