Expectation of Functions of Several Random Variables

Suppose an insurer covers two correlated risks, XX and YY. The payout is g(X,Y)=max⁡(X,Y)g(X,Y) = \max(X,Y), the larger loss. What is the average payout? One instinct is to first find the distribution of the new random variable Z=g(X,Y)Z = g(X,Y). Then compute E[Z]E[Z] 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 g(X,Y)g(X,Y) can be computed directly from the joint distribution of (X,Y)(X,Y). We never need to construct the distribution of g(X,Y)g(X,Y) 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 X+YX+Y equals E[X]+E[Y]E[X]+E[Y]. 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.

Key takeaways
  • LOTUS in several variables lets you compute E[g(X,Y)]E[g(X,Y)] directly from the joint density/mass function of (X,Y)(X,Y), with no need to derive the distribution of g(X,Y)g(X,Y).
  • The formula is E[g(X,Y)]=∑x∑yg(x,y)p(x,y)E[g(X,Y)] = \sum_x\sum_y g(x,y)p(x,y) (discrete) or ∬g(x,y)f(x,y) dx dy\iint g(x,y) f(x,y)\,dx\,dy (continuous).
  • Linearity of expectation, E[X+Y]=E[X]+E[Y]E[X+Y] = E[X]+E[Y], follows as the special case g(x,y)=x+yg(x,y) = x+y — and it requires no independence assumption whatsoever.
  • Independence is needed for E[XY]=E[X]E[Y]E[XY] = E[X]E[Y]; this asymmetry between sums and products is the seed of covariance.
  • LOTUS extends immediately to nn variables and to vector-valued or unbounded state spaces, provided the relevant sum/integral converges absolutely.
  • Key idea: you never need the distribution of g(X,Y)g(X,Y) to find its mean — the joint distribution of (X,Y)(X,Y) 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 FF-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 max⁡\max 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 E[ℓ(Y,f^(X))]E[\ell(Y, \hat f(X))], a direct application of multivariate LOTUS to the joint distribution of features XX and label YY; 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 E ⁣[log⁡p(X,Y)pX(X)pY(Y)]E\!\left[\log \frac{p(X,Y)}{p_X(X)p_Y(Y)}\right], computed by LOTUS applied to the joint law of (X,Y)(X,Y). In queueing theory and reliability engineering, expected system lifetimes for series/parallel configurations use g=min⁡g=\min or g=max⁡g=\max 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 X,YX,Y have joint pmf and g(x,y)=x−yg(x,y)=x-y, which formula computes E[g(X,Y)]E[g(X,Y)] using 2-D LOTUS?]

  • Find the distribution of Z=X−YZ=X-Y first, then apply 1-D LOTUS to ZZ
  • ∑x∑y(x−y) p(x,y)\sum_x\sum_y (x-y)\,p(x,y), summing directly over the joint pmf ✓
  • E[X]⋅E[−Y]E[X]\cdot E[-Y] regardless of dependence
  • max⁡(x,y)−min⁡(x,y)\max(x,y) - \min(x,y) averaged over the marginals only

:::quiz[Linearity of expectation E[X+Y]=E[X]+E[Y]E[X+Y]=E[X]+E[Y] requires which of the following?]

  • XX and YY must be independent
  • XX and YY must be uncorrelated
  • XX and YY must have the same distribution
  • E[X]E[X] and E[Y]E[Y] must both exist (be finite); no independence needed ✓

:::quiz[In Example 1 of this article, E[max⁡(X,Y)]E[\max(X,Y)] was computed to be]

  • 4.10, the same as E[X+Y]E[X+Y]
  • 2.90, obtained directly from the joint pmf via LOTUS ✓
  • max⁡(E[X],E[Y])=max⁡(2.70,1.40)=2.70\max(E[X],E[Y]) = \max(2.70,1.40) = 2.70
  • Undefined, since max⁡\max is not a linear function

:::quiz[For the density f(x,y)=6xy2f(x,y)=6xy^2 on the unit square, E[X2Y]E[X^2Y] was found to equal]

  • 12\frac{1}{2}
  • 34\frac{3}{4}
  • 38\frac{3}{8}, matching both direct LOTUS integration and the independence shortcut E[X2]E[Y]E[X^2]E[Y] ✓
  • 11

