Tutorials › Measure Theory › Conditional Expectation Given an Event

Expectation, Conditional Expectation and Independence · Tutorial 762 of 798

Conditional Expectation Given an Event

Learn to compute event-conditioned probabilities and means, and to distinguish a conditional mean from an event-restricted expectation.

Advanced 10 min read

What You'll Learn

  • Define the probability measure obtained by restricting to an event and normalizing by its probability
  • Derive the formula for the conditional mean of an integrable random variable
  • Distinguish the scalar mean given an event from conditional expectation given the event’s sigma-algebra
  • Apply Bayes’ formula to compute posterior probabilities and conditional means
  • Check when conditioning is undefined and identify common normalization errors

Conditioning on an Event

When an event \(A\) has occurred, probabilities and averages should be computed relative to the outcomes inside \(A\). This changes the relevant probability scale: the original probability assigned to a subset of \(A\) must be divided by \(\mathbb{P}(A)\). The same normalization applies to an expectation restricted to \(A\). It is essential that \(\mathbb{P}(A)>0\); conditioning on a probability-zero event cannot be defined by this ratio.

Throughout, \((\Omega,\mathcal{F},\mathbb{P})\) is a probability space, so \(\mathbb{P}(\Omega)=1\). No completeness assumption is needed. Events belong to \(\mathcal{F}\), and random variables are real-valued and \(\mathcal{F}\)-measurable unless stated otherwise. For conditional means, assume the random variable \(X\) is integrable, meaning \(\mathbb{E}[|X|]<\infty\). Equalities between random variables identified as conditional expectations hold \(\mathbb{P}\)-almost surely; a conditional mean given a fixed event is a number.

Definition: If \(A\in\mathcal{F}\) and \(\mathbb{P}(A)>0\), the conditional probability of \(B\in\mathcal{F}\) given \(A\) is \(\mathbb{P}(B\mid A)=\mathbb{P}(B\cap A)/\mathbb{P}(A)\). For an integrable real-valued random variable \(X\), its conditional mean given \(A\) is \(\mathbb{E}[X\mid A]=\mathbb{E}[X\chi_A]/\mathbb{P}(A)\). The numerator is the event-restricted expectation; the denominator normalizes it to an average under the condition \(A\).

The Normalized Restricted Probability Measure

The formula is not just a convenient rule. It arises by making a new probability measure that assigns probability only to outcomes in \(A\). For each \(B\in\mathcal{F}\), define \(\mathbb{P}_A(B)=\mathbb{P}(B\cap A)/\mathbb{P}(A)\). Then \(\mathbb{P}_A(A)=1\), and \(\mathbb{P}_A\) is the probability law of outcomes viewed under the condition \(A\).

Proposition: For \(A\in\mathcal{F}\) with \(\mathbb{P}(A)>0\), \(\mathbb{P}_A\) is a probability measure on \((\Omega,\mathcal{F})\). If \(X\) is an integrable real-valued random variable under \(\mathbb{P}\), then it is integrable under \(\mathbb{P}_A\) and \(\mathbb{E}_{\mathbb{P}_A}[X]=\mathbb{E}_{\mathbb{P}}[X\chi_A]/\mathbb{P}(A)\).

Proof. For every \(B\in\mathcal{F}\), \(\mathbb{P}_A(B)\ge0\), and \(\mathbb{P}_A(\Omega)=\mathbb{P}(A)/\mathbb{P}(A)=1\). If \(B_1,B_2,\ldots\) are pairwise disjoint events, then \(B_n\cap A\) are pairwise disjoint and their union is \((\bigcup_n B_n)\cap A\). Countable additivity of \(\mathbb{P}\) therefore gives \(\mathbb{P}_A(\bigcup_n B_n)=\sum_n\mathbb{P}_A(B_n)\). Thus \(\mathbb{P}_A\) is a probability measure.

For a nonnegative simple function \(\varphi=\sum_{j=1}^k a_j\chi_{B_j}\), where the \(B_j\) are disjoint events and \(a_j\ge0\), the definition of the integral gives \(\mathbb{E}_{\mathbb{P}_A}[\varphi]=\sum_j a_j\mathbb{P}_A(B_j)=\mathbb{E}_{\mathbb{P}}[\varphi\chi_A]/\mathbb{P}(A)\). The same identity holds for every nonnegative measurable function by approximating it from below by nonnegative simple functions and applying the Monotone Convergence Theorem on both probability spaces. Apply this identity to \(|X|\): it gives \(\mathbb{E}_{\mathbb{P}_A}[|X|]=\mathbb{E}_{\mathbb{P}}[|X|\chi_A]/\mathbb{P}(A)<\infty\). Hence \(X\) is integrable under \(\mathbb{P}_A\). Applying the identity separately to \(X^+\) and \(X^-\), both of which have finite expectations, and subtracting proves the claimed formula for \(X\). \(\square\)

