Statistics Graduate Level • Probability Foundations

Conditional Probability & Expectation — Conditional probability and conditional expectation (intro)

How incorporating partial information refines probabilistic predictions and reshapes entire distributions.

Graduate statistics illustration with a fitted curve, summation sign, and data table
Inside this lesson 10 sections 5 questions 10 figures

SECTION 1

Historical Context & Motivation

The idea that new information should systematically update our beliefs about uncertain events is arguably the most powerful conceptual tool in probability theory. Long before any formal axiomatization, mathematicians and philosophers grappled with a deceptively simple question: if we learn that some event has occurred, how should our assessment of other events change? The resolution of this question gave rise to conditional probability and, ultimately, to conditional expectation — constructs that form the backbone of modern statistical inference, stochastic processes, and Bayesian analysis.

The earliest seeds of conditional reasoning appeared in games of chance during the 17th century, when correspondents like Pascal and Fermat debated how to divide stakes in an interrupted game given what had already transpired. Later, Thomas Bayes posed his famous problem of inverse probability — inferring the likelihood of causes given observed effects — which was published posthumously in 1763. This line of thinking crystallized into a formal definition only after Kolmogorov laid the measure-theoretic groundwork in the 1930s, providing the rigorous foundation upon which conditional expectation as a random variable (rather than a mere number) could be constructed.

1654 • Pascal–Fermat Correspondence

Blaise Pascal and Pierre de Fermat exchange letters on the problem of points, reasoning about outcomes conditional on partial game results — the first systematic conditional probabilistic arguments.

1763 • Bayes' Posthumous Essay

Thomas Bayes' An Essay towards Solving a Problem in the Doctrine of Chances introduces inverse probability, the conceptual precursor to Bayes' theorem and conditional inference.

1812 • Laplace's Analytic Framework

Pierre-Simon Laplace systematizes conditional probability in Théorie analytique des probabilités, formulating what we now call Bayes' rule and applying it broadly to scientific problems.

1933 • Kolmogorov's Axioms

Andrey Kolmogorov publishes Grundbegriffe der Wahrscheinlichkeitsrechnung, axiomatizing probability via measure theory and defining conditional probability rigorously, including the concept of conditional expectation with respect to a σ-algebra.

1940s–50s • Doob's Martingale Theory

Joseph Doob develops the theory of martingales and iterated conditional expectations, cementing conditional expectation as a central tool in modern stochastic analysis and mathematical finance.

The central question this lesson addresses is: given a probability space (Ω, ℱ, P) and information that some event B has occurred (or more generally, that the value of some random variable has been observed), how do we rigorously update both probabilities of events and expected values of random variables? Answering this question requires understanding conditional probability as a ratio, extending it to conditional distributions, and ultimately constructing conditional expectation as a random variable measurable with respect to the conditioning information.

SECTION 2

Core Principles & Definitions

Before diving into formulas and measure-theoretic subtleties, it is essential to internalize the foundational ideas that govern conditional probability and conditional expectation. These concepts are not merely computational recipes; they embody a philosophy of belief revision under partial information, and every advanced topic — from Bayesian inference to filtering theory — rests on the principles articulated here.

1

Conditional Probability as Restriction

P(A | B) = P(A ∩ B) / P(B) redefines the sample space by restricting attention to outcomes in B. It renormalizes the probability measure so that B becomes the new universe with total probability 1.
2

The Law of Total Probability

If {B₁, B₂, …} is a partition of Ω, then P(A) = Σᵢ P(A | Bᵢ) P(Bᵢ). This decomposes marginal probabilities into weighted contributions from each conditioning scenario.
3

Bayes' Rule as Inversion

Bayes' theorem reverses the direction of conditioning: P(B | A) = P(A | B)P(B) / P(A). It lets us compute posterior beliefs about causes from observed effects, the engine of Bayesian inference.
4

Conditional Expectation as a Random Variable

E[X | Y] is not a single number but a function of Y — a random variable itself. It is the best prediction of X given knowledge of Y, in the mean-squared-error sense.
5

