Expectation of Functions of Several Random Variables
Suppose an insurer covers two correlated risks, and . The payout is , the larger loss. What is the average payout? One instinct is to first find the distribution of the new random variable . Then compute from that distribution. This can require serious work. Finding the distribution of a maximum, product, or ratio of two random variables often means integrating over regions with awkward boundaries. The law of the unconscious statistician (LOTUS) in several dimensions says this detour is unnecessary. The expectation of can be computed directly from the joint distribution of . We never need to construct the distribution of itself. This shortcut matters because it converts a two-step problem into one step. Instead of finding a new distribution and then integrating, we do a single integral. This single integral or sum works directly against the joint density or joint mass function. It is the computational engine behind nearly every multivariate expectation calculation. It is how we define covariance. It is how we prove linearity of expectation for sums of dependent variables. It is how we compute moment generating functions of sums. It is also how we evaluate expected payoffs in economics and engineering models with multiple interacting sources of randomness. The companion fact, linearity of expectation, is philosophically distinct. But it is proved using the multivariate LOTUS as the key tool. The expectation of a sum equals . This holds regardless of dependence structure — no independence assumption is needed. This is one of the most useful facts in probability. It is also one of the most frequently misunderstood. It costs nothing to add expectations. But it costs a great deal to multiply them. That requires independence, or at least uncorrelatedness. This article gives the precise multivariate statement of LOTUS. It proves the statement carefully in the discrete and jointly continuous cases. It proves linearity of expectation as a corollary. It works through examples chosen so that the joint distribution is genuinely two-dimensional and asymmetric. No shortcuts are hidden by symmetry. It closes by connecting these tools to Covariance and Correlation and Conditional Expectation. Both of these topics rely on exactly this machinery.
- LOTUS in several variables lets you compute directly from the joint density/mass function of , with no need to derive the distribution of .
- The formula is (discrete) or (continuous).
- Linearity of expectation, , follows as the special case — and it requires no independence assumption whatsoever.
- Independence is needed for ; this asymmetry between sums and products is the seed of covariance.
- LOTUS extends immediately to variables and to vector-valued or unbounded state spaces, provided the relevant sum/integral converges absolutely.
- Key idea: you never need the distribution of to find its mean — the joint distribution of already contains that information.
Where this lives today
In statistics, computing the mean of a test statistic that is a nonlinear function of several sample values (e.g., a sample range, a ratio of sums of squares, an -statistic numerator) is done via multivariate LOTUS applied to the joint density of the order statistics or sufficient statistics, avoiding the need to derive their full sampling distributions. In finance and actuarial science, expected payoffs of options on multiple correlated assets (basket options, rainbow options paying of several stock prices) are computed as integrals of the payoff function against the joint (often multivariate lognormal) density of asset prices — this is the entire content of risk-neutral pricing for path-independent multi-asset derivatives. In machine learning, the expected loss (risk) of a model is , a direct application of multivariate LOTUS to the joint distribution of features and label ; empirical risk minimization approximates this integral by an average over data. In statistical physics, expectation values of observables that depend jointly on several particle coordinates or momenta (e.g., pair correlation functions, virial expressions) are computed by integrating the observable against the joint Boltzmann density — a direct physical instance of the theorem. In information theory, quantities like mutual information involve , computed by LOTUS applied to the joint law of . In queueing theory and reliability engineering, expected system lifetimes for series/parallel configurations use or of component lifetimes, evaluated by joint-density LOTUS rather than by first deriving the lifetime distribution of the whole system. And linearity of expectation, needing no independence, is the workhorse behind combinatorial "expected number of X" arguments throughout discrete mathematics and randomized algorithm analysis (e.g., expected number of fixed points of a random permutation, expected number of inversions), where indicator variables are summed even though they are highly dependent.
:::quiz[If have joint pmf and , which formula computes using 2-D LOTUS?]
- Find the distribution of first, then apply 1-D LOTUS to
- , summing directly over the joint pmf ✓
- regardless of dependence
- averaged over the marginals only
:::quiz[Linearity of expectation requires which of the following?]
- and must be independent
- and must be uncorrelated
- and must have the same distribution
- and must both exist (be finite); no independence needed ✓
:::quiz[In Example 1 of this article, was computed to be]
- 4.10, the same as
- 2.90, obtained directly from the joint pmf via LOTUS ✓
- Undefined, since is not a linear function
:::quiz[For the density on the unit square, was found to equal]
- , matching both direct LOTUS integration and the independence shortcut ✓
:::faq[Why doesn't ?] Because is not a linear function of its arguments, and LOTUS only reduces to the sum of marginal expectations when is linear (i.e., ). For nonlinear — max, min, product, ratio, square — the correct value must be computed by weighting against the full joint distribution, as shown in Example 1, where while : close in that example but not equal, and in general the gap can be arbitrarily large depending on the joint distribution's shape.
Ask the tutor: How does multivariate LOTUS generalize to computing when has a joint distribution with a singular component, or when is only piecewise continuous?
Let be random variables on a common probability space and let be a Borel-measurable function.
Discrete case. If has joint probability mass function supported on a countable set , then
provided (absolute convergence, needed since may be infinite and the sum must not depend on enumeration order).
Jointly continuous case. If has joint probability density function , then
provided . When these integrability conditions fail, is undefined (or, by convention, if and the integral diverges). The definition extends verbatim to variables and functions , replacing the double sum/integral with an -fold one over the joint law of .
Intuition
The ordinary law of the unconscious statistician for a single variable says : you weight each output value by the probability of the input that produced it, without ever building the distribution of itself. The two-dimensional version is the same idea lifted to a plane. Picture the joint mass function as a collection of point-masses scattered over a lattice of points in the plane, with the mass at equal to . To find , do not project this mass down onto the (harder-to-describe) axis of ; instead simply weight by the mass sitting at and sum. This is exactly analogous to finding the center of mass of a physical system: if masses sit at positions in the plane, and you want the average value of some quantity (say, gravitational potential) over the system, you do not need to know the distribution of potential values — you sum directly over the known positions and masses. Linearity of expectation is the special case : the weighted sum splits into , using only the marginal distributions — dependence between and never enters. That is the structural reason linearity needs no independence: the marginals alone determine , no matter how and are correlated.
Let be random variables on a common probability space , and let be Borel measurable.
(A) LOTUS. Suppose has joint pmf (discrete case) or joint pdf (jointly continuous case). If
respectively, then
in the discrete case, and the corresponding -fold integral in the continuous case.
(B) Linearity of expectation. If all exist (are finite), then exists and
This holds with no assumption of independence among , and more generally for any constants ,
We prove part (A) in the discrete case and the jointly continuous case, and then derive part (B) as a corollary. The technique in each case is a direct verification from the definition of expectation, using Fubini/Tonelli-type rearrangement justified by absolute convergence; this does not presuppose linearity and is fully self-contained.
Proof of (A), discrete case, for (the general case is identical with more indices). Let . Since is a discrete random variable (a Borel function of the discrete pair takes at most countably many values), its expectation is by definition
summed over the countable range of , provided . Group the sample points of by the value of they produce. For each value in the range of , the event decomposes as the disjoint union
a countable union of disjoint events (countable because the joint support is countable). By countable additivity of ,
Substituting,
where in the last step we replaced by , valid since on the inner sum. The double sum on the right, indexed first by and then by the pairs mapping to that , is exactly a partition of the full index set into the disjoint blocks as ranges over the range of . Because we assumed , the double sum converges absolutely, and a sum that converges absolutely may be regrouped into any partition of its index set without changing its value (this is the rearrangement theorem for absolutely convergent series, applied here to a series indexed by a countable set via any bijection with ). Hence
which is exactly the claimed formula. The finiteness hypothesis also confirms , since , so indeed exists as required for the argument to be valid.
Proof of (A), jointly continuous case, for . This requires the change-of-variables and Fubini machinery of measure-theoretic integration; we give the standard argument, which is rigorous provided is Borel measurable and the stated absolute integrability holds. The joint pdf defines a probability measure on via for Borel sets , and by construction is precisely the joint law of , i.e. for every Borel ,
The random variable is then a measurable function of , and by the change of variables theorem for Lebesgue–Stieltjes integrals (abstract version of LOTUS, itself proved by approximating by simple functions and using monotone convergence),
where the middle equality is the definition of the abstract expectation as an integral against the pushforward measure of , and the right equality holds because has density with respect to Lebesgue measure. The absolute integrability hypothesis guarantees this integral is well-defined (finite), matching the requirement that exists. (For a first course, one may instead take the change-of-variables step as a black box justified geometrically: it is the direct 2-D analogue of the 1-D LOTUS, which the reader has already seen and which is not being assumed circularly here — it is a foundational identity for expectations of transformed variables, established prior to and independently of the sum result we now derive.)
Proof of (B), Linearity of expectation. Apply part (A) with (case ; the general case is identical with more summands). In the discrete case,
For the first double sum, factor out (constant in ) and sum over first:
using the definition of the marginal pmf . Symmetrically, the second double sum equals . Hence . This regrouping (summing over first, then ) is again valid by absolute convergence: since and exist by hypothesis, and likewise for , so , confirming exists and the rearrangement above is licit. The jointly continuous case is identical with sums replaced by integrals and the marginal pdf ; Fubini's theorem (applicable because the integrand is shown absolutely integrable, exactly as above) justifies interchanging the order of integration. For general , induct on : write and apply the case with the two summands and , noting exists by the inductive hypothesis. This gives , completing the induction. Finally, for constants : the identity for a single variable follows directly from LOTUS with applied to alone (a one-dimensional instance of the same theorem), and combining this with the additivity just proved gives .
∎Worked examples
Example 1 — expected maximum of two dependent discrete variables, via 2-D LOTUS directly (no distribution of built). Let have the joint pmf below, deliberately asymmetric so no shortcut hides an error:
| 0.10 | 0.20 | 0.05 | |
| 0.15 | 0.05 | 0.10 | |
| 0.05 | 0.10 | 0.20 |
Check this is a valid pmf: summing all nine entries,
We want . By 2-D LOTUS with , we compute at each of the nine cells and weight by the cell probability — no need to find for each first (though we will cross-check by doing exactly that). Cell-by-cell values of :
| 1 | 1 | 3 | |
| 2 | 2 | 3 | |
| 5 | 5 | 5 |
Now apply LOTUS:
Compute term by term:
Sum: ; ; ; ; ; ; ; .
Cross-check by building the distribution of the long way. Group cells by -value: occurs at with probability ; occurs at with probability ; occurs at with probability ; occurs at with probability . Check: Then
matching the direct LOTUS computation, as the theorem guarantees. This confirms LOTUS saves the intermediate step: we got without ever tabulating . As a bonus, linearity gives the marginals for free: (each row sum), so
and (each column sum), so
Then , which is not equal to — as expected, since is nonlinear. But by linearity we do get for free, e.g., directly, matching a LOTUS check with :
Example 2 — a continuous, non-uniform joint density with a genuinely 2-D integral for . Let have joint density
First confirm this is a valid density:
Note and are independent here since factors into valid marginal densities on and on — chosen deliberately asymmetric (different exponents) so the calculation is non-trivial, though the LOTUS machinery below does not use independence at all.
Task: find directly via 2-D LOTUS, i.e. , without first finding the distribution of the product (which would be considerably harder — that ratio-type distribution has no elementary closed form on its own). By the continuous LOTUS,
Integrate over first:
Then integrate over :
So
Cross-check using independence (a shortcut only available because here): since and are independent, so are and (functions of independent variables are independent), hence . Compute each marginal moment directly:
Then , matching the direct 2-D LOTUS computation exactly. This illustrates that the product shortcut is a consequence of independence and LOTUS together — it is not automatic and would fail without independence, unlike linearity of sums which needs no such assumption.
The definition requires (or the integral analogue) before asserting . Drop this hypothesis and the "value" of the sum can depend on the order of summation, so the expression no longer unambiguously defines a number — the "expectation" it purports to compute is not well defined. Concrete construction: let and be independent, each taking values in with pmf (a valid pmf since ). Let
On the diagonal , the joint pmf is , and
since always. Off-diagonal terms are all zero. So actually in this instance the sum is absolutely convergent () — showing that the specific alternating sign trick needs to bite on a genuinely non-absolutely-convergent structure. Modify instead: let
with independent geometric-type variables with pmf for . Then along antidiagonals grouping by , one can produce partial sums (summing first, then , versus summing along increasing ) that tend to different limits, precisely because
is not finite (it equals by symmetry-type reasoning when signs are stripped, but the point is this diverges as an absolute sum whenever grows only geometrically-cancelled by sign, not by magnitude) — so no canonical value of exists: reordering the double series (row-by-row vs. diagonal-by-diagonal) yields different numerical answers, by the Riemann rearrangement phenomenon applied to this doubly-indexed series. This is exactly why the theorem's hypothesis demands absolute summability/integrability: without it, "" is not a well-defined real number, and the LOTUS formula cannot be asserted.
Scope, edge cases & common traps
| Situation | What holds | What can fail |
|---|---|---|
| , any joint distribution | always, no independence needed | — |
| only if (or more generally uncorrelated for this specific identity) | Fails in general when dependent; this gap defines covariance | |
| not integrable against joint law | LOTUS formula does not define a number | Students sometimes write the sum anyway and get an order-dependent "answer" |
| Marginals used inside LOTUS | Valid: e.g. where | Forgetting to sum out the other variable when only a marginal is needed |
| variables | All formulas extend verbatim with -fold sums/integrals and induction for linearity | Complexity of joint support/region can make direct integration hard even though the formula is simple |
| Mixed discrete/continuous pairs | Requires a joint law defined via conditional density/mass mixtures; LOTUS still applies with the appropriate mixed integral-sum | Naively writing a single density or single pmf for a mixed pair is incorrect |
The mathematician behind it
Origins · 1 minAndrei Nikolaevich Kolmogorov and how this was discovered
Kolmogorov's 1933 monograph Grundbegriffe der Wahrscheinlichkeitsrechnung placed probability on a rigorous measure-theoretic footing, defining expectation as an abstract Lebesgue integral against a probability measure. This framework is precisely what makes the multivariate LOTUS a theorem rather than a computational recipe: expectation of any measurable function of any collection of random variables is, by construction, the integral of that function against the pushforward measure of the joint law — exactly the identity used in the proof above.
Do I need and to be independent to use LOTUS?
No. The multivariate LOTUS formula (or the integral version) uses the joint distribution of exactly as given, whatever the dependence structure between and happens to be. Independence is a separate, additional property that, when present, lets the joint pmf/pdf factor as , which in turn allows further simplifications for specific functions — most notably for the product function. But the LOTUS formula itself is a completely general identity that holds for any joint law, correlated or not, discrete or continuous.
What's the difference between LOTUS and just "computing an expectation"?
"Computing an expectation" of itself uses 's own distribution. LOTUS is specifically about computing the expectation of a new random variable that is a transformation of existing variables, without deriving 's own distribution first. The insight is that the joint distribution of the inputs already carries all the information needed; LOTUS is the formula that extracts from that joint distribution directly, saving the (often much harder) step of computing 's marginal law.
Does linearity of expectation extend to infinitely many random variables?
For a finite sum , linearity holds unconditionally once each is finite, by the induction argument given in the proof. For an infinite sum , the identity requires additional justification — typically a dominated or monotone convergence argument, or absolute summability of — because interchanging an infinite sum with an integral (expectation) is not automatic. This extension is standard in showing, e.g., that a Poisson process has the expected count formula, but it is a genuinely separate theorem (a version of the dominated convergence theorem for expectations), not a free corollary of the finite case.
How does this connect to covariance?
Covariance is defined as , which is itself computed via 2-D LOTUS with . Expanding this product and applying linearity of expectation term by term yields the computational formula — so both the definition and the standard computational shortcut for covariance rest directly on the two tools developed in this article: multivariate LOTUS (to evaluate the product expectation) and linearity (to distribute the expectation across the expanded product). See Covariance and Correlation for the full development.
Can take vector values, e.g. ?
Yes, in the sense that one applies LOTUS coordinate-by-coordinate: is defined as the vector of expectations of each coordinate function, each computed by the scalar LOTUS formula above (provided each coordinate is integrable). This is how one computes, for instance, an expected covariance matrix or an expected gradient vector in multivariate statistics and machine learning — every entry is ultimately a scalar application of the theorem proved here.
Is joint LOTUS still valid if is neither purely discrete nor purely jointly continuous — e.g. one variable discrete, one continuous?
Yes, with an appropriately mixed formula. If is discrete with pmf and, conditional on , has density , then the joint law is specified by , and
again subject to absolute integrability. This mixed case is common, e.g., a discrete random number of continuous-valued claims in insurance models, and is the natural bridge toward the fully general definition of Conditional Expectation, where the inner integral is recognized as .