:::faq[Why doesn't E[max⁡(X,Y)]=max⁡(E[X],E[Y])E[\max(X,Y)] = \max(E[X], E[Y])?] Because max⁡\max is not a linear function of its arguments, and LOTUS only reduces to the sum of marginal expectations when gg is linear (i.e., g(x,y)=ax+by+cg(x,y)=ax+by+c). For nonlinear gg — max, min, product, ratio, square — the correct value must be computed by weighting g(x,y)g(x,y) against the full joint distribution, as shown in Example 1, where E[max⁡(X,Y)]=2.90E[\max(X,Y)]=2.90 while max⁡(E[X],E[Y])=max⁡(2.70,1.40)=2.70\max(E[X],E[Y])=\max(2.70,1.40)=2.70: 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 E[g(X,Y)]E[g(X,Y)] when (X,Y)(X,Y) has a joint distribution with a singular component, or when gg is only piecewise continuous?

DefinitionExpectation of a function of several random variables (LOTUS, multivariate case)

Let X,YX, Y be random variables on a common probability space (Ω,F,P)(\Omega, \mathcal{F}, P) and let g:R2→Rg:\mathbb{R}^2 \to \mathbb{R} be a Borel-measurable function.

Discrete case. If (X,Y)(X,Y) has joint probability mass function p(x,y)=P(X=x,Y=y)p(x,y) = P(X=x, Y=y) supported on a countable set S⊆R2S \subseteq \mathbb{R}^2, then

E[g(X,Y)]=∑(x,y)∈Sg(x,y) p(x,y),E[g(X,Y)] = \sum_{(x,y)\in S} g(x,y)\, p(x,y),

provided ∑(x,y)∈S∣g(x,y)∣ p(x,y)<∞\sum_{(x,y)\in S} |g(x,y)|\, p(x,y) < \infty (absolute convergence, needed since SS may be infinite and the sum must not depend on enumeration order).

Jointly continuous case. If (X,Y)(X,Y) has joint probability density function f(x,y)f(x,y), then

E[g(X,Y)]=∫−∞∞∫−∞∞g(x,y) f(x,y) dx dy,E[g(X,Y)] = \int_{-\infty}^\infty \int_{-\infty}^\infty g(x,y)\, f(x,y)\, dx\, dy,

provided ∬∣g(x,y)∣f(x,y) dx dy<∞\iint |g(x,y)| f(x,y)\, dx\, dy < \infty. When these integrability conditions fail, E[g(X,Y)]E[g(X,Y)] is undefined (or, by convention, +∞+\infty if g≥0g \geq 0 and the integral diverges). The definition extends verbatim to nn variables X1,…,XnX_1,\dots,X_n and functions g:Rn→Rg:\mathbb{R}^n\to\mathbb{R}, replacing the double sum/integral with an nn-fold one over the joint law of (X1,…,Xn)(X_1,\dots,X_n).

Intuition

The ordinary law of the unconscious statistician for a single variable says E[g(X)]=∑xg(x)p(x)E[g(X)] = \sum_x g(x)p(x): you weight each output value g(x)g(x) by the probability of the input xx that produced it, without ever building the distribution of g(X)g(X) itself. The two-dimensional version is the same idea lifted to a plane. Picture the joint mass function p(x,y)p(x,y) as a collection of point-masses scattered over a lattice of points in the plane, with the mass at (x,y)(x,y) equal to p(x,y)p(x,y). To find E[g(X,Y)]E[g(X,Y)], do not project this mass down onto the (harder-to-describe) axis of z=g(x,y)z = g(x,y); instead simply weight g(x,y)g(x,y) by the mass sitting at (x,y)(x,y) and sum. This is exactly analogous to finding the center of mass of a physical system: if masses mim_i sit at positions (xi,yi)(x_i,y_i) in the plane, and you want the average value of some quantity g(xi,yi)g(x_i,y_i) (say, gravitational potential) over the system, you do not need to know the distribution of potential values — you sum g(xi,yi) mig(x_i,y_i)\, m_i directly over the known positions and masses. Linearity of expectation is the special case g(x,y)=x+yg(x,y)=x+y: the weighted sum ∑x,y(x+y)p(x,y)\sum_{x,y}(x+y)p(x,y) splits into ∑xx(∑yp(x,y))+∑yy(∑xp(x,y))=∑xx pX(x)+∑yy pY(y)=E[X]+E[Y]\sum_x x\left(\sum_y p(x,y)\right) + \sum_y y \left(\sum_x p(x,y)\right) = \sum_x x\, p_X(x) + \sum_y y\, p_Y(y) = E[X]+E[Y], using only the marginal distributions — dependence between XX and YY never enters. That is the structural reason linearity needs no independence: the marginals alone determine E[X]+E[Y]E[X]+E[Y], no matter how XX and YY are correlated.

Figure
Weighting the joint mass grid by g(x,y)=xyg(x,y)=xy: LOTUS sums gg against the joint pmf directly, bypassing the distribution of the product
x y .12 .18 .15 .20 .10 .25 x=1 x=2 x=3 y=1 y=2 circle area ∝ p(x,y); label = p(x,y) E[XY] = Σ (xy)·p(x,y), summed over all 6 points directly
TheoremMultivariate LOTUS and Linearity of Expectation

Let X1,…,XnX_1, \dots, X_n be random variables on a common probability space (Ω,F,P)(\Omega,\mathcal{F},P), and let g:Rn→Rg: \mathbb{R}^n \to \mathbb{R} be Borel measurable.

(A) LOTUS. Suppose (X1,…,Xn)(X_1,\dots,X_n) has joint pmf p(x1,…,xn)p(x_1,\dots,x_n) (discrete case) or joint pdf f(x1,…,xn)f(x_1,\dots,x_n) (jointly continuous case). If

∑x1,…,xn∣g(x1,…,xn)∣ p(x1,…,xn)<∞or∫⋯∫∣g(x1,…,xn)∣ f(x1,…,xn) dx1⋯dxn<∞,\sum_{x_1,\dots,x_n} |g(x_1,\dots,x_n)|\, p(x_1,\dots,x_n) < \infty \quad \text{or} \quad \int \cdots \int |g(x_1,\dots,x_n)|\, f(x_1,\dots,x_n)\,dx_1\cdots dx_n < \infty,

respectively, then

E[g(X1,…,Xn)]=∑x1,…,xng(x1,…,xn) p(x1,…,xn)E[g(X_1,\dots,X_n)] = \sum_{x_1,\dots,x_n} g(x_1,\dots,x_n)\, p(x_1,\dots,x_n)

in the discrete case, and the corresponding nn-fold integral in the continuous case.

(B) Linearity of expectation. If E[X1],…,E[Xn]E[X_1],\dots,E[X_n] all exist (are finite), then E[X1+⋯+Xn]E[X_1+\cdots+X_n] exists and

E[X1+X2+⋯+Xn]=E[X1]+E[X2]+⋯+E[Xn].E[X_1 + X_2 + \cdots + X_n] = E[X_1] + E[X_2] + \cdots + E[X_n].

This holds with no assumption of independence among X1,…,XnX_1,\dots,X_n, and more generally for any constants a1,…,an,ba_1,\dots,a_n,b,

E ⁣[∑i=1naiXi+b]=∑i=1naiE[Xi]+b.E\!\left[\sum_{i=1}^n a_i X_i + b\right] = \sum_{i=1}^n a_i E[X_i] + b.
Proof

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 n=2n=2 (the general nn case is identical with more indices). Let Z=g(X,Y)Z = g(X,Y). Since ZZ is a discrete random variable (a Borel function of the discrete pair (X,Y)(X,Y) takes at most countably many values), its expectation is by definition

E[Z]=∑zz P(Z=z),E[Z] = \sum_{z} z\, P(Z=z),

summed over the countable range of ZZ, provided ∑z∣z∣P(Z=z)<∞\sum_z |z| P(Z=z) < \infty. Group the sample points of (X,Y)(X,Y) by the value of z=g(x,y)z = g(x,y) they produce. For each value zz in the range of ZZ, the event {Z=z}\{Z=z\} decomposes as the disjoint union

{Z=z}=⋃(x,y):g(x,y)=z{X=x,Y=y},\{Z=z\} = \bigcup_{(x,y): g(x,y)=z} \{X=x, Y=y\},

a countable union of disjoint events (countable because the joint support is countable). By countable additivity of PP,

P(Z=z)=∑(x,y):g(x,y)=zp(x,y).P(Z=z) = \sum_{(x,y): g(x,y)=z} p(x,y).

Substituting,

E[Z]=∑zz∑(x,y):g(x,y)=zp(x,y)=∑z∑(x,y):g(x,y)=zg(x,y) p(x,y),E[Z] = \sum_z z \sum_{(x,y): g(x,y)=z} p(x,y) = \sum_z \sum_{(x,y): g(x,y)=z} g(x,y)\, p(x,y),

where in the last step we replaced zz by g(x,y)g(x,y), valid since g(x,y)=zg(x,y)=z on the inner sum. The double sum on the right, indexed first by zz and then by the pairs (x,y)(x,y) mapping to that zz, is exactly a partition of the full index set S={(x,y):p(x,y)>0}S = \{(x,y) : p(x,y) > 0\} into the disjoint blocks {(x,y):g(x,y)=z}\{(x,y): g(x,y) = z\} as zz ranges over the range of ZZ. Because we assumed ∑(x,y)∈S∣g(x,y)∣p(x,y)<∞\sum_{(x,y)\in S} |g(x,y)| p(x,y) < \infty, 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 N\mathbb{N}). Hence

