Let $f: [0,1]\times [0,1]\to\mathbb R$ satisfy:
(i) for each $x\in [0,1]$, the function $y\mapsto f(x,y)$ is Riemann integrable on $[0,1]$; and
(ii) for each $y\in [0,1]$, the function $x\mapsto f(x,y)$ is Borel measurable.
Show that the function $g(x):=\int_0^1f(x,y)dy$ is Borel measurable.
(Note: In general, $f$ will not be Borel measurable as a function on $[0,1]\times [0,1].$)
My attempt:
By the definition of Borel measurable, we need to show that for every open set $U$ in $\mathbb R^1$, $$g^{-1}(U)=\{x\in [0,1]:g(x)=\int_0^1f(x,y)dy\in U\}$$ is a Borel set in $[0,1]$. How can we use (ii)? $f(x,y)$ is Borel measurable with regard to $x$ for every fixed $y$, but now $y$ is a variable in the integral and we are no longer to directly quote the measurablity of $f(x,y)$. How to move on?
Hint: $g$ is the pointwise limit of a sequence of Riemann sums
$$g_n(x) = \frac{1}{n} \sum_{k=1}^n f(x, k/n) $$