Let $X$ and $Y$ be random variables and let $g:\mathbb R^2 \to \mathbb R$ be a non-negative measurable function. If you like assume that $g(X,Y)$ has finite expectation. Let $$E_X(g(X,Y))=\int_{\mathbb R} g(x,Y)dP_X(x),$$ where $P_X=P\circ X^{-1}$ is the distribution of $X.$
I am interested in the relationship between $E_X(g(X,Y))$ and $E(g(X,Y)|Y).$ I suspect that the following holds:
If $X$ and $Y$ are independent then $$E_X(g(X,Y))=E(g(X,Y)|Y).\tag{*}$$
Since I don't have a lot of experience writing proofs with measure-theoretic arguments it would be nice if someone with more experience could have a look at this proof I wrote:
Proof.
In order to show $(*)$ we need to verify
- $E_X(g(X,Y))$ is $\sigma(Y)$-measurable
- $\forall A\in\sigma(Y)$ we have $$E[1_A E_X(g(X,Y))] = E[1_A g(X,Y)].$$
Regarding 1.:
It is $$E_X(g(X,Y))=\int_{\mathbb R} g(x,Y)dP_X(x)=h(Y),$$ where $h(y)=\int_{\mathbb R} g(x,y)dP_X(x)$ is a measurable function. Hence $E_X(g(X,Y))$ is $\sigma(Y)$-measurable.
Regarding 2.:
Let $A\in\sigma(Y).$ Note that $1_A$ can be written as $1_A=f(Y)$ for some measurable function $f.$ Moreover, since $X$ and $Y$ are independent, it holds that $$P_{(X,Y)}=P_{X}\otimes P_{Y}.$$ Now write \begin{align} E[1_A g(X,Y)] &= \int_\Omega 1_A g(X,Y) dP\\ &= \int_\Omega f(Y) g(X,Y) dP\\ &= \int_{\mathbb R^2} f(y) g(x,y) dP_{(X,Y)}(x,y)\\ &= \int_{\mathbb R^2} f(y) g(x,y) d(P_{X}\otimes P_{Y})(x,y)\\ &= \int_{\mathbb R}\int_{\mathbb R} f(y) g(x,y) dP_{X}(x) dP_{Y}(y) \quad\text{by Fubini}\\ &= \int_{\mathbb R}f(y) \int_{\mathbb R} g(x,y) dP_{X}(x) dP_{Y}(y)\\ &= \int_{\mathbb R}f(y) h(y) dP_{Y}(y)\\ &= \int_\Omega f(Y) h(Y) dP\\ &= \int_\Omega 1_A E_X(g(X,Y)) dP\\ &= E[1_A E_X(g(X,Y))].\\ \end{align}