Tutorials › Stochastic Processes › Factorization of Expectations Under Independence

Random Variables, Expectation and Conditional Expectation · Tutorial 12 of 994

Factorization of Expectations Under Independence

Learn the conditions and proofs behind product-expectation factorization, then use it to calculate moments and covariances.

Intermediate 10 min read

What You'll Learn

  • State the integrability conditions for factoring expectations of functions of independent variables.
  • Prove the factorization rule for countable discrete laws using absolutely convergent sums.
  • Prove the rule for independent variables with densities using product densities and Fubini’s theorem.
  • Use independence to calculate mixed moments and covariances.
  • Identify the error in applying factorization to dependent variables.

Why Independence Simplifies Expectations

When two random variables are independent, information about one does not change the distribution of the other. A useful consequence is that certain expectations involving both variables can be computed from their separate expectations. For example, under suitable integrability conditions, \(\mathbb{E}[XY]=\mathbb{E}[X]\mathbb{E}[Y]\). This identity is not a rule for arbitrary pairs of variables: independence is essential, and the expectations must exist in a form that makes the product well-defined.

Throughout, let \(X\) and \(Y\) be random variables on a common probability space \((\Omega,\mathcal{F},\mathbb{P})\). They are independent if, for every pair of Borel sets \(A,B\subseteq\mathbb{R}\), \(\mathbb{P}(X\in A,Y\in B)=\mathbb{P}(X\in A)\mathbb{P}(Y\in B)\). In particular, their joint law is the product of their marginal laws. We first establish the expectation rule for countable discrete laws and then for variables with densities.

Theorem (Factorization for discrete variables): Suppose \(X\) and \(Y\) are independent and each has countable support, with probability mass functions \(p_i=\mathbb{P}(X=x_i)\) and \(q_j=\mathbb{P}(Y=y_j)\). Let \(g,h:\mathbb{R}\to\mathbb{R}\) be functions such that \(\mathbb{E}|g(X)|<\infty\) and \(\mathbb{E}|h(Y)|<\infty\). Then \(g(X)h(Y)\) is integrable and \(\mathbb{E}[g(X)h(Y)]=\mathbb{E}[g(X)]\mathbb{E}[h(Y)]\).

Proof. Independence gives \(\mathbb{P}(X=x_i,Y=y_j)=p_iq_j\). The absolute sum of the terms for the joint expectation is \(\sum_i\sum_j |g(x_i)h(y_j)|p_iq_j\). Because all terms in this absolute sum are nonnegative, the countable-sum version of Tonelli’s theorem permits the iterated sums to be evaluated in either order. Thus the sum equals \((\sum_i |g(x_i)|p_i)(\sum_j |h(y_j)|q_j)=\mathbb{E}|g(X)|\mathbb{E}|h(Y)|<\infty\). The joint product is therefore integrable, and its signed expectation can be rearranged. Using the joint probabilities again gives \(\mathbb{E}[g(X)h(Y)]=\sum_i\sum_j g(x_i)h(y_j)p_iq_j=(\sum_i g(x_i)p_i)(\sum_j h(y_j)q_j)=\mathbb{E}[g(X)]\mathbb{E}[h(Y)]\). \(\square\)

This proof also explains why the integrability hypotheses matter: they ensure that rearranging the signed double sum is valid. For the common choice \(g(x)=x\) and \(h(y)=y\), finite absolute first moments are sufficient. For powers, the same theorem applies when the corresponding absolute moments are finite.

Worked Example: A Mixed Moment for Discrete Variables

Suppose \(X\) and \(Y\) are independent, \(X\) takes values \(-1\) and \(2\) with probabilities \(\tfrac13\) and \(\tfrac23\), and \(Y\) takes values \(0\) and \(3\) with probabilities \(\tfrac12\) each. Find \(\mathbb{E}[XY]\) and check it from the joint law.

The probabilities in each marginal sum to one: \(\tfrac13+\tfrac23=1\) for \(X\), and \(\tfrac12+\tfrac12=1\) for \(Y\). First compute the separate means: \(\mathbb{E}[X]=(-1)(\tfrac13)+2(\tfrac23)=-\tfrac13+\tfrac43=1\), and \(\mathbb{E}[Y]=0(\tfrac12)+3(\tfrac12)=\tfrac32\). The factorization theorem applies, since the variables have finite support, and gives \(\mathbb{E}[XY]=1\cdot\tfrac32=\tfrac32\).

Check from the joint law. Independence gives probabilities \(\tfrac16,\tfrac13,\tfrac16,\tfrac13\) for \((-1,0),(-1,3),(2,0),(2,3)\), respectively; these sum to \(1\). Their product contributions to the expectation are \(0,-\tfrac12,0,2\). Adding them gives \(\mathbb{E}[XY]=-\tfrac12+2=\tfrac32\), as required.

Independent Variables with Densities

For continuous random variables, expectations are integrals rather than sums. Suppose \(X\) and \(Y\) have densities \(f_X\) and \(f_Y\), and their joint law has density \(f_{X,Y}\). Independence means that this joint law is the product of the marginal laws, so \(f_{X,Y}(x,y)=f_X(x)f_Y(y)\) for almost every \((x,y)\). Equality almost everywhere is sufficient: changing a density on a set of area zero does not change its integrals.