Taking \(X=\chi_B\) in the formula shows that \(\mathbb{E}_{\mathbb{P}}[\chi_B\mid A]=\mathbb{P}(B\mid A)\). Thus conditional probability is the special case of conditional mean for an indicator. For a finite-valued random variable, the expectation formula also gives the familiar weighted average over the outcomes that satisfy \(A\).

Worked Example: The Mean of a Die Roll Given an Even Outcome

Let \(\Omega=\{1,2,3,4,5,6\}\) with each outcome having probability \(1/6\), and let \(X(\omega)=\omega\). Take \(A=\{2,4,6\}\). Each of its three outcomes has probability \(1/6\), so \(\mathbb{P}(A)=3/6=1/2>0\). The event-restricted expectation is \(\mathbb{E}[X\chi_A]=(2+4+6)/6=12/6=2\). Therefore \(\mathbb{E}[X\mid A]=2/(1/2)=4\).

Check: Under \(\mathbb{P}_A\), each of 2, 4, and 6 has probability \((1/6)/(1/2)=1/3\). Their average is \((2+4+6)/3=12/3=4\), in agreement with the normalized formula.

Connection with Conditional Expectation

There are two related objects to distinguish. The number \(\mathbb{E}[X\mid A]\) is one average, defined only when \(\mathbb{P}(A)>0\). In contrast, \(\mathbb{E}[X\mid\sigma(A)]\) is a random variable measurable with respect to the sigma-algebra \(\sigma(A)=\{\varnothing,A,A^c,\Omega\}\). When both \(A\) and \(A^c\) have positive probability, it takes one constant value on each of these two events.

Proposition: Suppose \(X\) is integrable and \(0<\mathbb{P}(A)<1\). A version of the conditional expectation given \(\sigma(A)\) is \[ \mathbb{E}[X\mid\sigma(A)] =\mathbb{E}[X\mid A]\chi_A+ \mathbb{E}[X\mid A^c]\chi_{A^c}. \]

Proof. The right-hand side, denoted by \(Y\), is \(\sigma(A)\)-measurable because it is constant on \(A\) and on \(A^c\). To verify the defining integral condition, it is enough to check the four possible events \(C\in\sigma(A)\). For \(C=A\), \(\mathbb{E}[Y\chi_A]=\mathbb{E}[X\mid A]\mathbb{P}(A)=\mathbb{E}[X\chi_A]\). For \(C=A^c\), the corresponding identity is \(\mathbb{E}[Y\chi_{A^c}]=\mathbb{E}[X\chi_{A^c}]\). For \(C=\varnothing\), both integrals are zero; for \(C=\Omega\), add the two identities for \(A\) and \(A^c\). Thus \(\mathbb{E}[Y\chi_C]=\mathbb{E}[X\chi_C]\) for every \(C\in\sigma(A)\), which is the defining property of conditional expectation. \(\square\)

If \(\mathbb{P}(A)=1\), the conditional expectation given \(\sigma(A)\) equals \(\mathbb{E}[X]\) almost surely; its value on \(A^c\), a null event, does not affect that equality. If \(\mathbb{P}(A)=0\), the scalar \(\mathbb{E}[X\mid A]\) is undefined by the event formula. A conditional expectation given \(\sigma(A)\) can still be specified almost surely, but its value on the null atom \(A\) is not determined by the defining integral condition. These boundary cases are why the positive-probability condition matters.

Bayes’ Formula and Conditional Means

Bayes’ formula follows by expressing the event being conditioned on as a disjoint union. Let \(H\) be an event with \(0<\mathbb{P}(H)<1\), and let \(T\) be an event with \(\mathbb{P}(T)>0\). Then \(\mathbb{P}(T)=\mathbb{P}(T\mid H)\mathbb{P}(H)+\mathbb{P}(T\mid H^c)\mathbb{P}(H^c)\). Dividing \(\mathbb{P}(H\cap T)=\mathbb{P}(T\mid H)\mathbb{P}(H)\) by this positive denominator yields \[ \mathbb{P}(H\mid T)= \frac{\mathbb{P}(T\mid H)\mathbb{P}(H)} {\mathbb{P}(T\mid H)\mathbb{P}(H)+\mathbb{P}(T\mid H^c)\mathbb{P}(H^c)}. \] The denominator must be positive; this is exactly the requirement \(\mathbb{P}(T)>0\).

