Tutorials › Statistical Theory I - Probability and Distribution Theory › Discrete Conditional Expectation Problem Workshop

Conditional Expectation · Tutorial 346 of 994

Discrete Conditional Expectation Problem Workshop

Learn to compute conditional means and probabilities from discrete laws, combine them across events, and verify the result using iterated expectation.

Intermediate 10 min read

What You'll Learn

  • Compute conditional mass functions and conditional expectations from a joint probability table.
  • Use event partitions to break a difficult expectation into manageable conditional calculations.
  • Apply indicator identities to obtain conditional probabilities and expectations of event counts.
  • Use iterated expectation when conditioning on a random count.
  • Check integrability and handle conditioning values with probability zero correctly.
  • Verify a multi-step calculation by comparing its conditional and unconditional forms.

A Reliable Strategy for Discrete Conditioning

A discrete conditional-expectation problem often involves several layers: a joint distribution, a conditioning variable, and an event whose probability or expected count is wanted. The arithmetic is usually simple once the conditioning information is made explicit. The main challenge is to keep the conditional law, the event being averaged over, and the final averaging weights distinct.

For a finite- or countably-valued variable \(X\), conditioning on \(Y=y\) means using the distribution of \(X\) among outcomes for which \(Y=y\). This conditional distribution is defined by ratios of joint probabilities when \(P(Y=y)>0\). Values \(y\) with \(P(Y=y)=0\) do not contribute to unconditional averages and do not have a conditional distribution defined by that ratio.

Definition: Suppose \(X\) is finite- or countably-valued and \(Y\) is discrete. For any \(y\) with \(P(Y=y)>0\), the conditional mass function of \(X\) given \(Y=y\) is $$ P(X=x\mid Y=y)=\frac{P(X=x,Y=y)}{P(Y=y)}. $$ If \(E[|X|]<\infty\), its conditional expectation is $$ E[X\mid Y=y]=\sum_x xP(X=x\mid Y=y), $$ where the sum is over the possible values of \(X\). The random variable \(E[X\mid Y]\) takes the value \(E[X\mid Y=y]\) when \(Y=y\), apart from values of \(Y\) having probability zero.

For a nonnegative integer-valued count, an expectation is a weighted sum over all its possible counts. For a finite-valued variable, the sum is finite. For a countably-valued integrable variable, the sum converges absolutely, since \( \sum_x |x|P(X=x)=E[|X|]<\infty \). This distinction matters when proving a formula: a finite-sum argument alone does not prove the same statement for every countably supported variable.

Conditional Mass Functions and an Event Partition

When a joint probability table is available, first add the joint probabilities across each row or column to get the marginal probability of the conditioning value. Divide the joint entries by that marginal to get the conditional mass function. Then calculate the requested conditional expectation from that mass function.

Worked Example: Conditional Means From a Joint Table

Suppose \(X\) takes values \(0,1,2\), and \(Y\) takes values \(0,1\). Their joint probabilities are shown below. Find \(E[X\mid Y=0]\), \(E[X\mid Y=1]\), \(E[X]\), and \(P(X\geq 1\mid Y=1)\).

\(X=0\)\(X=1\)\(X=2\)Total
\(Y=0\)0.10.20.10.4
\(Y=1\)0.10.20.30.6
Total0.20.40.41

The row totals give \(P(Y=0)=0.4\) and \(P(Y=1)=0.6\). Thus, for \(Y=0\), the conditional probabilities of \(X=0,1,2\) are \(0.1/0.4=0.25\), \(0.2/0.4=0.5\), and \(0.1/0.4=0.25\). Therefore

$$ E[X\mid Y=0]=0(0.25)+1(0.5)+2(0.25)=1. $$

For \(Y=1\), the conditional probabilities are \(0.1/0.6=1/6\), \(0.2/0.6=1/3\), and \(0.3/0.6=1/2\). Hence

$$ E[X\mid Y=1]=0(1/6)+1(1/3)+2(1/2)=\frac{4}{3}. $$

The marginal probabilities of \(X=0,1,2\) are \(0.2,0.4,0.4\), so \(E[X]=0(0.2)+1(0.4)+2(0.4)=1.2\). The conditional probability requested is

$$ P(X\geq 1\mid Y=1)=\frac{0.2+0.3}{0.6}=\frac{5}{6}. $$

As a check, averaging the two conditional means using the probabilities of the conditioning values gives \(0.4(1)+0.6(4/3)=1.2\), agreeing with the direct marginal calculation of \(E[X]\).

More generally, conditioning on a discrete variable separates an expectation into contributions from the events \(Y=y\). The following result holds even when \(X\) has countably many possible values.

