Monotone functions and Borel sets I'm studying measure theory and two question came to my mind:

  
*
  
*If $f:\mathbb{R}\to\mathbb{R}$ is monotone and $B\subseteq\mathbb{R}$ is borel, is the image $f(B)$ borel?
  
*If $f:\mathbb{R}\to\mathbb{R}$ is a monotone function (say, non-decreasing), does there exist a sequence of continuous functions $f_n:\mathbb{R}\to\mathbb{R}$ converging pointwise to $f$?
  

Here's the motivation for those questions: Let $(X,M)$ and $(Y,N)$ be measure spaces.


*

*It's known that if $\mu$ is a measure on $(X,M)$ and $f:X\to Y$ is measure, then we have the pushforward measure $f_*\mu(A)=\mu(f^{-1}(A))$ on $(Y,N)$. What if we were to define a "pullback measure"? Given a function $f:X\to Y$ such that $f(M)\subseteq N$ (i.e. $f$ maps measurable sets to measurable sets) and a measure $\nu$ on $N$, the natural formula would be $f^*\nu(A)=\nu(f(A))$. So we ask if is there a good amount of functions which map measurable sets to measurable sets in $\mathbb{R}$, and monotone functions seem like good candidates (for strictly monotone, continuous functions, the result is valid and there are several answers on the web).

*If this were true, maybe we could use some convergence argument to solve the problem above.
 A: The answer to #1 is yes.
First note that if $f$ is monotone, it is Borel.  (The sets $(a, \infty)$ generate the Borel $\sigma$-algebra, and $f^{-1}((a, \infty))$ is Borel for each $a$ because it is of the form $(b, \infty)$ or $[b, \infty)$ (for increasing functions) or $(-\infty, b)$ or $(-\infty, b]$ (for decreasing functions).)  
Now for each $y$, $f^{-1}(\{y\})$ is either empty, a point, or a nontrivial interval.  Let $C$ be the set of all $y$ such that $f^{-1}(y)$ is a nontrivial interval.  Since each interval contains a rational, $C$ is countable.  Let $D = f^{-1}(C)$; note that $D$ is Borel.
If $B$ is an arbitrary Borel set, we have $f(B) = f(B \cap D) \cup f(B \setminus D)$.  Now $f(B \cap D) \subset C$, hence it is countable and hence Borel.  So it suffices to show that $f(B \setminus D)$ is Borel.
On $D^c$, and hence on $B \setminus D$, $f$ is injective.  Now it is a theorem of descriptive set theory that an injective Borel function on a Borel subset of a Polish space has a Borel image.  (See for instance Theorem 4.5.4 of Srivastava, A Course on Borel Sets.)  But $B \setminus D$ is Borel, so $f(B \setminus D)$ is also Borel and we are done.
A: Here's a self-contained answer to #1.
First note/recall that any union of half-open intervals of the form $[a, b)$ is Borel. To see this, suppose that we have such a collection $[a_{x}, b_{x})$ for $x$ in some index set $X$. The set $U = \bigcup_{x\in X}(a_{x}, b_{x})$ is open, so it suffices to see that the set $Y = \{ a_{x} : x \in X\} \setminus U$ is countable.
To see that $Y$ is countable, note that we can pick for each $a \in Y$ a rational number $q_{a}$ which is in $(a_{x}, b_{x})$ for some $x \in X$ with $a_{x} = a$. Then if $x, y$ in $X$ are such that $a_{x}, a_{y}$ are in $Y$ with $a_{x} < a_{y}$, $q_{a_{x}} < b_{x}$ and $q_{a_{y}} < b_{y}$, it must be that $b_{x} \leq a_{y}$, which means that $q_{a_x} < b_{x} \leq a_{y} < q_{a_y}$.
It follows that that any union of half-open intervals is Borel.
Now let $B \subseteq \mathbb{R}$ be Borel and let $f \colon B \to \mathbb{R}$ be an increasing function. Let $E$ be the set of $x \in \mathbb{R}$ for which the set $\{ y \in B : f(y) \leq x\}$ is nonempty and bounded above. If $B$ is bounded above then $E$ is the union of all intervals of the form $[f(y), \infty)$ for $y \in B$. Otherwise, $E$ is the union of all intervals of the form $[f(y), f(z))$ for all $y \leq z$, both in $B$. Either way, $E$ is Borel.
Define $g$ on $E$ by letting $g(x) = \sup\{ y\in B : f(y) \leq x\}$. Then $g$ is an increasing function with Borel domain, so Borel, so $g^{-1}[B]$ is Borel.
To see that $f[B]$ is Borel, it suffices to see that $g^{-1}[B] \setminus f[B]$ and $f[B] \setminus g^{-1}[B]$ are both Borel.
To see the former, suppose that $x$ is in $g^{-1}[B] \setminus f[B]$. Then there exists a $z \in B$ such that $\sup\{ y\in B : f(y) \leq x\} = z$, but
$f(z) \neq x$. If $f(z) < x$, then everything in the interval $(f(z), x]$ is in $g^{-1}[B] \setminus f[B]$. If $f(z) > x$, then everything in the interval $[x, f(z))$ is in $g^{-1}[B] \setminus f[B]$. This shows that $g^{-1}[B] \setminus f[B]$ is a union of half-open intervals.
To see the latter, we show that $f[B] \setminus g^{-1}[B]$ is countable. If $x \in f[B] \setminus g^{-1}[B]$, then there is a $z \in B$ such that $f(z) = x$, but $g(x) \neq z$, which means that there is a $w > z$ in $B$ such that $f(w) = x$. So the members of $f[B] \setminus g^{-1}[B]$ induce a collection of pairwise disjoint nonempty open intervals $(z, w)$, which means that there are only countably many of them.
