Conditional Expectation and Variance


Conditional Expectation and Variance

Anna
Welcome to lecture 17 of Advanced Probability Theory. Today we’re connecting conditional distributions to conditional expectation and variance, then using those ideas to study two important probability bounds: Chebyshev’s inequality and Markov’s inequality.

Maria
We’ve already seen how to describe the distribution of X when Y is fixed at a particular value. Since that conditional distribution is itself a valid distribution, we can calculate its expectation and variance just as we would for any other distribution.

Anna
For a discrete pair, the conditional expectation is the weighted sum of the possible values of X, using the conditional probabilities: E[X given Y equals y] equals the sum over x of x times P(X equals x given Y equals y). And that conditional probability is the joint probability divided by P(Y equals y), as long as P(Y equals y) is positive.

Maria
For continuous variables, the same idea becomes an integral. We integrate x times the conditional density of X given Y equals y. Using the joint density, that density is f of x and y divided by the marginal density f of y, so the conditional expectation is an integral of x times f of x and y over f of y.

Anna
The key point is that this expectation generally depends on y. Once we condition on a particular value of Y, we get a number, but as that value changes, the number can change too. So E[X given Y] is itself a random variable. If X and Y are independent, though, conditioning on Y doesn’t change the distribution of X, and E[X given Y equals y] is just E[X].

Maria
Let’s make that dependence concrete with two fair dice. Call the first result X and the second result X₁, and let Y be the maximum of the two results. Each die is uniform on 1 through 6, and the dice are independent. We’ll ask: once we know the maximum, what can we say about the first die?

Anna
There are 36 equally likely pairs of dice results. For a fixed y, the event Y equals y means neither die exceeds y and at least one die equals y. Its probability is (2y minus 1) over 36: there are y outcomes with X equal to y and X₁ no greater than y, plus y minus 1 outcomes with X less than y and X₁ equal to y.

Maria
That count also gives us the conditional distribution of X. When X is less than y and Y equals y, the second die must be y, so each such value of X contributes one outcome out of 36. When X equals y, the second die can be any value from 1 through y, giving y outcomes. Dividing those counts by 2y minus 1 gives the conditional probabilities.

Anna
For example, if Y equals 1, then X must be 1, so the conditional expectation is 1. If Y equals 2, the joint probabilities for X equals 1 and X equals 2 are 1 over 36 and 2 over 36, while P(Y equals 2) is 3 over 36. The conditional probabilities are therefore one-third and two-thirds, and E[X given Y equals 2] is 1 times one-third plus 2 times two-thirds, or 5 over 3.

Maria
For Y equals 3, the joint probabilities for X equals 1, 2, and 3 are 1, 1, and 3 over 36. Since P(Y equals 3) is 5 over 36, the conditional probabilities are one-fifth, one-fifth, and three-fifths. That makes E[X given Y equals 3] equal to 12 over 5.

Anna
The same calculation gives E[X given Y equals 4] as 22 over 7, E[X given Y equals 5] as 35 over 9, and E[X given Y equals 6] as 51 over 11. So the random variable E[X given Y] takes the values 1, 5 over 3, 12 over 5, 22 over 7, 35 over 9, and 51 over 11, depending on whether Y is 1, 2, 3, 4, 5, or 6.

Maria
To find the expectation of that new random variable, we weight each of those values by the probability of the corresponding maximum. The probabilities for Y are 1, 3, 5, 7, 9, and 11 over 36. The weighted sum simplifies to (1 plus 5 plus 12 plus 22 plus 35 plus 51) over 36, which is 126 over 36, or 3.5.

Anna
That matches E[X], since the first die is fair and its mean is (1 plus 2 plus 3 plus 4 plus 5 plus 6) over 6, also 3.5. This is not a coincidence. The law of total expectation says that the expectation of E[X given Y] is E[X].

Maria
Here’s the idea behind the proof. In the continuous case, we average the conditional expectation over all values y, weighting each one by its density f of y. Substitute the conditional expectation, which uses the joint density divided by f of y, and that f of y cancels. What remains is the integral of x times the joint density over x and y.