Tower Property (Iterated Expectation)

E[E[X | Y]] = E[X]. Averaging the conditional expectation over the conditioning variable recovers the unconditional expectation — a consistency check that links partial and full information.
✦

KEY TAKEAWAY

Think of conditional probability as adjusting the lens on a camera. When you condition on B, you are zooming into the region of the sample space where B is true, discarding everything outside, and rescaling so the remaining probabilities sum to 1. Conditional expectation extends this: rather than a single zoom, imagine a camera that automatically refocuses depending on the observed value of Y, producing a different expected value for each setting. The tower property guarantees that if you step back and average across all possible focus settings, you recover the overall scene — the unconditional expectation.

SECTION 3

Visual Explanation — Venn Diagram & Restriction of Sample Space

The most intuitive way to grasp conditional probability is through a Venn diagram that shows how conditioning on event B transforms the probability landscape. In the diagram below, the full sample space Ω is represented by the outer rectangle. Events A and B are overlapping regions. The conditional probability P(A | B) is simply the proportion of B's area that also belongs to A — the intersection A ∩ B relative to B, not relative to the whole of Ω.

Sample Space ΩABA ∩ BP(A | B)= P(A∩B)/P(B)New universeP(B) renormalized to 1Conditioning on B restricts outcomes to the cyan region; the pink overlap determines P(A | B).
The violet circle represents event A and the cyan circle represents event B. Their overlap (shaded pink) is A ∩ B. Conditioning on B means treating B as the entire sample space: P(A | B) equals the pink area divided by the full cyan area.

Notice the conceptual shift: unconditional probability P(A) measures A against all of Ω, while conditional probability P(A | B) measures A only within B. Geometrically, conditioning shrinks the reference set. This simple idea has profound implications — it is why, for instance, the probability of a positive medical test being a true positive depends critically on the prevalence of the disease (the conditioning event). When B has small probability, even a highly accurate test can yield a conditional probability of disease that is surprisingly low, a fact that Bayes' rule makes precise.

SECTION 4

Mathematical Framework

We now formalize the definitions, beginning with the elementary ratio definition of conditional probability, proceeding through Bayes' theorem, and then extending to conditional expectation — first in the discrete case and then via the abstract (measure-theoretic) definition that handles continuous and general random variables.

CONDITIONAL PROBABILITY

P(A∣B)=P(A∩B)/P(B),providedP(B)>0P(A | B) = P(A ∩ B) / P(B), provided P(B) > 0

A, B are events in a probability space (Ω, ℱ, P). The condition P(B) > 0 is essential; the ratio is undefined when the conditioning event has zero probability, motivating the measure-theoretic extension.

BAYES' THEOREM

P(Bj∣A)=P(A∣Bj)P(Bj)/ΣiP(A∣Bi)P(Bi)P(Bⱼ | A) = P(A | Bⱼ) P(Bⱼ) / Σᵢ P(A | Bᵢ) P(Bᵢ)

{B₁, B₂, …, Bₙ} is a partition of Ω. P(Bⱼ) is the prior probability, P(A | Bⱼ) is the likelihood, and P(Bⱼ | A) is the posterior probability.

CONDITIONAL EXPECTATION (DISCRETE CASE)

E[X∣Y=y]=Σxx⋅P(X=x∣Y=y)E[X | Y = y] = Σₓ x · P(X = x | Y = y)

When X and Y are discrete random variables, E[X | Y = y] is a weighted average of the values of X, using the conditional PMF pX∣Yp_{X|Y}(x | y) as weights. As y varies, E[X | Y = y] defines a function g(y), and E[X | Y] = g(Y) is itself a random variable.

LAW OF TOTAL EXPECTATION (TOWER PROPERTY)

E[X]=E[E[X∣Y]]E[X] = E[ E[X | Y] ]