Worked Example: Updating Disease Probability After a Positive Test

Suppose \(H\) is the event that a randomly selected person has a disease, with prevalence \(\mathbb{P}(H)=1/100\). Let \(T\) be a positive test result. Assume sensitivity \(\mathbb{P}(T\mid H)=9/10\) and specificity \(\mathbb{P}(T^c\mid H^c)=19/20\), so \(\mathbb{P}(T\mid H^c)=1/20\). Both \(H\) and \(H^c\) have positive probability, and the positive-test event has probability \(\mathbb{P}(T)=(9/10)(1/100)+(1/20)(99/100)=9/1000+99/2000=117/2000>0\).

Since \(H\cap T\) has probability \((9/10)(1/100)=9/1000=18/2000\), Bayes’ formula gives \(\mathbb{P}(H\mid T)=(18/2000)/(117/2000)=18/117=2/13\). For the disease indicator \(X=\chi_H\), this posterior probability is also the conditional mean \(\mathbb{E}[X\mid T]\).

Check: In a hypothetical group of 10,000 people, 100 have the disease and \(9/10\) of those, or 90, test positive. The remaining 9,900 do not have the disease; \(1/20\) of them, or 495, test positive. Thus 90 of the \(90+495=585\) positive results are true positives, and \(90/585=2/13\), as above.

Worked Example: Expected Number of Heads Given at Least One Head

Toss two fair coins, with the four outcomes \(HH,HT,TH,TT\) each having probability \(1/4\). Let \(X\) be the number of heads and let \(A=\{HH,HT,TH\}\), the event of at least one head. Then \(\mathbb{P}(A)=3/4>0\). The restricted expectation is \(\mathbb{E}[X\chi_A]=(2+1+1+0)/4=4/4=1\), so \(\mathbb{E}[X\mid A]=1/(3/4)=4/3\).

Check: Given \(A\), the three outcomes each have conditional probability \((1/4)/(3/4)=1/3\). Their head counts average to \((2+1+1)/3=4/3\). The outcome \(TT\) is excluded because the membership condition is “at least one head,” not “exactly one head.”

A Normalization Pitfall

A frequent error is to report \(\mathbb{E}[X\chi_A]\) as the conditional mean. This quantity includes the probability of \(A\) in its scale; it is not an average under the condition \(A\). In the die example, \(\mathbb{E}[X\chi_A]=2\), but the conditional mean is \(2/\mathbb{P}(A)=2/(1/2)=4\). The incorrect value 2 is only half the correct conditional mean because the event has probability \(1/2\).

Another error is to condition on an event of probability zero by using the same ratio. If \(\mathbb{P}(A)=0\), then \(\mathbb{E}[X\chi_A]=0\) for integrable \(X\), so the proposed ratio is \(0/0\), not a defined conditional mean. Conditioning on such events requires a different framework and is not given by the event formula here.

When the random variable is an indicator, always identify the event represented by that indicator before calculating. For example, \(\mathbb{E}[\chi_H\mid T]=\mathbb{P}(H\mid T)\): the condition is \(T\), while the indicator records whether \(H\) occurs. Reversing these events changes the question; in general \(\mathbb{P}(H\mid T)\) and \(\mathbb{P}(T\mid H)\) are not equal.

Check Your Understanding

For each question, identify the event whose probability is used as the normalizing denominator.

  1. If \(\mathbb{P}(A)=2/5\) and \(\mathbb{E}[X\chi_A]=6/5\), where \(X\) is integrable, find \(\mathbb{E}[X\mid A]\).
  2. Explain why \(\mathbb{P}(B\mid A)=\mathbb{E}[\chi_B\mid A]\) when \(\mathbb{P}(A)>0\).
  3. For an event \(A\) with probability strictly between zero and one, write the two values of a version of \(\mathbb{E}[X\mid\sigma(A)]\).
  4. A condition \(T\) has probability zero. Why does the event formula not define \(\mathbb{E}[X\mid T]\)?
  5. In the two-coin example, what would the conditional mean of the number of heads be if the condition were exactly one head? Compute it from the event-restricted formula.