E[Z]=∑(x,y)∈Sg(x,y) p(x,y),E[Z] = \sum_{(x,y) \in S} g(x,y)\, p(x,y),

which is exactly the claimed formula. The finiteness hypothesis ∑∣g(x,y)∣p(x,y)<∞\sum |g(x,y)|p(x,y) < \infty also confirms ∑z∣z∣P(Z=z)<∞\sum_z |z| P(Z=z) < \infty, since ∑z∣z∣P(Z=z)=∑z∣∑(x,y):g=zg(x,y)p(x,y)∣≤∑z∑(x,y):g=z∣g(x,y)∣p(x,y)=∑(x,y)∣g(x,y)∣p(x,y)<∞\sum_z |z| P(Z=z) = \sum_z \left|\sum_{(x,y):g=z} g(x,y)p(x,y)\right| \le \sum_z \sum_{(x,y):g=z} |g(x,y)|p(x,y) = \sum_{(x,y)} |g(x,y)|p(x,y) < \infty, so E[Z]E[Z] indeed exists as required for the argument to be valid.

Proof of (A), jointly continuous case, for n=2n=2. This requires the change-of-variables and Fubini machinery of measure-theoretic integration; we give the standard argument, which is rigorous provided gg is Borel measurable and the stated absolute integrability holds. The joint pdf f(x,y)f(x,y) defines a probability measure μ\mu on R2\mathbb{R}^2 via μ(A)=∬Af(x,y) dx dy\mu(A) = \iint_A f(x,y)\,dx\,dy for Borel sets A⊆R2A \subseteq \mathbb{R}^2, and by construction μ\mu is precisely the joint law of (X,Y)(X,Y), i.e. for every Borel AA,

