This fact comes from *Concentration of Measure for the Analysis of Randomised Algorithms * by Dubhashi and Panconesi (page 76, equation 5.2).
Let $X$ and $Y$ be two discrete random variables and two arbitrary functions $f$ and $g$. Then $$E[E[f(X)g(X,Y) | X]] = E[f(X)E[g(X,Y)|X]]$$
This is how far I got in the proof:
- By law of iterated expectation $E[X] = E[E[X|Y]]$ we have that: $$E[E[f(X)g(X,Y) | X]] = E[f(X) \cdot g(X,Y)]$$
Now I would like to apply something the $E[XY] = E[X] \cdot E[Y]$ which only holds for two independent variables $X$ and $Y$. But I don't see $f(X)$ and $g(X,Y)$ as independent. Am I missing something here?
If they were independent I'd continue:
- $E[f(X) \cdot g(X,Y)] = E[f(X)] \cdot E[g(X,Y)]$
- Re-apply law of iterated expectation: $$E[f(X)] \cdot E[g(X,Y)] = E[f(X)] \cdot E[E[g(X,Y)|X]] = E[f(X) \cdot E[g(X,Y)|X]] $$ $\square$
Could someone assist me in my thinking here?
What is used is that $$ \mathbb E\left[f(X)g\left(X,Y\right) | X\right]=f(X)\mathbb E\left[g\left(X,Y\right) | X\right], $$ known as the pull-out property of the conditional expectation.