Averaging the conditional expectation E[X | Y] over all possible values of Y recovers the unconditional expectation. In the discrete case: E[X] = Σ_y E[X | Y = y] P(Y = y). This property generalizes to σ-algebras: E[ E[X | 𝒢] ] = E[X].

In the continuous setting, conditional expectation given Y = y is defined through the conditional density: E[X | Y = y] = ∫ x · fX∣Yf_{X|Y}(x | y) dx, where fX∣Yf_{X|Y}(x | y) = fX,Yf_{X,Y}(x, y) / fYf_Y(y). The fully abstract version — conditioning on a sub-σ-algebra 𝒢 — defines E[X | 𝒢] as the unique (a.s.) 𝒢-measurable random variable Z satisfying ∫_G Z dP = ∫_G X dP for every G ∈ 𝒢. This definition, guaranteed by the Radon–Nikodým theorem, is the cornerstone of advanced probability and will be explored in detail in subsequent lessons.

SECTION 5

Types of Conditioning & Key Properties

Conditional probability and expectation take different forms depending on what kind of object we condition on and the nature of the random variables involved. Understanding this taxonomy is crucial because each setting demands its own technical machinery and carries its own set of pitfalls — most notably the Borel–Kolmogorov paradox, which arises when conditioning on continuous random variables is done carelessly.

Taxonomy of Conditional ConstructsConditioning InformationOn an Event BP(A | B), P(B) > 0On a Random Variable YE[X | Y] = g(Y)On a σ-algebra 𝒢E[X | 𝒢], 𝒢-meas.Cond. ProbabilityP(A | B) ∈ [0,1]Cond. ExpectationE[X | B] = numberDiscrete YΣₓ x·p(x|y)Continuous Y∫x·f(x|y)dxKey Properties of Conditional ExpectationLinearity: E[aX+bZ | Y]Tower: E[E[X|Y]] = E[X]Pull-out: E[h(Y)X | Y]Conditioning on a σ-algebra generalizes both the event and random variable cases.
This taxonomy shows three levels of conditioning — on an event, on a random variable, and on a σ-algebra — with the resulting forms of conditional probability and expectation. The bottom row highlights three fundamental algebraic properties of conditional expectation.
PropertyStatementIntuition
LinearityE[aX + bZ | Y] = aE[X | Y] + bE[Z | Y]Conditional expectation behaves like ordinary expectation within each 'slice' of Y.
Tower / Iterated ExpectationE[E[X | Y]] = E[X]Averaging all conditional predictions reproduces the overall average.
Pull-out (Taking Out Known)E[h(Y) · X | Y] = h(Y) · E[X | Y]Functions of Y are 'constants' when Y is known, and can be factored out.
IndependenceIf X ⊥ Y: E[X | Y] = E[X]Knowing Y adds no information about X; the conditional expectation collapses to a constant.

Fundamental properties of conditional expectation

⚠

Watch Out: The Borel–Kolmogorov Paradox

When conditioning on a continuous random variable Y taking a specific value y (an event of probability zero), the conditional distribution is not uniquely determined by the probability measure alone — it depends on how you parameterize the conditioning variable. The regular conditional distribution resolves this by specifying a version of the conditional probability that is a proper probability measure for each y. This subtlety is why the measure-theoretic definition uses σ-algebras rather than point conditioning.

SECTION 6

Worked Example — Conditional Expectation of a Joint Distribution

Consider two jointly distributed discrete random variables X and Y with the following joint probability mass function. We will compute P(X = 1 | Y = 0), the conditional PMF of X given Y = 1, E[X | Y = 1], and verify the tower property E[E[X | Y]] = E[X].

X \ YY = 0Y = 1Y = 2
X = 00.100.150.05
X = 10.200.100.10
X = 20.050.150.10

Joint PMF p(x, y) for X ∈ {0, 1, 2} and Y ∈ {0, 1, 2}