P((X,Y)∈A)=∬Af(x,y) dx dy.P((X,Y) \in A) = \iint_A f(x,y)\, dx\, dy.

The random variable Z=g(X,Y)Z = g(X,Y) is then a measurable function of (X,Y)(X,Y), and by the change of variables theorem for Lebesgue–Stieltjes integrals (abstract version of LOTUS, itself proved by approximating gg by simple functions and using monotone convergence),

E[Z]=∫R2g(x,y) dμ(x,y)=∬R2g(x,y)f(x,y) dx dy,E[Z] = \int_{\mathbb{R}^2} g(x,y)\, d\mu(x,y) = \iint_{\mathbb{R}^2} g(x,y) f(x,y)\, dx\, dy,

where the middle equality is the definition of the abstract expectation as an integral against the pushforward measure μ\mu of (X,Y)(X,Y), and the right equality holds because μ\mu has density ff with respect to Lebesgue measure. The absolute integrability hypothesis ∬∣g∣f<∞\iint |g| f < \infty guarantees this integral is well-defined (finite), matching the requirement that E[Z]E[Z] 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 g(x,y)=x+yg(x,y) = x+y (case n=2n=2; the general nn case is identical with more summands). In the discrete case,

E[X+Y]=∑x∑y(x+y) p(x,y)=∑x∑yx p(x,y)+∑x∑yy p(x,y).E[X+Y] = \sum_x \sum_y (x+y)\, p(x,y) = \sum_x \sum_y x\,p(x,y) + \sum_x \sum_y y\,p(x,y).

For the first double sum, factor out xx (constant in yy) and sum over yy first:

∑x∑yx p(x,y)=∑xx∑yp(x,y)=∑xx pX(x)=E[X],\sum_x \sum_y x\, p(x,y) = \sum_x x \sum_y p(x,y) = \sum_x x\, p_X(x) = E[X],

using the definition of the marginal pmf pX(x)=∑yp(x,y)p_X(x) = \sum_y p(x,y). Symmetrically, the second double sum equals ∑yy pY(y)=E[Y]\sum_y y\, p_Y(y) = E[Y]. Hence E[X+Y]=E[X]+E[Y]E[X+Y] = E[X] + E[Y]. This regrouping (summing over yy first, then xx) is again valid by absolute convergence: since E[X]E[X] and E[Y]E[Y] exist by hypothesis, ∑x∑y∣x∣p(x,y)=∑x∣x∣pX(x)=E[∣X∣]<∞\sum_x\sum_y |x| p(x,y) = \sum_x |x| p_X(x) = E[|X|] < \infty and likewise for YY, so ∑x∑y∣x+y∣p(x,y)≤∑x∑y(∣x∣+∣y∣)p(x,y)<∞\sum_x \sum_y |x+y| p(x,y) \le \sum_x\sum_y (|x|+|y|)p(x,y) < \infty, confirming E[X+Y]E[X+Y] exists and the rearrangement above is licit. The jointly continuous case is identical with sums replaced by integrals and the marginal pdf fX(x)=∫f(x,y) dyf_X(x) = \int f(x,y)\,dy; Fubini's theorem (applicable because the integrand is shown absolutely integrable, exactly as above) justifies interchanging the order of integration. For general nn, induct on nn: write X1+⋯+Xn=(X1+⋯+Xn−1)+XnX_1+\cdots+X_n = (X_1+\cdots+X_{n-1}) + X_n and apply the n=2n=2 case with the two summands U=X1+⋯+Xn−1U = X_1+\cdots+X_{n-1} and XnX_n, noting E[U]E[U] exists by the inductive hypothesis. This gives E[X1+⋯+Xn]=E[U]+E[Xn]=(E[X1]+⋯+E[Xn−1])+E[Xn]E[X_1+\cdots+X_n] = E[U]+E[X_n] = (E[X_1]+\cdots+E[X_{n-1}]) + E[X_n], completing the induction. Finally, for constants ai,ba_i, b: the identity E[aX+b]=aE[X]+bE[aX+b] = aE[X]+b for a single variable follows directly from LOTUS with g(x)=ax+bg(x)=ax+b applied to XX alone (a one-dimensional instance of the same theorem), and combining this with the additivity just proved gives E[∑aiXi+b]=∑aiE[Xi]+bE[\sum a_i X_i + b] = \sum a_i E[X_i] + b. ■\blacksquare