Anna
Now integrate over y first. The joint density integrated over y is the marginal density of X, so the expression becomes the integral of x times f of x, which is E[X]. The discrete proof follows the same logic with sums instead of integrals. And by the same result, E[E[Y given X]] equals E[Y].

Maria
For these dice, the mean of Y is 161 over 36: sum each possible maximum y times its probability, using probabilities 1, 3, 5, 7, 9, and 11 over 36. The law of total expectation says that averaging E[Y given X] must give that same value.

Anna
There’s a closely related identity for variance, often called the law of total variance: Var(X) equals E[Var(X given Y)] plus Var(E[X given Y)]. In words, the overall variance combines the average of the variance remaining after we know Y with the variance of the conditional means across different values of Y.

Maria
To see why it works, write Var(X given Y) as E[X squared given Y] minus the square of E[X given Y]. Then write Var(E[X given Y]) as the expectation of that squared conditional mean minus the square of its overall expectation. When we add the two expressions, the positive and negative terms involving the squared conditional mean cancel.

Anna
What remains is E[E[X squared given Y]] minus the square of E[E[X given Y]]. By the law of total expectation, those are E[X squared] and the square of E[X], respectively. Their difference is Var(X).

Maria
Next, consider how much probability can lie far from a chosen number. Knowing a random variable’s mean and variance doesn’t tell us its entire distribution. Different distributions can have the same expectation and variance, but Chebyshev’s inequality still gives us a general bound on how far the variable can be from its mean.

Anna
The more general statement is this: if E[(X minus C) squared] is finite and epsilon is positive, then P(|X minus C| greater than or equal to epsilon) is at most E[(X minus C) squared] divided by epsilon squared. Here C can be any real number.

Maria
The proof uses a simple comparison. On the event where |X minus C| is at least epsilon, its square divided by epsilon squared is at least 1. So the probability of that event, which is the expectation of its indicator, can’t exceed the expectation of the squared distance divided by epsilon squared.

Anna
Choose C to be the mean μ. Then E[(X minus μ) squared] is the variance, so we get P(|X minus μ| greater than or equal to epsilon) at most Var(X) over epsilon squared. If σ is the standard deviation and epsilon is k times σ, where k is positive, the bound becomes 1 over k squared.

Maria
That bound can be quite loose. For a uniform random variable on 0 to 1, the mean is one-half and the variance is one-twelfth, so the standard deviation is one over the square root of 12. Taking k equal to 2 gives a Chebyshev bound of one-quarter for the probability of being at least 2σ from the mean.

Anna
But 2σ is 1 over the square root of 3, about 0.58, while every value from 0 to 1 is within 0.5 of the mean, one-half. So the actual probability is zero. Zero is certainly no more than one-quarter, but this shows that Chebyshev’s inequality need not be a tight bound.

Maria
Markov’s inequality gives another useful bound. If h of X is nonnegative and its expectation exists, then P(h of X greater than or equal to epsilon) is at most E[h of X] over epsilon, for positive epsilon.

Anna
For the discrete proof, split the possible outcomes into the event A, where h of X is at least epsilon, and its complement. The expectation of h of X is at least the contribution from A. On A, each value of h of X is at least epsilon, so that contribution is at least epsilon times P(A). Rearranging gives Markov’s inequality.

Maria
A useful choice is h of X equal to |X| raised to r, with r positive and the rth absolute moment finite. Setting epsilon equal to k raised to r gives P(|X| greater than or equal to k) at most E[|X| raised to r] over k raised to r.

Anna
And choosing h of X to be (X minus μ) squared and epsilon to be k squared times σ squared gives P(|X minus μ| greater than or equal to kσ) at most 1 over k squared. That is exactly the centered Chebyshev bound, so Chebyshev’s inequality follows from Markov’s inequality.

Maria
The big picture is that conditional expectation averages conditional distributions, and averaging those conditional means recovers the original mean. Variance splits into average conditional uncertainty plus variation between conditional means. Then Markov and Chebyshev turn expectations and moments into bounds on tail probabilities. Next time, we’ll move on to the bivariate normal distribution.

Ask anything
We've read this whole study set, so questions about it get the best answers.