Computing Conditional Probability and Conditional Expectation

  1. 1

    Step 1 — Compute Marginal P(Y = y)

    Sum across X for each value of Y. P(Y = 0) = 0.10 + 0.20 + 0.05 = 0.35. P(Y = 1) = 0.15 + 0.10 + 0.15 = 0.40. P(Y = 2) = 0.05 + 0.10 + 0.10 = 0.25.
    P(Y = 0) = 0.35, P(Y = 1) = 0.40, P(Y = 2) = 0.25
  2. 2

    Step 2 — Compute P(X = 1 | Y = 0)

    Apply the definition: P(X = 1 | Y = 0) = P(X = 1, Y = 0) / P(Y = 0) = 0.20 / 0.35 = 4/7 ≈ 0.5714.
    P(X = 1 | Y = 0) = 4/7 ≈ 0.571
  3. 3

    Step 3 — Compute the Conditional PMF of X Given Y = 1

    For each x: P(X = x | Y = 1) = P(X = x, Y = 1) / P(Y = 1). So P(X = 0 | Y = 1) = 0.15/0.40 = 3/8, P(X = 1 | Y = 1) = 0.10/0.40 = 1/4, P(X = 2 | Y = 1) = 0.15/0.40 = 3/8. Verify: 3/8 + 1/4 + 3/8 = 3/8 + 2/8 + 3/8 = 8/8 = 1 ✓.
    pX∣Yp_{X|Y}(0|1) = 3/8, pX∣Yp_{X|Y}(1|1) = 1/4, pX∣Yp_{X|Y}(2|1) = 3/8
  4. 4

    Step 4 — Compute E[X | Y = 1]

    E[X | Y = 1] = Σₓ x · P(X = x | Y = 1) = 0 × (3/8) + 1 × (1/4) + 2 × (3/8) = 0 + 1/4 + 3/4 = 1.0.
    E[X | Y = 1] = 1.0
  5. 5

    Step 5 — Compute E[X | Y = y] for All y and Verify the Tower Property

    Similarly compute: E[X | Y = 0] = 0(2/7) + 1(4/7) + 2(1/7) = 6/7 ≈ 0.857. E[X | Y = 2] = 0(1/5) + 1(2/5) + 2(2/5) = 6/5 = 1.2. Now E[E[X | Y]] = E[X | Y = 0] · P(Y = 0) + E[X | Y = 1] · P(Y = 1) + E[X | Y = 2] · P(Y = 2) = (6/7)(0.35) + (1.0)(0.40) + (1.2)(0.25) = 0.30 + 0.40 + 0.30 = 1.00. Direct computation: E[X] = 0(0.30) + 1(0.40) + 2(0.30) = 1.00 ✓. The tower property holds.
    E[E[X | Y]] = E[X] = 1.00 ✓ Tower property verified

SECTION 7

Unconditional vs. Conditional — Strengths & Limitations

Understanding when to use conditional versus unconditional quantities, and appreciating the trade-offs, is essential for applied probability and statistics. Conditional reasoning is more powerful but introduces additional complexity — both computational (you must know joint distributions or likelihoods) and conceptual (the conditioning variable itself may be random, leading to random expectations that require further averaging).

AspectUnconditionalConditional
Information usedNone — computed from the marginal distribution alonePartial observation (event B, or random variable Y)
Output typeA fixed number: P(A) or E[X]A number (given event) or a random variable (given Y)
Prediction qualityBest constant predictor (minimizes variance but ignores information)Optimal predictor given available information (minimizes MSE)
Computational costRequires only marginal distributionRequires joint distribution or conditional model
PitfallsSimpson's paradox: marginal association can reverse conditional onesBorel–Kolmogorov paradox; requires careful specification in continuous case

Comparison: unconditional vs. conditional probability and expectation

✦

KEY TAKEAWAY

Consider engineering a recommendation system. The unconditional expectation E[Rating] tells you the average rating across all users and all items — useful but crude. The conditional expectation E[Rating | User = u, Item = i] leverages user and item information to predict the specific rating for user u on item i, dramatically improving accuracy. This mirrors how conditional expectation always reduces mean-squared prediction error compared to the unconditional mean, a property formalized by the law of total variance: Var(X) = E[Var(X | Y)] + Var(E[X | Y]).