∎

Worked examples

Example 1 — expected maximum of two dependent discrete variables, via 2-D LOTUS directly (no distribution of ZZ built). Let (X,Y)(X,Y) have the joint pmf below, deliberately asymmetric so no shortcut hides an error:

x\yx\backslash yy=0y=0y=1y=1y=3y=3
x=1x=10.100.200.05
x=2x=20.150.050.10
x=5x=50.050.100.20

Check this is a valid pmf: summing all nine entries,

0.10+0.20+0.05+0.15+0.05+0.10+0.05+0.10+0.20=1.00.✓0.10+0.20+0.05+0.15+0.05+0.10+0.05+0.10+0.20 = 1.00. \checkmark

We want E[max⁡(X,Y)]E[\max(X,Y)]. By 2-D LOTUS with g(x,y)=max⁡(x,y)g(x,y)=\max(x,y), we compute max⁡(x,y)\max(x,y) at each of the nine cells and weight by the cell probability — no need to find P(max⁡(X,Y)=z)P(\max(X,Y)=z) for each zz first (though we will cross-check by doing exactly that). Cell-by-cell values of g(x,y)=max⁡(x,y)g(x,y) = \max(x,y):

x\yx\backslash yy=0y=0y=1y=1y=3y=3
x=1x=1113
x=2x=2223
x=5x=5555

Now apply LOTUS:

E[max⁡(X,Y)]=∑x,ymax⁡(x,y) p(x,y)E[\max(X,Y)] = \sum_{x,y} \max(x,y)\, p(x,y)
=(1)(0.10)+(1)(0.20)+(3)(0.05)+(2)(0.15)+(2)(0.05)+(3)(0.10)+(5)(0.05)+(5)(0.10)+(5)(0.20).= (1)(0.10) + (1)(0.20) + (3)(0.05) + (2)(0.15) + (2)(0.05) + (3)(0.10) + (5)(0.05) + (5)(0.10) + (5)(0.20).

Compute term by term:

0.10+0.20+0.15+0.30+0.10+0.30+0.25+0.50+1.00.0.10 + 0.20 + 0.15 + 0.30 + 0.10 + 0.30 + 0.25 + 0.50 + 1.00.

Sum: 0.10+0.20=0.300.10+0.20=0.30; +0.15=0.45+0.15=0.45; +0.30=0.75+0.30=0.75; +0.10=0.85+0.10=0.85; +0.30=1.15+0.30=1.15; +0.25=1.40+0.25=1.40; +0.50=1.90+0.50=1.90; +1.00=2.90+1.00=2.90.

E[max⁡(X,Y)]=2.90.E[\max(X,Y)] = 2.90.

Cross-check by building the distribution of Z=max⁡(X,Y)Z=\max(X,Y) the long way. Group cells by zz-value: z=1z=1 occurs at (1,0),(1,1)(1,0),(1,1) with probability 0.10+0.20=0.300.10+0.20=0.30; z=2z=2 occurs at (2,0),(2,1)(2,0),(2,1) with probability 0.15+0.05=0.200.15+0.05=0.20; z=3z=3 occurs at (1,3),(2,3)(1,3),(2,3) with probability 0.05+0.10=0.150.05+0.10=0.15; z=5z=5 occurs at (5,0),(5,1),(5,3)(5,0),(5,1),(5,3) with probability 0.05+0.10+0.20=0.350.05+0.10+0.20=0.35. Check: 0.30+0.20+0.15+0.35=1.00.✓0.30+0.20+0.15+0.35=1.00.\checkmark Then

E[Z]=1(0.30)+2(0.20)+3(0.15)+5(0.35)=0.30+0.40+0.45+1.75=2.90,E[Z] = 1(0.30)+2(0.20)+3(0.15)+5(0.35) = 0.30+0.40+0.45+1.75 = 2.90,

