Define the function $g (y) = E[f(X,y)]$. Show that $g$ is Borel-measurable, and that $E[f (X,Y)|Y=y] = g(y)$ The original question is the number 10.6 of this pdf:
Let $f:\mathbb{R}^2\rightarrow \mathbb{R}$ be a bounded Borel-measurable function, and let $X$, and $Y$ be independent random variables. Define the function $g:\mathbb{R}\rightarrow \mathbb{R}$ by $g(y) = E[f(X,y)]$.
Show that the function g is Borel-measurable, and that $E[f(X,Y)|Y=y] = g(y)$.
This is what I tried:
$$g(y) = \int_{\Omega}f(X,Y)1_{\{Y = y\}}dP = \int_{\{Y = y\}}f(X,Y)dP$$
I know that $\{Y = y\} \in \sigma(Y)$ and it is a set where $Y$ is constant, so it follows:
$$g(y) = \int_{\{Y = y\}}f(X,Y)dP = E[f(X,Y)|Y=y]$$
Proving that $g$ is Borel-measurable:
I will aproximate $f(X,y)$ by simple Borel-medible functions. The sets $A1, A2, A3 ... An$ are a partition of $\{Y=y\}$:
$$f(X,y) = \lim_{n\rightarrow\infty}\sum_{i}^{n} f_i(X,y)1_{Ai}$$
$$g(y) = \int_{\{Y=y\}}[\lim_{n\rightarrow\infty}\sum_{i}^{n} f_i(X,y)(1_{Ai})]dP = \lim_{n\rightarrow\infty}\sum_{i}^{n} f_i(X,y)P(Ai)$$
The Lebesgue integral is a lineal operation on Borel measurable functions, so it follows that $g$ is Borel measurable.
I don't know if I'm right, and I don't know why it is necesary the independence of X and Y.
 A: You need only consider function $f$ of the form
\begin{align*}
f(x, y) = \pmb{1}_{(x, y) \in A_1 \times A_2},
\end{align*}
where $A_1$ and $A_2$ are Borel sets. The general case can be proved by approximation of linear combinations of such functions.
By definition, $E(f(X, Y) \mid Y=y) = h(y)$ is a Borel measurable function such that, for any Borel set $A$,
\begin{align*}
\int_{Y \in A} f(X, Y) dP = \int_A E(f(X, Y) \mid Y=y) P_Y(dy),
\end{align*}
where $P_Y(dy)$ is the Lebesgue-Stieltjes measure generated by the distribution function of $Y$, that is $P_Y(A) = P(Y \in A)$. Then
\begin{align*}
\int_A h(y) P_Y(dy) &=\int_{Y \in A} f(X, Y) dP\\
&= E\big(\pmb{1}_{X \in A_1} \pmb{1}_{Y \in A \cap A_2} \big)\\
&= E\left( \pmb{1}_{X \in A_1}\right)E\left( \pmb{1}_{Y \in A \cap A_1}\right)\\
&= P(X \in A_1)P(Y \in A \cap A_1).
\end{align*}
On the other hand, 
\begin{align*}
g(y) &= E(f(X, y)) \\
&=\pmb{1}_{y \in A_2} P(X \in A_1).
\end{align*}
Then,
\begin{align*}
\int_A g(y) P_Y(dy) &=\int_A \pmb{1}_{y \in A_2} P(X \in A_1) P_Y(dy)\\
&= P(X \in A_1) \int_A \pmb{1}_{y \in A_2}P_Y(dy)\\
&= P(X \in A_1)P(Y \in A \cap A_1).
\end{align*}
Therefore, $h(y)=g(y)$, that is,
\begin{align*}
E(f(X, Y) \mid Y=y) = E(f(X, y)).
\end{align*}
