# $\sigma(Y)$-measurability in conditional expectation computation formulas

Let $$X$$ and $$Y$$ be $$1$$ dimensional random variables such that $$(X,Y)$$ has density $$g_{(X,Y)}$$. Let $$h(x):\mathbf{R}\to \mathbf{R}$$ be a borel function such that $$h(X)$$ is integrable. Then the conditional expectation $$E(X \mid Y)$$ can be written as a function $$\eta(Y)$$, where $$\eta:y \mapsto \int\limits_{\mathbf{R}} h(x) g_{X \mid Y}(x, y)\ dx,$$ where $$g_{X \mid Y}(x, y) = \begin{cases} \dfrac{g_{(X, Y)}(x, y)}{g_Y(x)} &\text{ if } g_Y(x) > 0,\\ 0 &\text{ otherwise} \end{cases}$$ Why is $$\eta(Y)$$ $$\sigma(Y)$$-measurable? Why does $$\int\limits_{\mathbf{R}} h(x) g_{X \mid Y}(x, y)\ dx$$ even exist? Does it exist for every $$y$$ or just almost everywhere?

I'v read that $$\sigma(Y)$$-measurability follows from Fubini's theorem. I suppose it means that we use Fubini to a function $$\phi:(x,y) \mapsto h(x) g_{X \mid Y}(x, y)$$ and conclude that $$\eta(y)$$ is a borel function. But to use Fubini we need to know that $$\phi$$ is both borel and integrable (since $$h(x)$$ doesn't have to be positive). I see why it is borel, but not why it is integrable.

I'v got similar problem with the case of $$X$$,$$Y$$ being discrete. Denote $$S_X$$ set of atoms of $$X$$ and $$P_X(x)=P(X=x)$$. Why is $$\sum_{x\in S_X} \frac{P_{(X,Y)}(x,Y)}{P_Y(Y)}$$ (I guess we put $$0$$ when $$P(Y=y)=0$$) $$\sigma(Y)$$-measurable?

Any help would be appreciated. I'm just starting with conditional expectation.

First off there's a typo in your definition of the $$g_{X \mid Y}(x, y)$$. It should be $$g_{X \mid Y}(x, y) = \begin{cases} \dfrac{g_{(X, Y)}(x, y)}{g_Y(y)} &\text{ if } g_Y(y) > 0,\\ 0 &\text{ otherwise} \end{cases}$$ Let $$g_X$$ denote the marginal density of $$X$$: $$g(x)=\int g(x,y) dy$$. Since $$\int \int |h(x) g(x,y)| dx dy = \int |h(x)| \int g(x,y) dy dx = \int |h(x)|g_X(x) dx =E(|h(X)|)<\infty$$ the function $$(x,y)\mapsto h(x) g(x,y)$$ is integrable.