Theorem (Factorization for variables with densities): Suppose \(X\) and \(Y\) are independent and have densities \(f_X\) and \(f_Y\). If \(g\) and \(h\) are measurable and \(\int_{\mathbb{R}}|g(x)|f_X(x)\,dx<\infty\) and \(\int_{\mathbb{R}}|h(y)|f_Y(y)\,dy<\infty\), then \(g(X)h(Y)\) is integrable and \(\mathbb{E}[g(X)h(Y)]=\mathbb{E}[g(X)]\mathbb{E}[h(Y)]\).

Proof. By independence, the joint density is \(f_X(x)f_Y(y)\) almost everywhere. Tonelli’s theorem for nonnegative integrands gives \(\int_{\mathbb{R}}\int_{\mathbb{R}} |g(x)h(y)|f_X(x)f_Y(y)\,dy\,dx=(\int_{\mathbb{R}}|g(x)|f_X(x)\,dx)(\int_{\mathbb{R}}|h(y)|f_Y(y)\,dy)<\infty\). Thus the joint integrand is absolutely integrable. Fubini’s theorem therefore allows the signed double integral to be evaluated as an iterated integral, giving \(\mathbb{E}[g(X)h(Y)]=\int_{\mathbb{R}}\int_{\mathbb{R}}g(x)h(y)f_X(x)f_Y(y)\,dy\,dx=(\int_{\mathbb{R}}g(x)f_X(x)\,dx)(\int_{\mathbb{R}}h(y)f_Y(y)\,dy)\). The last expression is \(\mathbb{E}[g(X)]\mathbb{E}[h(Y)]\), which proves the result. \(\square\)

The proof uses two standard integration results: Tonelli’s theorem to evaluate a nonnegative double integral, and Fubini’s theorem to change the order of integration for an absolutely integrable function. The assumptions in the theorem ensure that the absolute double integral is finite, so the latter use is justified.

Worked Example: A Continuous Mixed Moment

Let \(X\) and \(Y\) be independent, with \(X\) uniform on \([0,2]\) and \(Y\) uniform on \([1,3]\). Compute \(\mathbb{E}[X^2Y]\) in two ways.

The density of \(X\) is \(\tfrac12\) on \([0,2]\), and the density of \(Y\) is \(\tfrac12\) on \([1,3]\); each integrates to one, since \(\tfrac12(2-0)=1\) and \(\tfrac12(3-1)=1\). The separate expectations are \(\mathbb{E}[X^2]=\tfrac12\int_0^2x^2\,dx=\tfrac12[\tfrac{x^3}{3}]_0^2=\tfrac43\) and \(\mathbb{E}[Y]=\tfrac12\int_1^3y\,dy=\tfrac12[\tfrac{y^2}{2}]_1^3=\tfrac12(\tfrac92-\tfrac12)=2\). Both are finite, so factorization gives \(\mathbb{E}[X^2Y]=\tfrac43\cdot2=\tfrac83\).

Check by the joint density. The joint density is \(\tfrac14\) on the rectangle \(0\le x\le2,\ 1\le y\le3\). Direct integration gives \(\mathbb{E}[X^2Y]=\tfrac14\int_0^2\int_1^3x^2y\,dy\,dx=\tfrac14(\int_0^2x^2\,dx)(\int_1^3y\,dy)=\tfrac14\cdot\tfrac83\cdot4=\tfrac83\). The direct computation agrees with the factored answer.

Consequences for Covariance and Moments

For integrable random variables \(U,V\) whose product is integrable, covariance is \(\operatorname{Cov}(U,V)=\mathbb{E}[UV]-\mathbb{E}[U]\mathbb{E}[V]\). If \(X,Y\) are independent and the expectations in this expression are finite, the factorization theorem applied with \(g(x)=x\) and \(h(y)=y\) gives \(\operatorname{Cov}(X,Y)=0\). More generally, functions of independent variables factor: if \(g(X)\) and \(h(Y)\) meet the theorem’s integrability conditions, then their covariance is zero too.

Corollary (Variance of a sum): If \(X\) and \(Y\) are independent and have finite second moments, then \(\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)\).

Proof. Finite second moments imply finite first absolute moments, and independence with the factorization theorem gives \(\mathbb{E}[XY]=\mathbb{E}[X]\mathbb{E}[Y]\). Expanding the square, \(\mathbb{E}[(X+Y)^2]=\mathbb{E}[X^2]+2\mathbb{E}[XY]+\mathbb{E}[Y^2]\), while \(\mathbb{E}[X+Y]^2=(\mathbb{E}[X]+\mathbb{E}[Y])^2\). Subtracting the second quantity from the first cancels the cross terms because \(\mathbb{E}[XY]=\mathbb{E}[X]\mathbb{E}[Y]\), leaving \((\mathbb{E}[X^2]-\mathbb{E}[X]^2)+(\mathbb{E}[Y^2]-\mathbb{E}[Y]^2)\). These two terms are the variances of \(X\) and \(Y\), proving the formula. \(\square\)

