# $\int_\mathbb{R} y \left( \int_\mathbb{R} I_B(x) f_{X,Y}(x,y) \,dx \right) \, dy = \int_\Omega Y I_{X^{-1}(B)} \, dP \quad ?$

Suppose $X$ and $Y$ are two random variables defined on a probability space $(\Omega, \mathcal{F},P)$ with joint density function $f_{X,Y}$. For any $B \in \mathcal{B}(\mathbb{R})$, why is it that $$\int_\mathbb{R} y \left( \int_\mathbb{R} I_B(x) f_{X,Y}(x,y) \,dx \right) \, dy = \int_\Omega Y I_{X^{-1}(B)} \, dP \quad ?$$ Note: This is one step needed in my attempt to prove that the elementary definition and theorectical definition of $E(Y|X)$ agree a.e. after applying Fubini's Theorem.

Thanks!

-
The derivation here: math.stackexchange.com/questions/70402/… applies to $\mathbb{R}^2$ as well as $\mathbb{R}$. –  Byron Schmuland Nov 7 '11 at 17:49
@ByronSchmuland: Thanks! When proving that the elementary definition and theorectical definition of $E(Y|X)$ agree a.e., how is Fubini's Theorem used? Is it used to exchange the order of two integrals over $\mathbb{R}$, or go from iterated integrals both of which over $\mathbb{R}$ to an integral over $\mathbb{R}^2$? –  Ethan Nov 8 '11 at 3:51
I'm puzzled because the question I linked to has nothing to do with conditional expectation or Fubini's theorem. –  Byron Schmuland Nov 8 '11 at 14:18
@ByronSchmuland: Sorry, I wasn't clearer. I tried to prove that the elementary definition and theorectical definition of $E(Y|X)$ agree a.e.. My last comment was asking how Fubini't Theorem was used in proving it: "Is it used to exchange the order of two integrals over $\mathbb{R}$, or go from iterated integrals both of which over $\mathbb{R}$ to an integral over $\mathbb{R}^2$?" –  Ethan Nov 8 '11 at 16:11
Fubini's theorem will take you from the left hand side of Didier's equation to the left hand side of your equation. Is that what you mean? If not, I suggest that you rewrite your question, putting in more detail, and pointing out precisely which steps you need help with. That way you will get the benefit of the combined brainpower of the entire MSE community. –  Byron Schmuland Nov 8 '11 at 18:28

Because $\displaystyle\iint_{\mathbb R^2} \varphi(x,y)f_{X,Y}(x,y)\mathrm dx\mathrm dy=E(\varphi(X,Y))=\int_\Omega\varphi(X,Y)\mathrm d\mathrm P$ for the function $\varphi$ defined on $\mathbb R^2$ by $\varphi(x,y)=y\cdot[x\in B]$, as soon as $Y$ is integrable.