SECTION 8

Connection to Advanced Theory

The introductory definitions of conditional probability and conditional expectation presented here serve as stepping stones to far deeper constructions. In advanced probability theory, conditioning on a σ-algebra replaces the naive ratio definition and enables conditioning on events of probability zero. This leap is not merely pedantic — it is the foundation upon which martingale theory, Markov process theory, and stochastic filtering rest.

Introductory ConceptAdvanced GeneralizationWhere It Matters
P(A | B) = P(A∩B)/P(B)Regular conditional probability P(A | 𝒢)(ω)Disintegration of measures; Bayesian nonparametrics
E[X | Y = y] via conditional PMF/PDFE[X | 𝒢] defined via Radon–NikodýmMartingale convergence, stochastic calculus
Tower property E[E[X|Y]] = E[X]Nested σ-algebras: 𝒢₁ ⊂ 𝒢₂ ⇒ E[E[X|𝒢₂]|𝒢₁] = E[X|𝒢₁]Filtration-based arguments; optional stopping theorem
Law of total varianceANOVA decomposition; Eve's law in hierarchical modelsBayesian hierarchical modeling, meta-analysis

From introductory to advanced conditional constructs

A particularly important generalization is the concept of a martingale: a stochastic process (Mₙ) adapted to a filtration (ℱₙ) such that E[Mₙ₊₁ | ℱₙ] = Mₙ. This is an iterated conditional expectation condition that captures the idea of a 'fair game' — the best prediction of the future, given the present, is the present value. The optional stopping theorem, convergence theorems for martingales, and the pricing of financial derivatives all flow from this single conditional expectation identity.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain in your own words why E[X | Y] is a random variable rather than a fixed number, and describe in what sense it is 'known' once Y is observed.
Show answer
E[X | Y] is defined as g(Y) for some function g, where g(y) = E[X | Y = y]. Before Y is observed, g(Y) is a random variable because Y is random — it takes different values depending on the outcome ω ∈ Ω. Once Y is observed to equal some specific value y₀, the conditional expectation collapses to the number g(y₀). The function g captures how our best prediction of X changes as the value of Y varies. This is analogous to a temperature forecast that depends on cloud cover: before observing cloud cover, the forecast is uncertain, but once cloud cover is measured, the forecast becomes a concrete number.

Question 2: BASIC CALCULATION

A bag contains 3 red and 7 blue balls. Two balls are drawn without replacement. Let A = {second ball is red} and B = {first ball is red}. Compute P(A | B) and P(A | Bᶜ).
Show answer
Given B (first ball red), there are 2 red and 7 blue remaining among 9 balls, so P(A | B) = 2/9. Given Bᶜ (first ball blue), there are 3 red and 6 blue remaining among 9 balls, so P(A | Bᶜ) = 3/9 = 1/3. As a verification via the law of total probability: P(A) = P(A|B)P(B) + P(A|Bᶜ)P(Bᶜ) = (2/9)(3/10) + (1/3)(7/10) = 6/90 + 7/30 = 6/90 + 21/90 = 27/90 = 3/10, which equals the unconditional probability of drawing a red ball — consistent with symmetry.

Question 3: INTERMEDIATE

Let X ~ Geometric(p) with P(X = k) = (1−p)k−1(1−p)^{k−1}p for k = 1, 2, .... Compute E[X | X > n] for a fixed positive integer n, and interpret the result in light of the memoryless property.
Show answer
By the memoryless property of the geometric distribution, P(X = n + j | X > n) = P(X = j) for j = 1, 2, .... Therefore, the conditional distribution of (X − n) given X > n is again Geometric(p). Hence E[X | X > n] = E[X − n + n | X > n] = E[X − n | X > n] + n = 1/p + n. The interpretation is elegant: given that no success has occurred in the first n trials, the expected additional waiting time is still 1/p — exactly as if the process started afresh. The total expected waiting time is therefore the n 'wasted' trials plus the unconditional mean 1/p. This is the defining hallmark of memorylessness in discrete distributions.

