Intuition What this page is for
The parent note built the definitions and the Tower Rule. Here we stress-test them. We march through every kind of problem conditional expectation can throw at you: discrete, continuous, degenerate (nothing changes), a real-world word problem, and an exam-style trap. If a scenario exists, it has a worked example below with the matrix cell it fills.
Before anything else, three reminders so every symbol on this page is earned:
Recall What the notation means (from the parent)
E [ X ] ::: your best single-number guess for X before any info — a plain number.
E [ X ∣ Y = y ] ::: your guess after learning Y took the specific value y — still a plain number, one per y .
E [ X ∣ Y ] (capital Y ) ::: leave Y unknown → the guess is itself a random variable , the function g ( Y ) = E [ X ∣ Y = y ] fed the random Y .
Tower Rule ::: E [ E [ X ∣ Y ] ] = E [ X ] — average the group-averages, weighted by group sizes.
Every conditional-expectation problem lands in one of these cells. The examples below are labelled by cell.
Cell
Case class
What makes it tricky
Example
A
Discrete, condition on an event B
must renormalise by P ( B )
Ex 1
B
Discrete, condition on a variable Y ; use Tower
must weight by P ( Y = y )
Ex 2
C
Continuous , E [ X ∣ Y ] = g ( Y ) then integrate
inner density f X ∣ Y
Ex 3
D
Degenerate : X ⊥ Y
knowing Y changes nothing
Ex 4
E
Take-out-what-is-known with g ( Y ) X
don't fuse rules
Ex 5
F
Real-world word problem (random count)
Wald-style sum
Ex 6
G
Exam twist : recover a hidden mean by tower
reverse the tower
Ex 7
H
Limiting/edge : P ( B ) → 0 , or Y near boundary
check it stays sane
Ex 8
Worked example Ex 1 (Cell A). Roll one fair die. Given the outcome is
at least 3 , find E [ X ∣ B ] .
Here X = the die face, B = { X ≥ 3 } .
Forecast: guess first — the unconditional mean is 3.5 . Chopping off { 1 , 2 } pushes the average up . Above 3.5 ? Below? Make a bet.
Find P ( B ) . The favourable faces are { 3 , 4 , 5 , 6 } , so P ( B ) = 4/6 = 2/3 .
Why this step? Cell-A problems condition on an event, and the definition E [ X ∣ B ] = ∑ x x P ( X = x , B ) / P ( B ) divides by P ( B ) — we must know it first.
Renormalise. For each surviving face x ∈ { 3 , 4 , 5 , 6 } , P ( X = x ∣ B ) = 2/3 1/6 = 4 1 .
Why? Conditioning on B keeps only these outcomes and stretches their probabilities so they sum to 1.
Average. E [ X ∣ B ] = 4 1 ( 3 + 4 + 5 + 6 ) = 4 1 ⋅ 18 = 4.5 .
Why? This is just ordinary expectation under the renormalised distribution.
Verify: 4.5 > 3.5 ✓ (removing the two smallest faces must raise the mean). The four kept faces are symmetric about 4.5 , so their equal-weight average sits exactly in the middle — sanity confirmed.
Worked example Ex 2 (Cell B). Roll two fair dice;
X = sum, Y = first die. Find E [ X ] via the Tower Rule, being careful about weights .
Forecast: two dice, each mean 3.5 , so you probably already smell E [ X ] = 7 . Good — but let's derive it through the tower so the weighting habit sticks.
Conditional mean. E [ X ∣ Y = y ] = y + E [ second die ] = y + 3.5 .
Why this step? The second die is independent of Y ; conditioning fixes only the first term, leaving the second's mean untouched.
Weight by P ( Y = y ) . Each y ∈ { 1 , … , 6 } has P ( Y = y ) = 1/6 :
E [ X ] = ∑ y = 1 6 ( y + 3.5 ) ⋅ 6 1 .
Why? The Tower Rule is E [ X ] = ∑ y E [ X ∣ Y = y ] P ( Y = y ) — a weighted average of group means, not a plain one.
Compute. ∑ y = 1 6 y = 21 , so E [ X ] = 6 1 ( 21 ) + 3.5 = 3.5 + 3.5 = 7 .
Why this step? Distributing the sum, 6 1 ∑ y ( y + 3.5 ) = 6 1 ∑ y y + 6 1 ⋅ 6 ⋅ 3.5 ; the constant 3.5 averaged over six equal weights is just 3.5 , and 6 1 ⋅ 21 = 3.5 , so the two halves add to 7 .
Verify: matches E [ X ] = E [ die 1 ] + E [ die 2 ] = 3.5 + 3.5 = 7 by linearity (Expectation and its linearity ) ✓.
Twist inside Cell B — condition on an even first die (this reuses Cell A renormalisation):
Renormalise the first die. Among { 1 , … , 6 } the even faces are { 2 , 4 , 6 } , so P ( Y even ) = 3/6 = 1/2 , and for each even y , P ( Y = y ∣ Y even ) = 1/2 1/6 = 3 1 .
Why this step? Just like Cell A, conditioning on the event { Y even } keeps only { 2 , 4 , 6 } and stretches their probabilities to sum to 1.
Weighted average of y . E [ Y ∣ Y even ] = 3 1 ( 2 + 4 + 6 ) = 3 1 ⋅ 12 = 4 .
Why this step? With the three even faces now equally likely at 1/3 each, E [ Y ∣ Y even ] = ∑ y P ( y ∣ even ) is their equal-weight average — the midpoint 4 of { 2 , 4 , 6 } .
Add the second die. E [ X ∣ Y even ] = 4 + 3.5 = 7.5 (matches parent Example 1) ✓.
Why this step? By linearity E [ X ∣ Y even ] = E [ Y ∣ Y even ] + E [ second die ] ; the second die is independent so its mean stays 3.5 , giving 4 + 3.5 .
Worked example Ex 3 (Cell C).
Y ∼ U ( 0 , 1 ) and, given Y = y , X ∼ U ( 0 , y ) . Find E [ X ] and E [ X 2 ] .
Forecast: X lives inside [ 0 , y ] and Y < 1 , so X is squeezed toward small values. Guess E [ X ] is well below 0.5 .
Inner mean. For a uniform on [ 0 , y ] , E [ X ∣ Y = y ] = 2 0 + y = 2 y .
Why this step? A uniform's mean is its midpoint. This gives the function g ( y ) = y /2 , hence the random variable E [ X ∣ Y ] = Y /2 .
Tower for the mean. E [ X ] = E [ Y /2 ] = 2 1 E [ Y ] = 2 1 ⋅ 2 1 = 4 1 .
Why? Replaces the hard double integral over the joint density with two easy one-liners.
Second moment via tower. For U ( 0 , y ) , E [ X 2 ∣ Y = y ] = y 2 /3 .
Why? ∫ 0 y x 2 ⋅ y 1 d x = 3 y 2 — the variance-plus-mean-squared of a uniform, but we just integrate directly. Then
E [ X 2 ] = E [ 3 Y 2 ] = 3 1 E [ Y 2 ] = 3 1 ⋅ 3 1 = 9 1 .
(Used E [ Y 2 ] = ∫ 0 1 y 2 d y = 1/3 .)
Verify: E [ X ] = 1/4 = 0.25 < 0.5 ✓ (squeezed low, as forecast). As a second sanity check we use the variance Var ( X ) , which is defined as the average squared distance from the mean and can be computed as Var ( X ) = E [ X 2 ] − E [ X ] 2 . Why use it as a check? Because a variance is an average of squares, it can never be negative — so if our E [ X 2 ] and E [ X ] were mutually inconsistent, this would come out negative and flag the error. Here Var ( X ) = 9 1 − 16 1 = 144 7 > 0 ✓ (safely positive — the tools didn't break). This continuous case connects to Joint and marginal distributions and Conditional variance and Eve's law .
Worked example Ex 4 (Cell D).
X = number of heads in 3 fair-coin flips; Y = a completely separate fair die. Find E [ X ∣ Y ] and E [ X ∣ Y = 6 ] .
Forecast: the die has nothing to do with the coins. Does learning Y change your guess for X ? Predict before reading.
Check independence. The coin flips and the die are physically unrelated, so X ⊥ Y .
Why this step? The independence-collapse rule E [ X ∣ Y ] = E [ X ] only fires when X and Y are independent — we must justify it, not assume it. See Conditional probability .
Collapse. E [ X ∣ Y ] = E [ X ] , a constant random variable.
Why? Knowing Y gives zero new information about X , so the updated guess equals the original.
Value. X ∼ Binomial ( 3 , 2 1 ) , so E [ X ] = 3 ⋅ 2 1 = 1.5 . Hence E [ X ∣ Y = 6 ] = 1.5 too — same for every y .
Why this step? A Binomial( n , p ) counts successes in n independent trials, and by linearity its mean is n p ; here n = 3 , p = 2 1 give n p = 1.5 . Since the collapse made E [ X ∣ Y ] constant, plugging in any y (including 6 ) returns that same 1.5 .
Verify: Tower must still hold: E [ E [ X ∣ Y ]] = E [ 1.5 ] = 1.5 = E [ X ] ✓. A constant's expectation is itself, so the tower trivially closes — the degenerate case is consistent.
Worked example Ex 5 (Cell E).
Y ∼ U ( 0 , 1 ) , and given Y = y , X ∼ U ( 0 , y ) (same setup as Ex 3). Find E [ X Y ] .
Forecast: it's tempting to write E [ X Y ∣ Y ] = Y E [ X ] . That's the classic trap. Watch.
Pull out the known factor. Given Y , the value Y is a constant, so
E [ X Y ∣ Y ] = Y E [ X ∣ Y ] .
Why this step? "Take out what is known": once Y is fixed, Y is a constant and leaves the inner expectation. This is always valid.
Do NOT replace E [ X ∣ Y ] by E [ X ] . Here E [ X ∣ Y ] = Y /2 (from Ex 3), which depends on Y — X and Y are not independent.
Why? Swapping in E [ X ] needs independence (Cell D); fusing the two rules gives the wrong answer Y ⋅ 4 1 . Keep them separate.
Assemble and take the outer expectation.
E [ X Y ∣ Y ] = Y ⋅ 2 Y = 2 Y 2 , E [ X Y ] = E [ 2 Y 2 ] = 2 1 ⋅ 3 1 = 6 1 .
Why this step? E [ X Y ∣ Y ] is a random variable (a function of Y ); the Tower Rule says its outer expectation E [ E [ X Y ∣ Y ]] equals E [ X Y ] . Pulling the constant 2 1 out and using E [ Y 2 ] = 3 1 from Ex 3 finishes it.
Verify: Contrast the wrong route: Y E [ X ] = Y ⋅ 4 1 ⇒ E [ X Y ] = ? 4 1 E [ Y ] = 8 1 . Since 6 1 = 8 1 , fusing the rules genuinely breaks — our careful answer 6 1 is the correct one ✓.
Worked example Ex 6 (Cell F). A call centre gets
N ∼ Poisson ( λ = 10 ) calls an hour. Each call independently lasts L minutes with E [ L ] = 4 . Let S = ∑ i = 1 N L i be the total minutes. Find E [ S ] .
Forecast: roughly "10 calls times 4 minutes" ⇒ 40 minutes. Let's prove that the tower makes this exact even though N is random.
Condition on the count N . Given N = n , S is a sum of n fixed-mean pieces:
E [ S ∣ N = n ] = ∑ i = 1 n E [ L i ] = n ⋅ 4.
Why this step? With N fixed the sum has a known number of terms, so linearity of expectation applies directly (Expectation and its linearity ).
Package as a random variable. E [ S ∣ N ] = 4 N .
Why? Every value n maps to 4 n , so the function g ( N ) = 4 N is the conditional expectation.
Tower. E [ S ] = E [ 4 N ] = 4 E [ N ] = 4 ⋅ 10 = 40 minutes.
Why? Averaging the conditional means, weighted by P ( N = n ) — exactly the Tower Rule — collapses to 4 E [ N ] .
Verify: This is Wald's identity : E [ S ] = E [ N ] E [ L ] = 10 ⋅ 4 = 40 ✓. Units: (calls)× (minutes/call) = minutes ✓.
Worked example Ex 7 (Cell G). An exam has two versions. A student gets version
A with prob 0.3 and version B with prob 0.7 . The overall mean score is known to be E [ X ] = 68 . Version-B takers average E [ X ∣ B ] = 72 . Find the version-A mean E [ X ∣ A ] .
Forecast: overall is 68, and B (the majority) averages 72 (above overall). So A must drag the mean down — guess A's mean is below 68.
Write the tower as a weighted sum.
E [ X ] = P ( A ) E [ X ∣ A ] + P ( B ) E [ X ∣ B ] .
Why this step? Conditioning on which version is a two-value partition; the tower says the overall mean is the crowd-weighted blend of the two group means (Law of total probability ).
Plug in knowns. 68 = 0.3 E [ X ∣ A ] + 0.7 ⋅ 72 = 0.3 E [ X ∣ A ] + 50.4.
Why? We know three of the four quantities; the tower gives one equation in the one unknown.
Solve. 0.3 E [ X ∣ A ] = 68 − 50.4 = 17.6 ⇒ E [ X ∣ A ] = 0.3 17.6 = 3 176 = 58. 6 ≈ 58.67.
Why this step? It is a single linear equation 68 = 0.3 m + 50.4 in the unknown m = E [ X ∣ A ] ; subtracting the known 50.4 isolates the 0.3 m term, and dividing by the coefficient 0.3 frees m .
Verify: 0.3 ⋅ 3 176 + 0.7 ⋅ 72 = 17.6 + 50.4 = 68 ✓, and 3 176 < 68 ✓ (A drags the mean down, as forecast). The trap here is forgetting the weights — a naive 2 68 + 72 reasoning would be nonsense.
Worked example Ex 8 (Cell H). Two edge checks so the reader never hits an unshown case.
(H1) A shrinking event. For one fair die, condition on B k = { X ≥ k } and let k → 6 .
Forecast: as the event narrows to just the face 6, the conditional mean should slide up to 6.
E [ X ∣ X ≥ k ] = 7 − k k + ( k + 1 ) + ⋯ + 6 = midpoint of the kept faces = 2 k + 6 .
Why this step? Kept faces { k , … , 6 } are equally spaced and equally likely, so their mean is the midpoint.
At k = 6 : E [ X ∣ X ≥ 6 ] = 2 6 + 6 = 6 , and P ( B 6 ) = 1/6 > 0 so the formula is still legal.
Why? Conditional expectation needs only P ( B ) > 0 ; here that holds right up to the singleton { 6 } .
Verify: k = 1 gives 2 1 + 6 = 3.5 = E [ X ] ✓ (conditioning on the certain event changes nothing); k = 6 gives 6 ✓. Monotone increase from 3.5 to 6 as the event shrinks — exactly as forecast. The forbidden case is P ( B ) = 0 (e.g. "given X = 7 "), where E [ X ∣ B ] is undefined , not zero.
(H2) A boundary continuous value. In Ex 3, let Y → 0 + . Then X ∣ Y = y ∼ U ( 0 , y ) collapses toward the point 0 .
Read off the conditional mean near the boundary. From Ex 3, E [ X ∣ Y = y ] = y /2 , so as y → 0 + we get E [ X ∣ Y = y ] = y /2 → 0 .
Why this step? The edge case is handled by the same formula we already derived — we just track what it does at the boundary rather than inventing a new rule.
Sanity of the collapse. A uniform on the shrinking interval [ 0 , y ] has all its mass sliding to 0 , so its mean must go to 0 too — and crucially the formula y /2 never divides by anything that vanishes, so nothing blows up.
Why this step? We must confirm the limit is finite and sensible : degenerate inputs are exactly where careless formulas explode, and here they don't ✓.
Figure — Left panel (Cells A & H): the blue faded bars are the fair die's original P = 6 1 ; conditioning on { X ≥ 3 } crosses out faces 1 and 2 (yellow X's) and the pink bars show the survivors renormalised to P = 4 1 , whose balance point (yellow dashed line) sits at E [ X ∣ B ] = 4.5 . Right panel (Cells B & G): two bars whose heights are the group means (E [ X ∣ A ] ≈ 58.7 pink, E [ X ∣ B ] = 72 blue) and whose widths are the crowd weights (0.3 and 0.7 ); the yellow dashed line is the width-weighted blend E [ X ] = 68 — the tower is literally "average the heights, weighted by the widths".
The chalkboard above shows the two workhorse pictures: left , Cell A/H — conditioning as slicing off outcomes and renormalising ; right , Cell B/G — the tower as weighted bars whose blended height is the overall mean .
Common mistake The three traps this page defuses
(1) Cell A — forgetting to divide by P ( B ) when conditioning on an event.
(2) Cell E — fusing "take out what's known" with "independence collapse" (Ex 5 shows they give different answers).
(3) Cells B & G — averaging group means without the P ( Y = y ) weights.
Mnemonic One line to remember all eight cells
A Slice off outcomes and divide by P ( B ) · B Stack group-means and weight by P ( Y = y ) · C Integrate the inner mean g ( Y ) · D Collapse to E [ X ] when X ⊥ Y · E Pull out what's known but don't fuse rules · F Random count: E [ N ] × E [ L ] · G Run the tower backwards to recover a hidden mean · H Check the edges (P ( B ) → 0 , Y at a boundary).
The flowchart below is not a restatement of the matrix table — it is a decision procedure : read it top-to-bottom to pick which technique a fresh problem needs (divide by P ( B ) ? weight by P ( Y = y ) ? integrate? collapse?), then jump to the labelled example. The table classifies; this diagram routes.
Condition on a variable Y