# Conditional Expectation with two random variables

I know $$E[E[x\mid y]] = E[x]$$ by smoothing property of the expectations. Then, I came across the following equation:

In this equation we have:

$$E[E[x\mid A,Z]\mid Z] = E[x\mid Z]$$

I try to convince myself that the above formula is correct and tried this:

$$E[E[\underbrace{x}_{x\mid A}|\underbrace{y}_Z]\mid Z] = E[\underbrace{x}_{x\mid A}\mid Z] = E[x\mid A,Z]$$

What is wrong with the above equation? Furthermore, I do not understand how you make this transition:

$$E[E[x\mid A,Z]\mid Z] = E[x\mid A,Z]\Pr[A\mid Z]$$

You can see your first transition is wrong because the right-hand side is a function of $$A$$ and $$Z$$ and the left-hand side is a function only of $$Z$$. That suggests the second equality is where the problem happens, and it is.

In $$E[ E[x|A] |Z]$$, the inner random variable is a function of $$A$$, and the outer expectation gives you the expected value of that function of $$A$$ conditional on $$Z$$, which is a function only of $$Z$$, with $$A$$ smoothed out by averaging.

In fact, the equation $$E[E[x\mid A,Z] \mid Z] = E[x\mid Z]$$ is just another case of the smoothing rule (law of total expectation, tower rule). Wikipedia covers it here

Your second transition is wrong, so that's why you don't understand how to make it. As a counterexample, suppose $$A$$, $$X$$, and $$Z$$ are all independent, and $$P(A)<1$$. Because of independence, $$E[E[x|A,Z]|Z]=E[x|A, Z]=E[x],$$ but $$E[x|A, Z]\Pr[A|Z]= E[x]P(A),$$ which is smaller than $$E[x].$$

The equation in the image (which wasn't there when I first answered the question) makes it clearer what the issue is. They have $$E[E[x|A,Z]|Z]=\sum_{A_i} E[x|A, Z]P[A_i|Z]$$ What they mean by this is that $$A_i$$ are the possible value of $$A$$. In the original source they say

The summation is over all events Ai in the set A of M mutually exclusive and exhaustive association events.

Without $$Z$$ it would look like $$E[E[x|A]]=\sum_{A_i} E[x|A]P[A_i]$$ which is just the law of total expectation applied to the mutually exclusive and exhaustive events $$A_i$$

They have the same thing, only with everything conditioned on $$Z$$.

• In fact the second transition is not my derivation, it is directly taken from the paper. Your argument seems logical to me but the authors stated it like this: ieeexplore.ieee.org/document/5338565, Equation (1), page 84.
– eet
Jun 5, 2020 at 18:53
• What they have is $\sum_{A_i} E[X|A,Z_i]\Pr(A_i|Z)$ -- as you now have in the question but didn't before. That is correct Jun 5, 2020 at 22:28
• Here is a detailed discussion on this topic: stats.stackexchange.com/questions/95947/… If anyone somehow came across this question, I suggest you to check it.
– eet
Jun 6, 2020 at 8:50