Every function on $\mathbb{R}^n$ that is continuous in each variable separately is Borel measurable.

I'm trying to solve exercise 2.11 from Folland's Real Analysis.

enter image description here

Firstly, how do we show that $f_n$ is Borel measurable on $\mathbb{R} \times \mathbb{R}^k$? I really have no idea how to show this when we have separately Borel measurable functions.

Next, I can't show that $f_n\to f$ pointwise.

For any $(x,y)\in \mathbb{R}\times \mathbb{R}^k$,

$f_n(x,y)=n[f(a_{i+1},y)(x-a_i)-f(a_i,y)(x-a_{i+1})]=n[x[f(a_{i+1},y)-f(a_i,y)]+\frac{1}{n}[f(a_i,y)-f(a_{i+1},y)]]$,

but because of the $n$ outside the bracket, I can't show that this converges to $f$. How can I show this? Also, how can I conclude from this fact that every function on $R^n$ that is continuous in each variable separately is Borel measurable?

I would greatly appreciate any suggestions, hints, or solutions.


Note that if $t=\frac{x-a_i}{a_{i+1}-a_i}$, then $0\leq t\leq 1$, and $1-t=-\frac{x-a_{i+1}}{a_{i+1}-a_i}$. Hence $f_n(x,y)=tf(a_{i+1},y)+(1-t)f(a_i, y)$. Hence $f_n(x,y)$ is in the interval with endpoints $f(a_i,y)$ and $f(a_{i+1},y)$. As $a_i$ and $a_{i+1}\to x$ as $n\to +\infty$, by the hypothesis we get $f_n(x,y)\to f(x,y)$.

EDIT:

Put $b_i={\rm Min}\{ f(a_i,y), f(a_{i+1},y)\}$ and $b_i={\rm Max}\{ f(a_i,y), f(a_{i+1},y)\}$. By the expression $f_n(x,y)=tf(a_{i+1},y)+(1-t)f(a_i,y)$, we have $b_i\leq f_n(x,y)\leq c_i$. Now, when $n\to \infty$, $b_i$ and $c_i \to f(x,y)$, this show $f_n(x,y)\to f(x,y)$.

To see that $f_n$ is Borel-mesurable, note that $f_n$ is Borel-mesurable on each of the sets $[i/n,(i+1)/n]\times \mathbb{R}^k$