Expectation
Suppose you play a game where you roll a fair die. You win the square of the number shown, in dollars. How much should you expect to walk away with, on average? This applies if you play many times. This is the question that expectation answers. It is the long-run average value of a random quantity. This average is weighted by how likely each outcome is. Expectation is arguably the single most useful number attached to a random variable. It compresses an entire probability distribution into one representative summary. This works in the same way that a center of mass summarizes a distribution of physical weight along a rod. The idea matters because almost every quantitative claim in probability and statistics is, at bottom, a statement about an expectation. This includes insurance premiums, machine learning loss functions, and statistical estimators. Variances, covariances, moment generating functions, and even probabilities themselves are all expectations of cleverly chosen random variables. Probabilities count as expectations via indicator variables. Understanding expectation rigorously is a prerequisite for everything that follows in probability theory. So is understanding why you are allowed to compute the expectation of a function of a random variable, without first finding that function's own distribution. The big picture is this: expectation is a linear, monotone, positivity-respecting map from random variables to real numbers. It is built by integrating (or summing) the variable against its probability measure. Two structural facts make expectation tractable in practice. The first is linearity — the expectation of a sum is the sum of expectations, always, with no independence assumption required. The second is the law of the unconscious statistician (LOTUS). LOTUS lets you compute directly from the distribution of . This bypasses the distribution of entirely. This article gives the precise definition of expectation for discrete and continuous random variables. It proves linearity in full generality, including the infinite-sum case. It proves LOTUS carefully in both the discrete and continuous settings. It also works through examples chosen to expose common errors. These include the temptation to assume independence is needed for linearity. They also include forgetting that expectations of infinite series must converge absolutely to be well defined.
- Expectation is a weighted average: for discrete , for continuous .
- Expectation may fail to exist (diverge) even when the random variable is finite with probability one — absolute convergence is required.
- Linearity holds unconditionally: , for any on the same space, no independence needed.
- LOTUS lets you compute using only the distribution of , never the distribution of .
- Expectation is monotone and respects positivity: , and .
- Key idea: expectation is a single linear functional built from the probability measure, and linearity plus LOTUS turn hard distributional problems into easy summation/integration problems.
Where this lives today
Expectation is the computational backbone of statistics, where estimators are evaluated by their expected value (bias) and where maximum likelihood and Bayesian methods both reduce, at some stage, to expectations under a model. In finance, the no-arbitrage pricing of derivatives is built on computing expected discounted payoffs under a risk-neutral probability measure — precisely a LOTUS calculation applied to a payoff function of an underlying asset price. In machine learning, the expected loss (risk) over a data distribution is the quantity that training algorithms attempt to minimize, and LOTUS is used constantly to compute the expected value of a loss function applied to model predictions without needing the (often intractable) distribution of the loss itself. In statistical physics, expectation under the Boltzmann distribution gives thermodynamic averages such as mean energy, connecting directly back to the center-of-mass intuition of this article. In information theory, entropy is itself an expectation of a function of the pmf, a direct LOTUS-style computation. In queueing theory and operations research, expected waiting times and expected costs guide system design, again computed via linearity even when the underlying random variables (arrival times, service times) are heavily dependent. Finally, expectation is the immediate stepping stone to Variance and Moments (which uses , itself a LOTUS computation) and to Moment Generating Functions (which package all moments into a single function ).
:::quiz[If has , , , what is ?]
- 0.6
- -0.3 ✓
- 1.0
- 2.4
:::quiz[LOTUS lets you compute using:]
- The distribution of , found first via change of variables
- The distribution of alone, applied directly with ✓
- Only the CDF of
- Monte Carlo simulation exclusively
:::quiz[For with density on , what is ?]
- 1/2
- 1/3
- 2/3
- 1/2... recompute: ✓
:::quiz[Why does the counterexample series fail to define a valid ?]
- Because the pmf does not sum to 1
- Because the series converges conditionally but not absolutely, so its sum depends on term order ✓
- Because takes infinitely many values, which is never allowed
- Because negative values are not permitted for random variables
:::faq[Does linearity extend to infinitely many random variables, ?] Not automatically — this requires an extra hypothesis beyond pairwise finiteness of each , typically , after which the dominated convergence theorem (or monotone convergence, if all ) licenses interchanging the infinite sum and the expectation. Without such a condition, the interchange can fail exactly as in the counterexample above, where infinite rearrangements are not automatically benign. This finite-vs-infinite distinction is why the theorem in this article is stated for two (equivalently, any finite number of) random variables, with the infinite extension treated as a separate, stronger result.
Ask the tutor: Why is independence needed for but not for ?
Let be a random variable on a probability space .
Discrete case. If takes values in a countable set with probability mass function , the expectation of is
provided the series converges absolutely, i.e. . If this sum diverges (does not converge absolutely), is said not to exist (or, if all terms have a fixed sign, may be declared or ).
Continuous case. If has probability density function , meaning for (Borel) sets , the expectation of is
provided .
Unified measure-theoretic statement. Both cases are instances of the Lebesgue integral of against :
defined whenever , in which case is called integrable. This article develops the discrete and continuous cases explicitly; the underlying justification for why these two formulas are special cases of one operation is the content of measure-theoretic integration, referenced but not re-derived here.
Intuition
Think of the probability mass function of a discrete random variable as a set of point weights placed along the real line: weight sitting at position . The expectation is exactly the center of mass of this system of weights — the balance point of a rigid, weightless rod on which the weights are hung. If you replace weights with a continuous density smeared along the line, the same balance-point interpretation survives, with the sum becoming an integral. This mechanical picture immediately explains several facts that otherwise look mysterious. It explains why need not equal any value that can actually take (the center of mass of a two-point system need not coincide with either point). It explains why is not generally equal to the median or the mode — those are different notions of "typical value," while expectation specifically tracks the balance point. It also foreshadows why can be pulled outside sums and scalar multiples: shifting or scaling every weight's position shifts or scales the balance point in the same way, and combining two independent physical systems' balance points behaves additively when you consider their sum.
Structural theorem
Let and be random variables on the same probability space with and , and let be constants. Then is integrable and
No assumption of independence between and is required.
Let be a discrete random variable with pmf , taking values in a countable set , and let be any function. Then
provided , in which case both sides exist and are equal.
Let be a continuous random variable with density , and let be a (Borel-measurable) function such that is a well-defined random variable. Then
provided , in which case both sides exist and are equal.
We give complete, self-contained proofs for the discrete case first (where all manipulations are honest series rearrangements justified by absolute convergence), then indicate how the continuous case follows by the analogous integral argument. The technique throughout is direct computation from the definition, together with Fubini/Tonelli-type rearrangement of absolutely convergent double sums (justified explicitly below), so no result depending on the theorems being proved is invoked.
Step 1: LOTUS, discrete case. Let take values in a countable set with . Fix and set . Since takes countably many values, so does ; let be the (countable) set of values can take. By definition of expectation applied directly to ,
For each fixed , the event is exactly , a disjoint union of the events over those with . Since these events are pairwise disjoint (as takes only one value) and countable in number, countable additivity of gives
Substituting,
using inside the inner sum. The double sum on the right ranges, without overlap or omission, over every exactly once (each has a unique image , so it appears in exactly one inner sum). Because we are given , this double sum converges absolutely, so by the theorem on rearrangement of absolutely convergent series (a series that converges absolutely may be summed in any order or grouping without changing its value), we may collapse the double sum into a single sum indexed by :
This proves the discrete LOTUS. Note this argument never required computing the distribution of beyond identifying which 's map to a given — but crucially, the final formula does not reference or the grouping at all, which is exactly the labor LOTUS saves you.
Step 2: Linearity, discrete case. Apply Step 1 with replaced by the two-variable function applied to the pair , viewed as a single discrete random vector taking values in the countable set with joint pmf . By the same argument as Step 1 (which extends verbatim to functions of a discrete random vector, since a countable product of countable sets is countable and the disjointness/additivity argument is unchanged),
provided . This absolute convergence holds because , and
where the middle equality uses that summing over recovers the marginal (and symmetrically for ), a rearrangement again justified by absolute convergence of each nonnegative series. Now split the finite (absolutely convergent) double sum:
For the first term, sum over first for each fixed :
and symmetrically the second term equals . Hence
with no reference anywhere to independence of and — the joint pmf was used exactly as given, whatever the dependence structure between and happens to be.
Step 3: LOTUS and linearity, continuous case. The continuous case requires an integral version of the rearrangement argument; the rigorous justification is Fubini's theorem for absolutely integrable functions, which plays the exact structural role that "rearrangement of absolutely convergent series" played above. We outline the argument, which mirrors Step 1–2 line by line with sums replaced by integrals. For LOTUS: let have density and let . If is monotone and differentiable with inverse , the density of can be found via the change-of-variables formula , and then
by the ordinary calculus substitution , (with the sign of compensating the absolute value in , exactly as in the change-of-variables formula for densities). For general (non-monotone, possibly non-differentiable) Borel , the identity is proved by the standard layer-cake / simple-function approximation argument: it holds by definition of the integral for an indicator function (since then directly from the definition of density), extends to nonnegative simple functions by linearity of finite sums, extends to nonnegative measurable by monotone convergence (approximating from below by simple functions), and extends to general integrable against by splitting . This is precisely the construction of the Lebesgue integral, applied here to the measure with density . For linearity in the continuous case: apply the two-dimensional analogue of the above with joint density and :
valid because is integrable against (by the same triangle-inequality bound and marginal-integral argument as Step 2, with sums replaced by integrals). Fubini's theorem for absolutely integrable functions permits splitting this double integral and integrating each variable out separately, giving
again without any use of independence.
∎If almost surely and exists, then . Consequently, if almost surely and both have finite expectation, then .
If , every term (discrete) or every value integrated (continuous, since and on the support) is nonnegative, so the defining sum/integral is a sum/integral of nonnegative terms and hence nonnegative. For the second claim, apply the first statement to and use linearity (Linearity of Expectation) to write .
∎Worked examples
Example 1: A non-symmetric wager with LOTUS. A biased die has , , , , , (these sum to : ). A gambler is paid dollars. To find , LOTUS says we never need the distribution of itself — only and :
Compute at each value: , , , , , . Now weight by the pmf:
Term by term: . Summing: ; ; ; ; . So dollars. As a consistency check via linearity, note , so
Compute . Compute . Then , matching exactly — confirming both LOTUS and linearity are consistent computational routes to the same number, as the theorem guarantees.
Example 2: A continuous asymmetric density, LOTUS for a non-monotone transformation. Let have density on (and elsewhere); check this integrates to : . Let , a non-monotone (parabolic, folded) transformation of on , which is 0 at and increases toward both endpoints. Rather than find the distribution of (which would require splitting into two branches around and adding densities), LOTUS gives the answer directly:
Expand , so the integrand is
Integrate term by term over :
So
Thus . Notice how little work this required compared to deriving : LOTUS converted a change-of-variables problem (with a fold at , requiring for the two preimages) into a single polynomial integral against the known density of .
:::counterexample[Dropping absolute convergence breaks well-definedness of ] The hypothesis of absolute convergence (not mere convergence, and not merely "the sum exists in some order") is essential, not a technicality. Consider a discrete random variable taking values for with masses ; these masses sum to since , so this is a legitimate pmf. Now attempt to compute term by term as ordinarily listed:
which looks like a perfectly good finite answer, . But this series is only conditionally convergent, not absolutely convergent: (the harmonic series diverges). By the Riemann rearrangement theorem, a conditionally convergent series can be reordered to converge to any target real number, or to diverge, simply by listing its terms () in a different order. Since the definition of as "the sum over all outcomes" makes no reference to an ordering of the countable outcome space (the underlying probability space has no built-in order on its sample points), the "value" obtained above is an artifact of one arbitrary enumeration of the 's and is not intrinsic to . This is exactly why the definition of requires absolute convergence: without it, the quantity is not well-defined as a property of the random variable, only of an incidental labeling of its outcomes. This is also why linearity, as proved above, explicitly assumed : the rearrangement step in the proof is licensed only by absolute convergence, and dropping that hypothesis genuinely breaks the proof, not just its presentation.
Scope, edge cases & common traps
| Situation | What holds | What can fail |
|---|---|---|
| dependent, both integrable | always | generally fails without independence |
| but | Expectation may be declared (e.g. St. Petersburg-type variables) | The variable is not "integrable"; many downstream theorems (variance, CLT) require finiteness |
| Series/integral converges only conditionally | A numerical value can be computed by a specific ordering | That value is not intrinsic to ; is undefined (see counterexample) |
| non-monotone or non-injective | LOTUS still applies exactly as stated | Attempting to find first (instead of using LOTUS) is unnecessary extra work and error-prone |
| Mixed discrete/continuous | Definition extends via Riemann–Stieltjes/Lebesgue integral against the CDF | Naively applying only the pure-discrete or pure-continuous formula misses part of the distribution |
The mathematician behind it
Origins · 1 minChristiaan Huygens and how this was discovered
Huygens is credited with the first published systematic treatment of expected value, in his 1657 treatise De Ratiociniis in Ludo Aleae ("On Reasoning in Games of Chance"), building on correspondence between Pascal and Fermat concerning the fair division of stakes in interrupted games. Huygens framed expectation as the fair price to pay to enter a game with given prizes and probabilities — precisely the center-of-mass / fair-value intuition still used to introduce the concept today. His treatment predates a formal axiomatic theory of probability by nearly three centuries, yet his definition of "expectation" for finite games already matches, term for term, the discrete formula used throughout this article.
Why does expectation require absolute convergence rather than just convergence?
Expectation is defined as a sum or integral over the outcomes of a random variable, and the underlying sample space carries no intrinsic ordering. If the defining series converges only conditionally, the Riemann rearrangement theorem guarantees that reordering the very same terms can produce any target value, or even divergence. That would make "" depend on an arbitrary labeling of outcomes rather than on the random variable itself, which is unacceptable for a quantity meant to be an intrinsic property of . Requiring absolute convergence, , guarantees the sum is independent of order, so is genuinely well-defined. This is why textbooks always state the integrability condition as a hypothesis, not an afterthought.
Does linearity of expectation require independence?
No — this is one of the most important and most frequently misunderstood facts in probability. The identity holds for any two random variables on the same probability space with finite expectations, no matter how strongly dependent they are. The proof only uses the joint distribution to marginalize back down to and individually, a step that works regardless of dependence structure. Independence becomes essential for a different identity, , which genuinely fails in general when are dependent. Confusing these two facts is one of the most common errors made when first learning expectation.
What is the point of LOTUS if I could just find the distribution of and use the ordinary expectation formula?
Finding the distribution of can be substantially harder than computing directly, especially when is non-monotone, non-injective, or complicated (as in Example 2, where folds the interval onto itself). LOTUS bypasses that derivation entirely: it says you may plug straight into the known pmf or density of and sum or integrate, obtaining the same numerical answer with far less work and far less risk of a change-of-variables error, such as forgetting a Jacobian term or missing a branch of a non-monotone transformation.
Can expectation fail to exist even if is finite with probability 1?
Yes. A random variable can take only finite real values on every outcome, yet have , so that is undefined (or assigned by convention in the one-signed case). The classical example is the St. Petersburg paradox: a fair-coin game paying dollars if the first head appears on flip , giving , even though any single play of the game yields a finite payout. This shows finiteness of pointwise is a weaker condition than integrability of , and the two must not be conflated.
How does expectation relate to variance and moment generating functions?
Expectation is the base operation from which both are built. The variance of is defined as , itself an application of LOTUS with , measuring the average squared deviation from the mean. The moment generating function is , again a direct LOTUS computation, and its derivatives at recover all the moments of simultaneously. Both of these topics, Variance and Moments and Moment Generating Functions, are impossible to state or compute without the definition of expectation and the LOTUS machinery developed here.
Is expectation the same as the "most likely value" or the median?
No, and this is a common conceptual confusion. The mode is the value (or values) with the highest probability mass or density; the median is the value splitting the probability mass in half; the mean (expectation) is the probability-weighted average, i.e. the balance point. For skewed distributions these three can differ substantially — for instance, income distributions typically have mean well above the median because a small number of very large incomes pull the balance point upward, while leaving the "middle" (median) relatively unaffected.