matching the direct LOTUS computation, as the theorem guarantees. This confirms LOTUS saves the intermediate step: we got 2.902.90 without ever tabulating P(Z=z)P(Z=z). As a bonus, linearity gives the marginals for free: pX(1)=0.35,pX(2)=0.30,pX(5)=0.35p_X(1)=0.35, p_X(2)=0.30, p_X(5)=0.35 (each row sum), so

E[X]=1(0.35)+2(0.30)+5(0.35)=0.35+0.60+1.75=2.70,E[X] = 1(0.35)+2(0.30)+5(0.35) = 0.35+0.60+1.75=2.70,

and pY(0)=0.30,pY(1)=0.35,pY(3)=0.35p_Y(0)=0.30, p_Y(1)=0.35, p_Y(3)=0.35 (each column sum), so

E[Y]=0(0.30)+1(0.35)+3(0.35)=0+0.35+1.05=1.40.E[Y] = 0(0.30)+1(0.35)+3(0.35) = 0+0.35+1.05 = 1.40.

Then E[X]+E[Y]=2.70+1.40=4.10E[X]+E[Y] = 2.70+1.40=4.10, which is not equal to E[max⁡(X,Y)]=2.90E[\max(X,Y)]=2.90 — as expected, since max⁡\max is nonlinear. But by linearity we do get for free, e.g., E[X+Y]=4.10E[X+Y] = 4.10 directly, matching a LOTUS check with g(x,y)=x+yg(x,y)=x+y: ∑(x+y)p(x,y)=1(0.10)+2(0.20)+4(0.05)+2(0.15)+3(0.05)+5(0.10)+5(0.05)+6(0.10)+8(0.20)=0.10+0.40+0.20+0.30+0.15+0.50+0.25+0.60+1.60=4.10.✓\sum(x+y)p(x,y) = 1(0.10)+2(0.20)+4(0.05)+2(0.15)+3(0.05)+5(0.10)+5(0.05)+6(0.10)+8(0.20) = 0.10+0.40+0.20+0.30+0.15+0.50+0.25+0.60+1.60 = 4.10.\checkmark

Example 2 — a continuous, non-uniform joint density with a genuinely 2-D integral for E[g(X,Y)]E[g(X,Y)]. Let (X,Y)(X,Y) have joint density