Theorem: Let \(Y\) take finitely many values \(y_1,\ldots,y_m\), and let \(E[|X|]<\infty\), where \(X\) may be finite- or countably-valued. Then $$ E[X]=\sum_{j:P(Y=y_j)>0}P(Y=y_j)E[X\mid Y=y_j]. $$

Proof. Write \(p_{xj}=P(X=x,Y=y_j)\) and \(q_j=P(Y=y_j)\). For every \(j\) with \(q_j>0\), \(q_jE[X\mid Y=y_j]=\sum_x xp_{xj}\). The sums over \(x\) are absolutely convergent: their absolute sums are bounded by \(\sum_x |x|P(X=x)=E[|X|]<\infty\). There are only finitely many values of \(Y\), so we may add these absolutely convergent sums and rearrange them:

$$ \sum_{j:q_j>0}q_jE[X\mid Y=y_j] =\sum_{j=1}^{m}\sum_x xp_{xj} =\sum_x xP(X=x) =E[X]. $$

Terms with \(q_j=0\) have \(p_{xj}=0\) for every \(x\), so omitting those \(j\) does not change the sum. This proves the result. \(\square\)

Indicators Turn Events Into Expectations

An event \(A\) can be represented by its indicator \(I_A\), which equals \(1\) when \(A\) occurs and \(0\) otherwise. The identity \(E[I_A]=P(A)\) turns event-probability questions into expectation questions. In a discrete conditional calculation, the corresponding identity is \(E[I_A\mid Y=y]=P(A\mid Y=y)\) whenever \(P(Y=y)>0\).

Result: For any event \(A\) and any \(y\) with \(P(Y=y)>0\), $$ E[I_A\mid Y=y]=P(A\mid Y=y). $$ If \(A\) is described in terms of a discrete variable \(X\), then $$ P(A\mid Y=y)=\sum_{x:\,(X=x,Y=y)\text{ implies }A}P(X=x\mid Y=y), $$ with the sum taken over the values of \(X\) for which \(A\) occurs when \(Y=y\).

To verify the identity, under the conditional distribution given \(Y=y\), the indicator is \(1\) on \(A\) and \(0\) off \(A\). Its conditional mean is therefore the conditional probability of \(A\):

$$ E[I_A\mid Y=y] =1\cdot P(A\mid Y=y)+0\cdot P(A^c\mid Y=y) =P(A\mid Y=y). $$

For several events, a count can often be written as a sum of indicators. If \(N\) counts how many of \(A_1,\ldots,A_k\) occur, then \(N=\sum_{i=1}^k I_{A_i}\). The expectation of that count is the sum of the event probabilities, without requiring the events to be independent. The same calculation works conditionally.

Worked Example: A Count in a Two-Draw Experiment

An urn contains three red balls and two blue balls. Two balls are drawn without replacement. Let \(X\) be the number of red balls drawn, and let \(A\) be the event that the first ball is red. Find the conditional distribution and conditional mean of \(X\) given \(A\), do the same given \(A^c\), and use the partition \(\{A,A^c\}\) to recover \(E[X]\).

The event \(A\) has probability \(3/5\), while \(A^c\) has probability \(2/5\). Given \(A\), one red ball has already been drawn. Of the four balls remaining, two are red and two are blue. Thus \(X=2\) if the second ball is red, with probability \(2/4=1/2\); otherwise \(X=1\), with probability \(1/2\). Consequently,

$$ E[X\mid A]=1(1/2)+2(1/2)=\frac{3}{2}. $$

Given \(A^c\), the first ball was blue. The remaining four balls include three red and one blue. Thus \(X=1\) with probability \(3/4\) and \(X=0\) with probability \(1/4\), giving

$$ E[X\mid A^c]=0(1/4)+1(3/4)=\frac{3}{4}. $$

The event partition gives \(E[X]=(3/5)(3/2)+(2/5)(3/4)=9/10+3/10=6/5\). This matches the indicator calculation. Let \(I_1\) and \(I_2\) indicate that the first and second draws, respectively, are red. Then \(X=I_1+I_2\); each draw has probability \(3/5\) of being red, so \(E[X]=E[I_1]+E[I_2]=3/5+3/5=6/5\).

The indicators are useful here because the count is a sum of event indicators. No independence assumption is needed to add their expectations.

Conditioning on a Random Count

A common multi-step problem first generates a random number of opportunities and then generates outcomes within those opportunities. The conditional distribution given the count describes the second stage; averaging over the count accounts for the first stage. Keep these stages separate until the final sum.

Worked Example: A Binomial Count With a Random Number of Trials