Question 4: APPLIED

An insurance company classifies drivers as low-risk (60% of drivers, claim rate λ₁ = 0.1 per year) or high-risk (40%, claim rate λ₂ = 0.5 per year). Claims follow a Poisson distribution. A randomly selected driver files 2 claims in one year. What is the posterior probability that this driver is high-risk?
Show answer
Let H = high-risk, L = low-risk, and X = number of claims. We need P(H | X = 2). By Bayes' theorem: P(H | X=2) = P(X=2|H)P(H) / [P(X=2|H)P(H) + P(X=2|L)P(L)]. The Poisson PMF gives P(X=2|H) = e−0.5e^{−0.5}(0.5²/2!) = e−0.5e^{−0.5}(0.125) ≈ 0.0758 and P(X=2|L) = e−0.1e^{−0.1}(0.1²/2!) = e−0.1e^{−0.1}(0.005) ≈ 0.00452. Numerator: 0.0758 × 0.40 = 0.03032. Denominator: 0.03032 + 0.00452 × 0.60 = 0.03032 + 0.00271 = 0.03303. Thus P(H | X=2) ≈ 0.03032/0.03303 ≈ 0.918. The observation of 2 claims dramatically shifts the posterior from 0.40 to about 0.92, reflecting how unlikely 2 claims are under the low-risk model.

Question 5: CRITICAL THINKING

Let X be an integrable random variable and 𝒢₁ ⊂ 𝒢₂ ⊂ ℱ be sub-σ-algebras. Prove the tower property in this generality: E[E[X | 𝒢₂] | 𝒢₁] = E[X | 𝒢₁] a.s. using the definition of conditional expectation.
Show answer
Let Z₂ = E[X | 𝒢₂] and Z₁ = E[X | 𝒢₁]. We must show E[Z₂ | 𝒢₁] = Z₁ a.s. By definition, E[Z₂ | 𝒢₁] is the (a.s. unique) 𝒢₁-measurable random variable W such that ∫_G W dP = ∫_G Z₂ dP for every G ∈ 𝒢₁. Since 𝒢₁ ⊂ 𝒢₂, every G ∈ 𝒢₁ is also in 𝒢₂, so by the defining property of Z₂: ∫_G Z₂ dP = ∫_G X dP. But Z₁ is 𝒢₁-measurable and satisfies ∫_G Z₁ dP = ∫_G X dP for all G ∈ 𝒢₁ (by definition of conditional expectation on 𝒢₁). Therefore ∫_G W dP = ∫_G X dP = ∫_G Z₁ dP for all G ∈ 𝒢₁, and by uniqueness (a.s.) of the conditional expectation, W = Z₁ a.s. This proof elegantly uses only the defining integral identity and the nesting 𝒢₁ ⊂ 𝒢₂.

SUMMARY

Lesson Summary

Summary

Conditional probability P(A | B) = P(A ∩ B) / P(B) formalizes how learning that event B has occurred restricts the sample space and rescales probabilities accordingly. This simple ratio is the gateway to Bayes' theorem, which inverts conditional probabilities to compute posteriors from priors and likelihoods, and to the law of total probability, which decomposes marginal probabilities via partitions. These tools are indispensable in Bayesian inference, diagnostic testing, and decision-making under uncertainty.

Conditional expectation E[X | Y] generalizes the notion: rather than a single number, it is a random variable — the best predictor of X given information about Y in the mean-squared-error sense. Its key algebraic properties — linearity, the tower property E[E[X | Y]] = E[X], and the pull-out rule — form the backbone of martingale theory, stochastic filtering, and hierarchical modeling. The measure-theoretic extension, conditioning on a σ-algebra via the Radon–Nikodým theorem, provides the rigorous foundation for all of modern stochastic analysis.

Varsity Tutors • Statistics Graduate Level • Conditional Probability & Expectation — Conditional probability and conditional expectation (intro)