f(x,y)={6xy20<x<1, 0<y<10otherwise.f(x,y) = \begin{cases} 6xy^2 & 0 < x < 1,\ 0<y<1 \\ 0 & \text{otherwise.}\end{cases}

First confirm this is a valid density:

∫01∫016xy2 dy dx=∫016x[y33]01dx=∫016x⋅13 dx=∫012x dx=1.✓\int_0^1\int_0^1 6xy^2\, dy\, dx = \int_0^1 6x \left[\frac{y^3}{3}\right]_0^1 dx = \int_0^1 6x\cdot\frac13\, dx = \int_0^1 2x\, dx = 1. \checkmark

Note XX and YY are independent here since f(x,y)=(2x)(3y2)f(x,y) = (2x)(3y^2) factors into valid marginal densities fX(x)=2xf_X(x)=2x on (0,1)(0,1) and fY(y)=3y2f_Y(y) = 3y^2 on (0,1)(0,1) — chosen deliberately asymmetric (different exponents) so the calculation is non-trivial, though the LOTUS machinery below does not use independence at all.

Task: find E[X2Y]E[X^2 Y] directly via 2-D LOTUS, i.e. g(x,y)=x2yg(x,y) = x^2y, without first finding the distribution of the product X2YX^2Y (which would be considerably harder — that ratio-type distribution has no elementary closed form on its own). By the continuous LOTUS,

E[X2Y]=∫01∫01x2y⋅6xy2 dy dx=∫01∫016x3y3 dy dx.E[X^2Y] = \int_0^1\int_0^1 x^2 y \cdot 6xy^2\, dy\, dx = \int_0^1\int_0^1 6x^3 y^3\, dy\, dx.

Integrate over yy first:

∫016x3y3 dy=6x3[y44]01=6x3⋅14=3x32.\int_0^1 6x^3 y^3\, dy = 6x^3 \left[\frac{y^4}{4}\right]_0^1 = 6x^3 \cdot \frac14 = \frac{3x^3}{2}.

Then integrate over xx:

∫013x32 dx=32[x44]01=32⋅14=38.\int_0^1 \frac{3x^3}{2}\, dx = \frac{3}{2}\left[\frac{x^4}{4}\right]_0^1 = \frac{3}{2}\cdot\frac14 = \frac{3}{8}.

So

E[X2Y]=38=0.375.E[X^2Y] = \frac{3}{8} = 0.375.

Cross-check using independence (a shortcut only available because X⊥YX\perp Y here): since XX and YY are independent, so are X2X^2 and YY (functions of independent variables are independent), hence E[X2Y]=E[X2] E[Y]E[X^2Y] = E[X^2]\,E[Y]. Compute each marginal moment directly:

E[X2]=∫01x2⋅2x dx=∫012x3 dx=2⋅14=12,E[X^2] = \int_0^1 x^2 \cdot 2x\, dx = \int_0^1 2x^3\, dx = 2\cdot\frac14 = \frac12,
E[Y]=∫01y⋅3y2 dy=∫013y3 dy=3⋅14=34.E[Y] = \int_0^1 y \cdot 3y^2\, dy = \int_0^1 3y^3\, dy = 3\cdot \frac14 = \frac34.

Then E[X2]E[Y]=12⋅34=38=0.375E[X^2]E[Y] = \frac12\cdot\frac34 = \frac38 = 0.375, matching the direct 2-D LOTUS computation exactly. This illustrates that the product shortcut E[X2Y]=E[X2]E[Y]E[X^2Y]=E[X^2]E[Y] 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.

CounterexampleWhy absolute convergence/integrability cannot be dropped in LOTUS

The definition requires ∑∣g(x,y)∣p(x,y)<∞\sum |g(x,y)|p(x,y) < \infty (or the integral analogue) before asserting E[g(X,Y)]=∑g(x,y)p(x,y)E[g(X,Y)] = \sum g(x,y)p(x,y). Drop this hypothesis and the "value" of the sum can depend on the order of summation, so the expression ∑x∑yg(x,y)p(x,y)\sum_x\sum_y g(x,y)p(x,y) no longer unambiguously defines a number — the "expectation" it purports to compute is not well defined. Concrete construction: let XX and YY be independent, each taking values in {1,2,3,… }\{1,2,3,\dots\} with pmf pX(n)=pY(n)=6π2n2p_X(n) = p_Y(n) = \dfrac{6}{\pi^2 n^2} (a valid pmf since ∑n=1∞1/n2=π2/6\sum_{n=1}^\infty 1/n^2 = \pi^2/6). Let

g(x,y)={(−1)x+y xyif x=y0if x≠y.g(x,y) = \begin{cases} (-1)^{x+y}\, xy & \text{if } x=y \\ 0 & \text{if } x \neq y.\end{cases}

On the diagonal x=y=nx=y=n, the joint pmf is p(n,n)=pX(n)pY(n)=36π4n4p(n,n) = p_X(n)p_Y(n) = \dfrac{36}{\pi^4 n^4}, and

g(n,n) p(n,n)=(−1)2n n2⋅36π4n4=36π4n2,g(n,n)\, p(n,n) = (-1)^{2n}\, n^2 \cdot \frac{36}{\pi^4 n^4} = \frac{36}{\pi^4 n^2},

since (−1)2n=1(-1)^{2n}=1 always. Off-diagonal terms are all zero. So actually in this instance the sum is absolutely convergent (∑n36/(π4n2)<∞\sum_n 36/(\pi^4n^2) < \infty) — showing that the specific alternating sign trick needs to bite on a genuinely non-absolutely-convergent structure. Modify instead: let

g(x,y)=(−1)x+y(x+y)g(x,y) = (-1)^{x+y}\left(x+y\right)

with X,YX, Y independent geometric-type variables with pmf p(n)=12np(n) = \dfrac{1}{2^n} for n=1,2,3,…n=1,2,3,\dots. Then along antidiagonals grouping by s=x+ys=x+y, one can produce partial sums (summing xx first, then yy, versus summing along increasing s=x+ys=x+y) that tend to different limits, precisely because

∑x∑y∣g(x,y)∣ p(x)p(y)=∑x∑y(x+y)12x+y=∞\sum_x\sum_y |g(x,y)|\, p(x)p(y) = \sum_x\sum_y (x+y) \frac{1}{2^{x+y}} = \infty

is not finite (it equals 2E[X]2E[X] by symmetry-type reasoning when signs are stripped, but the point is this diverges as an absolute sum whenever (x+y)(x+y) grows only geometrically-cancelled by sign, not by magnitude) — so no canonical value of ∑g(x,y)p(x,y)\sum g(x,y)p(x,y) 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, "E[g(X,Y)]E[g(X,Y)]" is not a well-defined real number, and the LOTUS formula cannot be asserted.

Scope, edge cases & common traps

SituationWhat holdsWhat can fail
g(x,y)=x+yg(x,y)=x+y, any joint distributionE[X+Y]=E[X]+E[Y]E[X+Y]=E[X]+E[Y] always, no independence needed—
g(x,y)=xyg(x,y)=xyE[XY]=E[X]E[Y]E[XY]=E[X]E[Y] only if X⊥YX\perp Y (or more generally uncorrelated for this specific identity)Fails in general when X,YX,Y dependent; this gap defines covariance
∣g∣|g| not integrable against joint lawLOTUS formula does not define a numberStudents sometimes write the sum anyway and get an order-dependent "answer"
Marginals used inside LOTUSValid: e.g. E[X]=∑xx pX(x)E[X]=\sum_x x\,p_X(x) where pX(x)=∑yp(x,y)p_X(x)=\sum_y p(x,y)Forgetting to sum out the other variable when only a marginal is needed
n>2n>2 variablesAll formulas extend verbatim with nn-fold sums/integrals and induction for linearityComplexity of joint support/region can make direct integration hard even though the formula is simple
Mixed discrete/continuous pairsRequires a joint law defined via conditional density/mass mixtures; LOTUS still applies with the appropriate mixed integral-sumNaively 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
AN
Andrei Nikolaevich Kolmogorov
1903–1987 · Soviet Union, 20th-century foundations of probability

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.

History
- 1814 — Pierre-Simon Laplace's Théorie analytique des probabilités develops expectation calculations for combinations of random quantities in a pre-measure-theoretic setting.
- 1900s — Henri Lebesgue's integration theory supplies the analytic tool (dominated/monotone convergence, Fubini) needed to justify rearrangement of infinite double sums and iterated integrals.
- 1933 — Andrei Kolmogorov's axiomatization defines expectation as ∫ΩX dP\int_\Omega X\, dP, giving LOTUS its modern, fully rigorous form as a change-of-variables theorem.
- 1940s–1950s — Textbook treatments (Cramér, Feller) popularize the joint-density/joint-mass formulation used in applied statistics courses.
- Present — the multivariate LOTUS is the standard first tool taught before covariance, moment generating functions of sums, and conditional expectation.
Do I need XX and YY to be independent to use LOTUS?

No. The multivariate LOTUS formula E[g(X,Y)]=∑g(x,y)p(x,y)E[g(X,Y)] = \sum g(x,y)p(x,y) (or the integral version) uses the joint distribution of (X,Y)(X,Y) exactly as given, whatever the dependence structure between XX and YY happens to be. Independence is a separate, additional property that, when present, lets the joint pmf/pdf factor as p(x,y)=pX(x)pY(y)p(x,y) = p_X(x)p_Y(y), which in turn allows further simplifications for specific functions gg — most notably E[XY]=E[X]E[Y]E[XY] = E[X]E[Y] 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 XX itself uses XX's own distribution. LOTUS is specifically about computing the expectation of a new random variable Z=g(X,Y)Z=g(X,Y) that is a transformation of existing variables, without deriving ZZ'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 E[Z]E[Z] from that joint distribution directly, saving the (often much harder) step of computing ZZ's marginal law.

Does linearity of expectation extend to infinitely many random variables?

For a finite sum X1+⋯+XnX_1+\cdots+X_n, linearity holds unconditionally once each E[Xi]E[X_i] is finite, by the induction argument given in the proof. For an infinite sum ∑i=1∞Xi\sum_{i=1}^\infty X_i, the identity E[∑iXi]=∑iE[Xi]E\left[\sum_i X_i\right] = \sum_i E[X_i] requires additional justification — typically a dominated or monotone convergence argument, or absolute summability of ∑iE[∣Xi∣]\sum_i E[|X_i|] — 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 Cov(X,Y)=E[(X−E[X])(Y−E[Y])]\mathrm{Cov}(X,Y) = E[(X-E[X])(Y-E[Y])], which is itself computed via 2-D LOTUS with g(x,y)=(x−E[X])(y−E[Y])g(x,y) = (x-E[X])(y-E[Y]). Expanding this product and applying linearity of expectation term by term yields the computational formula Cov(X,Y)=E[XY]−E[X]E[Y]\mathrm{Cov}(X,Y) = E[XY]-E[X]E[Y] — 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 gg take vector values, e.g. g(X,Y)=(X+Y,XY)g(X,Y) = (X+Y, XY)?

Yes, in the sense that one applies LOTUS coordinate-by-coordinate: E[g(X,Y)]E[g(X,Y)] 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 (X,Y)(X,Y) is neither purely discrete nor purely jointly continuous — e.g. one variable discrete, one continuous?

Yes, with an appropriately mixed formula. If XX is discrete with pmf pXp_X and, conditional on X=xX=x, YY has density fY∣X(y∣x)f_{Y\mid X}(y\mid x), then the joint law is specified by pX(x)fY∣X(y∣x)p_X(x) f_{Y|X}(y|x), and

E[g(X,Y)]=∑xpX(x)∫g(x,y) fY∣X(y∣x) dy,E[g(X,Y)] = \sum_x p_X(x) \int g(x,y)\, f_{Y|X}(y|x)\, dy,

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 E[g(X,Y)∣X=x]E[g(X,Y)\mid X=x].

Before this

Where this leads