Skip to content

Conditional Expectation Given a Random Variable

Definition

For integrable YY (that is, E∣Y∣<∞\mathbb{E}|Y|<\infty), the conditional expectation E[Y∣X]\mathbb{E}[Y\mid X] is a function g(X)g(X) of XX satisfying the averaging identity E[Y𝟙1{X∈B}]=E[g(X)𝟙1{X∈B}]\mathbb{E}[Y\indicator_{\{X\in B\}}]=\mathbb{E}[g(X)\indicator_{\{X\in B\}}] for every event {X∈B}\{X\in B\} determined by XX. When a conditional PMF or PDF exists,

g(x)=E[Y∣X=x]={∑yy pY∣X(y∣x),Y discrete,∫Ry fY∣X(y∣x) dy,Y has a conditional density.g(x)=\mathbb{E}[Y\mid X=x]=\begin{cases}\sum_y y\,p_{Y\mid X}(y\mid x), & Y\text{ discrete},\\[4pt] \int_{\mathbb{R}}y\,f_{Y\mid X}(y\mid x)\,\mathrm{d}y, & Y\text{ has a conditional density}.\end{cases}

The sum or integral is selected by the conditional law of YY, not by whether the conditioning variable XX is discrete or continuous.

The Expectation calculation averages the possible values of YY under its conditional law. In the continuous case, the weighting function is the Conditional Probability Density Function, not the marginal PDF of YY.


Interpretation

Conditioning on a variable produces a new random variable: E[Y∣X]\mathbb{E}[Y\mid X] is the average of YY predicted from the value of XX, and it changes with the value observed. Evaluating it at a fixed value xx gives an ordinary number.

A triangular region with density 2 and a vertical slice at X = x, on which Y is uniform from 0 to x; a line through the slice midpoints shows the conditional mean x/2.

In the illustrated triangular model, with density 22 on 0<y<x<10<y<x<1, the vertical slice at X=xX=x shows that the conditional distribution of YY given X=xX=x is uniform on (0,x)(0,x), with mean g(x)=x/2g(x)=x/2; at x=0.7x=0.7 this is the red point at height 0.350.35. Evaluating this function at the random XX gives E[Y∣X]=g(X)=X/2\mathbb{E}[Y\mid X]=g(X)=X/2.

For each fixed xx, compute the number g(x)=E[Y∣X=x]g(x)=\mathbb{E}[Y\mid X=x] from the conditional PMF or density, as in the Definition; then substitute the random XX. The averaging identity explains what the result is: over every event determined by XX, the variable g(X)g(X) has the same average as YY. With B=RB=\mathbb{R} it gives E[g(X)]=EY\mathbb{E}[g(X)]=\mathbb{E}Y, which is Adam’s law. In the triangle, E[X/2]=12⋅23=13\mathbb{E}[X/2]=\tfrac{1}{2}\cdot\tfrac{2}{3}=\tfrac{1}{3}, which is indeed EY\mathbb{E}Y.

For discrete XX, the random variable E[Y∣X]\mathbb{E}[Y\mid X] takes the value E[Y∣X=x]\mathbb{E}[Y\mid X=x] on the event {X=x}\{X=x\}, so it collects the numbers E[Y∣A]\mathbb{E}[Y\mid A] of conditional expectation given an event into one random variable. Its working rules are taking out what is known and the independent case.

Keep three objects apart: EY\mathbb{E}Y is a number, E[Y∣X=x]\mathbb{E}[Y\mid X=x] is a number for each xx, and E[Y∣X]\mathbb{E}[Y\mid X] is a random variable, a function of XX.


Key Results

  • E[Y∣X]=g(X)\mathbb{E}[Y\mid X]=g(X) is determined up to almost-sure equality.
  • For every interval BB, E[Y𝟙1{X∈B}]=E[g(X)𝟙1{X∈B}]\mathbb{E}[Y\indicator_{\{X\in B\}}]=\mathbb{E}[g(X)\indicator_{\{X\in B\}}].

Examples

  • If Y∣X=x∼Pois⁡(x)Y\mid X=x\sim\operatorname{Pois}(x) with X≥0X\ge0 integrable, then E[Y∣X]=X\mathbb{E}[Y\mid X]=X.
  • For joint density 22 on 0<y<x<10<y<x<1, Y∣X=xY\mid X=x is uniform on (0,x)(0,x), so E[Y∣X]=X/2\mathbb{E}[Y\mid X]=X/2.

Prerequisites

Sources

Symbols: element of, infinity, integral, real numbers, sum

Last updated: 22 October 2026 19:04