Worked Example: Variance of a Sum of Bernoulli Variables

Let \(X\) and \(Y\) be independent Bernoulli variables with \(\mathbb{P}(X=1)=\tfrac12\) and \(\mathbb{P}(Y=1)=\tfrac13\). Compute \(\mathbb{E}[(X+Y)^2]\) and \(\operatorname{Var}(X+Y)\), and verify both using the distribution of the sum.

The complementary probabilities are \(\mathbb{P}(X=0)=\tfrac12\) and \(\mathbb{P}(Y=0)=\tfrac23\), so each pair of probabilities sums to one. Since \(X^2=X\) and \(Y^2=Y\), \(\mathbb{E}[X^2]=\tfrac12\) and \(\mathbb{E}[Y^2]=\tfrac13\). Factorization gives \(\mathbb{E}[XY]=\mathbb{E}[X]\mathbb{E}[Y]=\tfrac12\cdot\tfrac13=\tfrac16\). Therefore \(\mathbb{E}[(X+Y)^2]=\tfrac12+2(\tfrac16)+\tfrac13=\tfrac76\). Also \(\mathbb{E}[X+Y]=\tfrac12+\tfrac13=\tfrac56\), so \(\operatorname{Var}(X+Y)=\tfrac76-(\tfrac56)^2=\tfrac{42}{36}-\tfrac{25}{36}=\tfrac{17}{36}\).

Check from the sum’s distribution. Independence gives \(\mathbb{P}(X+Y=0)=\tfrac12\cdot\tfrac23=\tfrac13\), \(\mathbb{P}(X+Y=1)=\tfrac12\cdot\tfrac23+\tfrac12\cdot\tfrac13=\tfrac12\), and \(\mathbb{P}(X+Y=2)=\tfrac12\cdot\tfrac13=\tfrac16\). These probabilities sum to \(\tfrac13+\tfrac12+\tfrac16=1\). Consequently, \(\mathbb{E}[(X+Y)^2]=0^2(\tfrac13)+1^2(\tfrac12)+2^2(\tfrac16)=\tfrac12+\tfrac23=\tfrac76\), matching the earlier value. The mean from this distribution is \(0(\tfrac13)+1(\tfrac12)+2(\tfrac16)=\tfrac56\), so its variance is again \(\tfrac76-\tfrac{25}{36}=\tfrac{17}{36}\). Separately, \(\operatorname{Var}(X)=\tfrac12-(\tfrac12)^2=\tfrac14\) and \(\operatorname{Var}(Y)=\tfrac13-(\tfrac13)^2=\tfrac29\); their sum is \(\tfrac9{36}+\tfrac8{36}=\tfrac{17}{36}\), as the corollary predicts.

When Factorization Fails

Zero covariance follows from independence, but zero covariance alone does not establish independence. Nor may the expectation product rule be used just because two variables are being considered together. The rule relies on their joint law being a product of their marginal laws.

Common mistake. Let \(X=Y\), where \(X\) is Bernoulli with \(\mathbb{P}(X=1)=\mathbb{P}(X=0)=\tfrac12\). A mistaken calculation treats \(X\) and \(Y\) as independent and concludes \(\mathbb{E}[XY]=\mathbb{E}[X]\mathbb{E}[Y]=\tfrac12\cdot\tfrac12=\tfrac14\). But \(Y=X\), so \(XY=X^2=X\), and the actual value is \(\mathbb{E}[XY]=\tfrac12\). The discrepancy arises because these variables are dependent: for example, \(\mathbb{P}(X=1,Y=1)=\tfrac12\), whereas \(\mathbb{P}(X=1)\mathbb{P}(Y=1)=\tfrac14\). Here \(\operatorname{Cov}(X,Y)=\tfrac12-\tfrac14=\tfrac14\), not zero.

Before factoring an expectation, check three things: the variables (or the functions of them) are independent; the separate absolute expectations are finite, or another applicable integrability argument is available; and the expression being factored is indeed a product of a function of \(X\) and a function of \(Y\). Under those conditions, mixed moments become products of simpler moments, and covariance calculations often reduce to a direct expansion.

Check Your Understanding

For each question, identify the independence and integrability conditions that justify any factorization you use.

  1. If \(X\) and \(Y\) are independent with finite absolute first moments, what does the factorization theorem give for \(\mathbb{E}[XY]\)?
  2. For independent variables with densities, why is absolute integrability of the double-integral integrand relevant when changing the order of integration?
  3. Let \(X\) and \(Y\) be independent Bernoulli variables with success probabilities \(\tfrac14\) and \(\tfrac12\). Compute \(\mathbb{E}[XY]\).
  4. If \(X\) and \(Y\) are independent with finite second moments, state the formula for \(\operatorname{Var}(X+Y)\) and name the factorization used to obtain it.
  5. For \(X=Y\) with \(\mathbb{P}(X=1)=\mathbb{P}(X=0)=\tfrac12\), compute \(\mathbb{E}[XY]\) and explain why multiplying the separate means gives the wrong answer.