This text is still being edited: it may contain typos, inaccuracies, and locally unpolished spots. If you find something, please let the author know (contact details on the course page).
Conditional expectation is the central construction of modern probability theory and, arguably, its most useful export technology. The question it answers is the question behind any forecast: what is the best estimate of a quantity \(\xi\) when only part of the information is available? Tomorrowβs price forecast from todayβs data, the estimated position of an object from noisy measurements (the Kalman filter), an insurerβs reserve based on the current loss history β all of these are conditional expectations. Kolmogorovβs key idea: information is a \(\sigma\)-algebra (a collection of events for which we know whether or not they occurred), and conditional expectation is the projection of a quantity onto the available information. On this construction rests the entire theory of martingales (the stochastic processes course: βa martingale is a game in which the conditional expectation of tomorrowβs capital equals todayβsβ) and the entire theory of regression (the statistics course).
Plan β from the simple to the general, following Shiryaev [@shiryaev2016probability] (Ch. 2, Β§7) and Klenke [@klenke2020probability] (Ch. 8): elementary conditional probabilities \(\to\) conditional expectation with respect to a partition \(\to\) the general definition via Radon-Nikodym \(\to\) the complete set of properties \(\to\) the geometry of projection \(\to\) Buffonβs needle as a demonstration of the power of the method.
Elementary conditional constructions
Let us recall the constructions from the first course. For events \(A\), \(B\) with \(\mathbb {P}\left(B\right) > 0\) the conditional probability is \(\mathbb {P}\left(A \mid B\right) = \frac{\mathbb {P}\left(A \cap B\right)}{\mathbb {P}\left(B\right)}\); the map \(A \mapsto \mathbb {P}\left(A \mid B\right)\) is a genuine probability measure. For an at most countable partition \(\Omega = \bigsqcup_i B_i\) we have the law of total probability \(\mathbb {P}\left(A\right) = \sum_i \mathbb {P}\left(A \mid B_i\right)\mathbb {P}\left(B_i\right)\) and Bayesβ formula
\[
\mathbb {P}\left(B_k \mid A\right) = \frac{\mathbb {P}\left(A \mid B_k\right)\, \mathbb {P}\left(B_k\right)}{\sum _i \mathbb {P}\left(A \mid B_i\right)\, \mathbb {P}\left(B_i\right)}.
\]
At a plant, \(2\%\) of devices are defective. A rapid test detects a defect with probability \(95\%\), but with probability \(10\%\) gives a false alarm on a functioning device. The test came back positive. What is the probability that the device is actually defective? And what is the probability of a defect if the test came back negative?
Let \(B\) be βdefectβ, \(A\) be βthe test came back positiveβ. By Bayesβ formula \[
\mathbb {P}\left(B \mid A\right) = \frac{0{,}95 \cdot 0{,}02}{0{,}95 \cdot 0{,}02 + 0{,}1 \cdot 0{,}98} = \frac{19}{117} \approx 16{,}2\% .
\] So after an βalarmβ a defect is still more likely the exception: false positives on the massive class of functioning devices swamp the rare true signal (the same βBayesian trapβ as in medical testing). On the other hand, a negative test result almost guarantees a functioning device: \[
\mathbb {P}\left(B \mid A^\complement \right) = \frac{0{,}05 \cdot 0{,}02}{0{,}05 \cdot 0{,}02 + 0{,}9 \cdot 0{,}98} = \frac{1}{883} \approx 0{,}11\% .
\] The asymmetry of the answers is the norm: screening tests are designed so as not to miss a case (high sensitivity), tolerating false alarms that a more precise test will later filter out.
Now β conditional expectation given elementary information. For \(\xi\) with \(\mathbb {E}\left[\left|\xi \right|\right] < \infty\) and an event \(A\) with \(\mathbb {P}\left(A\right) > 0\), set
\[
\mathbb {E}\left[\xi \mid A\right] := \frac{\mathbb {E}\left[\xi \; \mathbb {1}_{A}\right]}{\mathbb {P}\left(A\right)}
\]
β the average value of \(\xi\) βinsideβ the event \(A\) (the expectation with respect to the measure \(\mathbb {P}\left(\cdot \mid A\right)\)).
Definition 1 Let \(D = \left\{ D_1, D_2, \ldots \right\}\) be an at most countable partition of \(\Omega\) into events of positive probability. The conditional expectation with respect to the partition \(D\) is the random variable \[
\mathbb {E}\left[\xi \mid D\right](\omega ) = \sum _i \mathbb {E}\left[\xi \mid D_i\right] \cdot \; \mathbb {1}_{D_i}(\omega ).
\]
Read the definition carefully: conditional expectation is a random variable, not a number. On each cell it is constant, equal to the average value of \(\xi\) over the cell: we have βblurredβ the variable down to the level of available information.
The interactive illustration has not been created yet. See the source: /home/nedosh/Documents/online_math_notes/math-notes_FPMI_2/courses/nedosh_courses/courses/04-probability/02_PT/contents/specials/110/01_conditional_step_fig.tex.
Two properties of this construction are the key to everything that follows (Klenke, Lemma 8.10):
Proposition 1 Let \(\mathcal{G} = \sigma (D)\) be the \(\sigma\)-algebra generated by the partition (unions of cells). Then:
\(\mathbb {E}\left[\xi \mid D\right]\) is measurable with respect to \(\mathcal{G}\);
for every \(A \in \mathcal{G}\), \(\mathbb {E}\left[\mathbb {E}\left[\xi \mid D\right] \cdot \; \mathbb {1}_{A}\right] = \mathbb {E}\left[\xi \, \; \mathbb {1}_{A}\right]\).
- β the function is constant on cells. (2) β for \(A = \bigsqcup_{j \in J} D_j\) we have \[
\mathbb {E}\left[\mathbb {E}\left[\xi \mid D\right]\; \mathbb {1}_{A}\right] = \sum _{j \in J} \mathbb {P}\left(D_j\right) \, \mathbb {E}\left[\xi \mid D_j\right] = \sum _{j \in J} \mathbb {E}\left[\xi \; \mathbb {1}_{D_j}\right] = \mathbb {E}\left[\xi \; \mathbb {1}_{A}\right].
\]
Property 2 says βon every information event, the averages agreeβ. Remarkably, these two properties do not mention cells β and hence carry over to any \(\sigma\)-algebra.
Conditional expectation with respect to a -algebra
For continuous information (the exact value of a continuous variable \(\eta\) is known), the cells \(\left\{ \eta = y\right\}\) have probability zero, and the fraction in definition Definition 1 becomes meaningless. Kolmogorovβs way out is to define conditional expectation not by a formula but by properties, borrowed from proposition Proposition 1.
Definition 2 Let \(\mathbb {E}\left[\left|\xi \right|\right] < \infty\) and let \(\mathcal{G} \subseteq \mathcal{F}\) be a \(\sigma\)-algebra. The conditional expectation \(\mathbb {E}\left[ \xi \mid \mathcal{G} \right]\) is the random variable \(\zeta\) such that:
\(\zeta\) is measurable with respect to \(\mathcal{G}\);
for every \(A \in \mathcal{G}\): \(\mathbb {E}\left[\zeta \, \; \mathbb {1}_{A}\right] = \mathbb {E}\left[\xi \, \; \mathbb {1}_{A}\right]\). The conditional probability of an event \(B\): \(\mathbb {P}\left(B \mid \mathcal{G}\right) := \mathbb {E}\left[ \; \mathbb {1}_{B} \mid \mathcal{G} \right]\). Conditional expectation with respect to a random variable (or vector): \(\mathbb {E}\left[ \xi \mid \eta \right] := \mathbb {E}\left[ \xi \mid \sigma (\eta ) \right]\).
Theorem 1 (Existence and uniqueness) Conditional expectation exists and is unique up to equality almost surely.
Uniqueness. Let \(\zeta\) and \(\zeta '\) satisfy both conditions. The event \(A = \left\{ \zeta > \zeta '\right\}\) lies in \(\mathcal{G}\), and by condition 2
\[
\mathbb {E}\left[(\zeta - \zeta ')\, \; \mathbb {1}_{A}\right] = \mathbb {E}\left[\xi \; \mathbb {1}_{A}\right] - \mathbb {E}\left[\xi \; \mathbb {1}_{A}\right] = 0.
\]
Under the expectation stands a nonnegative variable, so \(\mathbb {P}\left(A\right) = 0\); symmetrically \(\mathbb {P}\left(\zeta < \zeta '\right) = 0\).
Existence. First let \(\xi \geq 0\). The set function
\[
Q(A) = \mathbb {E}\left[\xi \, \; \mathbb {1}_{A}\right], \qquad A \in \mathcal{G},
\]
is a finite measure on \((\Omega , \mathcal{G})\), absolutely continuous with respect to \(\mathbb {P}\) (restricted to \(\mathcal{G}\)): from \(\mathbb {P}\left(A\right) = 0\) it follows that \(Q(A) = 0\). By the Radon-Nikodym theorem (ETMT) there exists a \(\mathcal{G}\)-measurable density
\[
\mathbb {E}\left[ \xi \mid \mathcal{G} \right] := \frac{dQ}{d\mathbb {P}}\bigg|_{\mathcal{G}},
\]
and the defining property 2 is exactly \(Q(A) = \int_A \frac{dQ}{d\mathbb {P}}\, d\mathbb {P}\). The general case is the difference \(\xi = \xi^+ - \xi^-\).
So, conditional expectation is a Radon-Nikodym derivative: the entire apparatus of measure theory, built in ETMT βfor later useβ, fires exactly here. Two remarks on the definition:
Properties
Proposition 2 (Properties of conditional expectation) Let \(\xi , \eta\) be integrable, \(\mathcal{G}, \mathcal{G}_1, \mathcal{G}_2 \subseteq \mathcal{F}\) be \(\sigma\)-algebras. All equalities are a.s.
(linearity) \(\mathbb {E}\left[ a\xi + b\eta \mid \mathcal{G} \right] = a\mathbb {E}\left[ \xi \mid \mathcal{G} \right] + b\mathbb {E}\left[ \eta \mid \mathcal{G} \right]\); (monotonicity) \(\xi \leq \eta \Rightarrow \mathbb {E}\left[ \xi \mid \mathcal{G} \right] \leq \mathbb {E}\left[ \eta \mid \mathcal{G} \right]\);
(triangle inequality) \(\left|\mathbb {E}\left[ \xi \mid \mathcal{G} \right]\right| \leq \mathbb {E}\left[ \left|\xi \right| \mid \mathcal{G} \right]\);
(extreme cases) \(\mathbb {E}\left[ \xi \mid \left\{ \varnothing , \Omega \right\} \right] = \mathbb {E}\left[\xi \right]\); \(\mathbb {E}\left[ \xi \mid \mathcal{F} \right] = \xi\); more generally, if \(\mathbb {P}\left(A\right) \in \left\{ 0,1\right\}\) for all \(A \in \mathcal{G}\), then \(\mathbb {E}\left[ \xi \mid \mathcal{G} \right] = \mathbb {E}\left[\xi \right]\);
(full averaging) \(\mathbb {E}\left[\mathbb {E}\left[ \xi \mid \mathcal{G} \right]\right] = \mathbb {E}\left[\xi \right]\);
(tower property) if \(\mathcal{G}_1 \subseteq \mathcal{G}_2\), then
\[
\mathbb {E}\left[ \mathbb {E}\left[\xi \right][\mathcal{G}_2] \mid \mathcal{G}_1 \right] = \mathbb {E}\left[ \mathbb {E}\left[\xi \right][\mathcal{G}_1] \mid \mathcal{G}_2 \right] = \mathbb {E}\left[ \xi \mid \mathcal{G}_1 \right]
\]
(βthe smaller information survivesβ β in both orders of averaging);
(pulling out what is known) if \(\eta\) is measurable with respect to \(\mathcal{G}\) and \(\xi \eta\) is integrable, then \(\mathbb {E}\left[ \xi \eta \mid \mathcal{G} \right] = \eta \, \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\);
(independence) if \(\sigma (\xi )\) and \(\mathcal{G}\) are independent, then \(\mathbb {E}\left[ \xi \mid \mathcal{G} \right] = \mathbb {E}\left[\xi \right]\).
The proofs (Shiryaev, properties A-K; Klenke, Theorem 8.14) all follow the same template: the right-hand side is obviously \(\mathcal{G}\)-measurable, and it remains to check the defining equality \(\mathbb {E}\left[\cdot \, \; \mathbb {1}_{A}\right] = \mathbb {E}\left[\xi \eta \, \; \mathbb {1}_{A}\right]\) on \(A \in \mathcal{G}\) β then invoke uniqueness. For instance, pulling out what is known: for \(\eta = \; \mathbb {1}_{B}\), \(B \in \mathcal{G}\), the equality \(\mathbb {E}\left[\; \mathbb {1}_{B}\, \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\, \; \mathbb {1}_{A}\right] = \mathbb {E}\left[\xi \; \mathbb {1}_{B}\; \mathbb {1}_{A}\right]\) is exactly the defining property on the event \(A \cap B \in \mathcal{G}\); then linearity (simple \(\eta\)) and a limiting passage by monotonicity. We will work through the tower property in the problems. Properties 4-6 are the everyday working toolkit; learn them until they are automatic: the entire stochastic processes course is virtuoso juggling with them.
The next group of properties is the βanalysisβ of conditional expectations: limit theorems and inequalities.
Theorem 2 (Limit theorems under the conditional expectation sign) Let \(\xi_n \to \xi\) a.s.
(conditional monotone convergence) if \(0 \leq \xi_n \uparrow \xi\) and \(\xi\) is integrable, then \(\mathbb {E}\left[ \xi_n \mid \mathcal{G} \right] \uparrow \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\);
(conditional Fatouβs lemma) if \(\xi_n \geq 0\), then \(\mathbb {E}\left[ \liminf_n \xi_n \mid \mathcal{G} \right] \leq \liminf_n \mathbb {E}\left[ \xi_n \mid \mathcal{G} \right]\);
(conditional dominated convergence) if \(\left|\xi_n\right| \leq \eta\) a.s. with integrable \(\eta\), then
\[
\mathbb {E}\left[ \xi _n \mid \mathcal{G} \right] \xrightarrow [n \to \infty ]{} \mathbb {E}\left[ \xi \mid \mathcal{G} \right] \quad \text{a.s.\ and in } L^1.
\]
Theorem 3 (Conditional Jensen inequality) Let \(g\) be convex on an interval \(I\), and let \(\xi\) take values in \(I\) and be integrable. Then \[
g\left(\mathbb {E}\left[ \xi \mid \mathcal{G} \right]\right) \leq \mathbb {E}\left[ g(\xi ) \mid \mathcal{G} \right] \quad \text{a.s.}
\]
Corollary 1 (Contraction in \(L^p\)) For \(p \geq 1\) the operator \(\xi \mapsto \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\) is a contraction \(L^p \to L^p\): \(\left\| \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\right\|_{p} \leq \left\| \xi \right\|_{p}\). In particular, it is continuous: from \(\xi_n \xrightarrow {L^p} \xi\) it follows that \(\mathbb {E}\left[ \xi_n \mid \mathcal{G} \right] \xrightarrow {L^p} \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\).
(Jensen with \(g(x) = \left|x\right|^p\) plus full averaging.) Another corollary of Jensen will be useful in martingale theory: for an integrable \(\xi\) the family \(\left\{ \mathbb {E}\left[ \xi \mid \mathcal{G} \right] \colon \mathcal{G} \subseteq \mathcal{F}\right\}\) over all sub-\(\sigma\)-algebras is uniformly integrable (Klenke, Corollary 8.22) β averaging cannot βinflateβ the tails.
Conditional expectation as a projection
Theorem 4 (Best forecast) Let \(\mathbb {E}\left[\xi^2\right] < \infty\). Then for any \(\mathcal{G}\)-measurable \(Z\) with \(\mathbb {E}\left[Z^2\right] < \infty\) \[
\mathbb {E}\left[\left(\xi - \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\right)^2\right] \leq \mathbb {E}\left[(\xi - Z)^2\right],
\] i.e. \(\mathbb {E}\left[ \xi \mid \mathcal{G} \right]\) is the orthogonal projection of \(\xi\) onto the subspace \(L^2(\mathcal{G}) \subseteq L^2(\mathcal{F})\): the best mean-square approximation of \(\xi\) by variables computable from the available information.
The interactive illustration has not been created yet. See the source: /home/nedosh/Documents/online_math_notes/math-notes_FPMI_2/courses/nedosh_courses/courses/04-probability/02_PT/contents/specials/110/02_projection_fig.tex.
The geometric viewpoint is the most productive one: \(L^2\) is a Hilbert space (ETMT), conditional expectation is a projection operator, and the forecast error \(\xi - \mathbb {E}\left[ \xi \mid \mathcal{G} \right]\) is orthogonal to everything we know. The intuition for the properties comes free from this picture: the tower property β βprojecting onto a smaller subspace absorbs the projection onto a larger oneβ; contraction β βa projection does not lengthen a vectorβ; independence β βa projection ignores perpendicular informationβ. Machine learning in terms of this theorem: regression learning is an attempt to approximate the projection \(\mathbb {E}\left[ \xi \mid \eta \right]\) from a finite sample; it is the theoretical ceiling on the quality of any algorithm.
Example: Buffonβs needle
Let us close the theory with a demonstration of the power of the βcondition β then averageβ scheme, on the problem with which geometric probability began in 1777.
A needle of unit length is thrown βat randomβ onto a plane ruled with parallel lines at unit distance apart. What is the probability that the needle crosses some line?
Let us formalize βat randomβ: let \(\xi\) be the distance from the midpoint of the needle to the left line, \(\theta\) the angle of the needle to the direction of the lines; take \(\xi \sim \operatorname {U}[0,1]\), \(\theta \sim \operatorname {U}\left[-\frac{\pi }{2}, \frac{\pi }{2}\right]\) independent. The needle crosses a line when the projection of its half-length onto the perpendicular covers the distance to the line: \[
A = \left\{ \xi \leq \tfrac 12\cos \theta \right\} \cup \left\{ \xi \geq 1 - \tfrac 12\cos \theta \right\} .
\] Condition on the angle (full averaging + independence: given \(\theta = a\), the variable \(\xi\) remains uniform): \[
\mathbb {P}\left(A\right) = \mathbb {E}\left[\mathbb {P}\left(A \mid \theta \right)\right] = \frac{1}{\pi }\int _{-\pi /2}^{\pi /2} \mathbb {P}\left(\xi \in \left[0, \tfrac 12\cos a\right] \cup \left[1 - \tfrac 12\cos a, 1\right]\right)\, da = \frac{1}{\pi }\int _{-\pi /2}^{\pi /2} \cos a \, da = \frac{2}{\pi }.
\] The answer \(\frac{2}{\pi } \approx 0{,}637\) is remarkable twice over. First, methodologically: a two-dimensional geometric problem broke apart into a family of one-dimensional ones β fix the angle, compute an elementary probability, average over the angle; this is how the entire computational machinery of conditional constructions works. Second, historically: by throwing the needle \(n\) times and counting the frequency of crossings, one can statistically measure \(\pi\) β Buffonβs experiment was the first Monte Carlo method in history, two centuries before the term existed.
The interactive illustration has not been created yet. See the source: /home/nedosh/Documents/online_math_notes/math-notes_FPMI_2/courses/nedosh_courses/courses/04-probability/02_PT/contents/specials/110/03_buffon_fig.tex.
Problems
Two fair dice are thrown; \(\eta\) is the number of pips on the first, \(\xi\) is the sum of pips. Find \(\mathbb {E}\left[ \xi \mid \eta \right]\) and \(\mathbb {E}\left[ \eta \mid \xi \right]\). Make sure these are different random variables, and check the full averaging property for both.
(Memorylessness.) The lifetime of a device \(\eta\) has density \(f_\eta\); it is known that the device has already been running for time \(a\).
Write out the general formula for the mean residual lifetime \(\mathbb {E}\left[\eta - a \mid \eta \geq a\right]\).
Compute it for \(\eta \sim \operatorname {Exp}(\lambda )\) and show that the conditional distribution of the residual, \(\mathbb {P}\left(\eta - a \leq x \mid \eta \geq a\right)\), coincides with the unconditional distribution of \(\eta\).
Prove the converse: if \(\mathbb {P}\left(\eta > t + s \mid \eta > s\right) = \mathbb {P}\left(\eta > t\right)\) for all \(s, t \geq 0\), then \(\eta\) is exponential.
Prove the tower property: if \(\mathcal{G}_1 \subseteq \mathcal{G}_2\), then \(\mathbb {E}\left[ \mathbb {E}\left[\xi \right][\mathcal{G}_2] \mid \mathcal{G}_1 \right] = \mathbb {E}\left[ \xi \mid \mathcal{G}_1 \right]\) and \(\mathbb {E}\left[ \mathbb {E}\left[\xi \right][\mathcal{G}_1] \mid \mathcal{G}_2 \right] = \mathbb {E}\left[ \xi \mid \mathcal{G}_1 \right]\).
Let \(\xi_1, \ldots , \xi_n\) be independent, identically distributed, and integrable, \(S_k = \xi_1 + \ldots + \xi_k\).
Find \(\mathbb {E}\left[ \xi_1 \mid S_n \right]\).
Let \(\mathbb {E}\left[\xi_i\right] = 0\) and \(m \leq n\). Show that \(\mathbb {E}\left[ S_n \mid \xi_1, \ldots , \xi_m \right] = S_m\) and \(\mathbb {E}\left[ S_n \mid S_m \right] = S_m\).
Prove theorem Theorem 4 on the best forecast.
(Conditional Cauchy-Bunyakovsky-Schwarz inequality.) Prove: for \(\xi , \eta \in L^2\) \[
\left(\mathbb {E}\left[ \xi \eta \mid \mathcal{G} \right]\right)^2 \leq \mathbb {E}\left[ \xi ^2 \mid \mathcal{G} \right] \cdot \mathbb {E}\left[ \eta ^2 \mid \mathcal{G} \right] \quad \text{a.s.}
\]
Projections do not commute
Construct an example in which \(\mathbb {E}\left[ \mathbb {E}\left[\xi \right][\mathcal{G}_1] \mid \mathcal{G}_2 \right] \neq \mathbb {E}\left[ \mathbb {E}\left[\xi \right][\mathcal{G}_2] \mid \mathcal{G}_1 \right]\).
(Waldβs formula.) Over a year, an insurance company receives a random number of claims \(N\), independent of their sizes; the sizes \(\xi_1, \xi_2, \ldots\) are independent, identically distributed, \(\mathbb {E}\left[\xi_1\right] = m\). For the total loss \(S = \xi_1 + \ldots + \xi_N\) (with an empty sum when \(N = 0\)), prove \(\mathbb {E}\left[S\right] = m\, \mathbb {E}\left[N\right]\).