Suppose \(N\) has probabilities \(P(N=0)=0.2\), \(P(N=1)=0.5\), and \(P(N=2)=0.3\). Given \(N=n\), let \(K\) have a binomial distribution with \(n\) trials and success probability \(0.4\). Find \(E[K]\), the mass function of \(K\), and \(E[K\mid K>0]\).

Given \(N=n\), the conditional mean is \(E[K\mid N=n]=0.4n\). The mean of \(N\) is \(E[N]=0(0.2)+1(0.5)+2(0.3)=1.1\). Averaging the conditional means gives

$$ E[K]=0.2(0)+0.5(0.4)+0.3(0.8)=0.44. $$

For the full mass function, if \(N=0\), then \(K=0\) with probability \(1\). If \(N=1\), the probabilities of \(K=0,1\) are \(0.6,0.4\). If \(N=2\), the probabilities of \(K=0,1,2\) are \(0.6^2=0.36\), \(2(0.4)(0.6)=0.48\), and \(0.4^2=0.16\). Averaging each value over \(N\) gives

$$ \begin{aligned} P(K=0)&=0.2(1)+0.5(0.6)+0.3(0.36)=0.608,\\ P(K=1)&=0.5(0.4)+0.3(0.48)=0.344,\\ P(K=2)&=0.3(0.16)=0.048. \end{aligned} $$

These probabilities sum to \(0.608+0.344+0.048=1\). Therefore \(P(K>0)=0.344+0.048=0.392\), and

$$ E[K\mid K>0] =\frac{1(0.344)+2(0.048)}{0.392} =\frac{0.440}{0.392} =\frac{55}{49} \approx 1.1224. $$

The numerator \(0.440\) is \(E[K]\), since the \(K=0\) outcome contributes nothing. The conditional mean is larger than \(E[K]\), as expected after restricting to positive counts.

Putting the Calculations Together

For a multi-step discrete problem, write down the conditioning values and their probabilities before computing any conditional means. Then identify the conditional mass function needed at each value. If the target is a probability, use an indicator or sum the relevant conditional masses. If the target is an expectation, calculate the conditional mean and average it with the probabilities of the conditioning values.

1
Specify the conditioning cases.
List the possible values or partition events, and record their probabilities. Exclude zero-probability cases from conditional ratios.
2
Find the conditional law.
Use joint probabilities divided by the conditioning probability, or use the stated conditional model.
3
Compute the conditional target.
Sum values times conditional masses for a mean, or sum the masses of the values in the event for a probability.
4
Average or normalize as required.
Average conditional means using the conditioning probabilities; for a mean restricted to an event, divide the event-weighted expectation by the event probability.
5
Check the result.
Check that a conditional mass function sums to one and compare an unconditional expectation with a direct marginal or indicator calculation when available.

Common Mistake

A frequent error is to compute conditional means correctly but then average them with equal weights. For instance, in the joint-table example, the two conditional means are \(1\) and \(4/3\). Their unweighted average is \(7/6\), which is not \(E[X]\). The conditioning cases have probabilities \(0.4\) and \(0.6\), not \(1/2\) and \(1/2\); the correct weighted average is \(0.4(1)+0.6(4/3)=1.2\).

Another error is to treat a conditional probability as if it were the unconditional probability of the same event. For example, \(P(X\geq1\mid Y=1)\) is obtained from the \(Y=1\) row alone, with that row normalized to total one. Using the joint entries \(0.2+0.3\) without dividing by \(P(Y=1)=0.6\) gives \(P(X\geq1,Y=1)\), not the conditional probability.

Key takeaway: Conditional calculations use the conditional mass function, and the final average uses the probabilities of the conditioning cases. Indicators provide a direct bridge between event probabilities and expectations.

Check Your Understanding

For each problem, identify the relevant conditional distribution or event weights before calculating.

  1. If \(P(Y=0)=0.3\), \(P(Y=1)=0.7\), \(E[X\mid Y=0]=2\), and \(E[X\mid Y=1]=5\), find \(E[X]\).
  2. Explain why the conditional mass function \(P(X=x\mid Y=y)\) cannot be obtained by dividing by \(P(X=x)\).
  3. Let \(N\) count how many of four events occur. Write \(N\) as a sum of indicators and state the expectation of \(N\) in terms of the event probabilities.
  4. If \(P(A)=0.2\), \(E[X\mid A]=4\), and \(E[X\mid A^c]=1\), find \(E[X]\), assuming \(X\) is integrable.
  5. Why does the discrete tower calculation remain valid for countably supported \(X\) when \(Y\) has finite support and \(E[|X|]<\infty\)?