If $B\subset\mathbb{R}$ is a Borel set and $f:B\to\mathbb{R}$ is an increasing function then $f(B)$ is a Borel set I am trying to prove the following statement:
"If $B\subset\mathbb{R}$ is a Borel set and $f:B\to\mathbb{R}$ is an increasing function then $f(B)$ is a Borel set"
but I have only managed to prove the easier statement
"If $B\subset\mathbb{R}$ is a Borel set and $f:\mathbb{R}\to\mathbb{R}$ is a strictly increasing function then $f(B)$ is a Borel set"
My proof (of the easier statement):
By Inverse function $f^{-1}:f(\mathbb{R})\to\mathbb{R}$ of a strictly increasing function $f:\mathbb{R}\to\mathbb{R}$ is continuous we have that $f^{-1}:f(\mathbb{R})\to\mathbb{R}$ is continuous so $(f^{-1})^{-1}(\mathbb{R})=f(\mathbb{R})$ is open hence Borel thus $f^{-1}$ is a continuous function defined on a Borel set so it is Borel measurable which implies that $(f^{-1})^{-1}(B)=f(B)$ is a Borel set, as desired. $\square$

I would like to prove the initial statement but I have been stuck for a while so I would appreciate an hint about how to tackle its proof, thanks.
 A: Here is a self-contained proof. We first note that it suffices to prove:

Claim. Let $f : \mathbb{R} \to \mathbb{R}$ be non-decreasing. Then for each Borel set $B \subseteq \mathbb{R}$, the set $f(B)$ is also Borel.

To prove this, let $\mathcal{F}$ be the set of all Borel sets $B$ for which $f(B)$ is also Borel. Then we check the following properties of $\mathcal{F}$:
1. $\mathcal{F}$ contains any open intervals.
Indeed, let $I$ be an open interval, and consider any connected component $C$ of $\mathbb{R}\setminus f(I)$.1) We show that $C$ cannot be a singleton. Otherwise, write $C = \{y\}$. Then we can find sequences $(a_n)_{n=1}^{\infty}$ and $(b_n)_{n=1}^{\infty}$ in $I$ such that
\begin{gather*}
f(a_1) < f(a_2) < \cdots < y < \cdots < f(b_2) < f(b_1), \\
\lim f(a_n) = y, \qquad \lim f(b_n) = y.
\end{gather*}
This in particular forces that $a_1 < a_2 < \cdots < b_2 < b_1$, and so, both $a = \lim a_n$ and $b = \lim b_n$ exist in $I$ and $a \leq b$. Moreover, $y \leq f(a) \leq f(b) \leq y$, and so, $f(a) = f(b) = y$. This contradicts that $y$ lies in the complement of $f(I)$, and so, $C$ is not singleton as required.
Now this tells that $\mathbb{R}\setminus f(I)$ is a disjoint union of nondegenerate intervals, and since there are at most countably many such intervals, their union is a Borel set. Therefore $f(I)$ is also a Borel set.
2. If $A_1, A_2, \dots$ are in $\mathcal{F}$, then both $\cup_n A_n$ and  $f(\cup_n A_n) = \cup_n f(A_n)$ are Borel sets, hence $\cup_n A_n \in \mathcal{F}$.
3. If $A \in \mathcal{F}$, then $\mathbb{R}\setminus A \in \mathcal{F}$.
Indeed, denote by $D$ the set of values in $\mathbb{R}$ which are attained by $f$ at two or more points, i.e.,
$$ D = \{y \in \mathbb{R} : \#f^{-1}(\{y\}) \geq 2. \} $$
For each $y \in D$ and for each $a, b \in f^{-1}(\{y\})$ with $a < b$, we find that $[a, b] \subseteq f^{-1}(\{y\})$. This tells that each $f^{-1}(\{y\})$ is a nondegenerate interval, and so, $D$ can contain at most countably many points. Then by noting that $f(A) \cap f(\mathbb{R}\setminus A) \subseteq D$, we have
$$ f(\mathbb{R})\setminus f(A) \subseteq f(\mathbb{R}\setminus A) \subseteq (f(\mathbb{R})\setminus f(A)) \cup D. $$
In particular, $f(\mathbb{R}\setminus A) = (f(\mathbb{R})\setminus f(A)) \cup \tilde{D}$ for some subset $\tilde{D}$ of $D$. Since all of $f(\mathbb{R})$, $f(A)$, and $\tilde{D}$ are Borel sets, $f(\mathbb{R}\setminus A)$ is also a Borel set and hence $\mathbb{R}\setminus A \in \mathcal{F}$ as desired.
Conclusion. The above observations tell that $\mathcal{F}$ is a $\sigma$-algebra containing all the open intervals, and hence, must contain any Borel sets. Therefore the proof is complete. $\square$

1) If you are not familiar with the notion of connect components, then here is an alternative way of explaining this for subsets of $\mathbb{R}$. Let $E \subseteq \mathbb{R}$, and define the relation $\sim$ on $E$ as follows:

*

*For each $x, y \in E$, we write $x \sim y$ if and only if $\{tx + (1-t)y : t \in [0, 1]\} \subseteq E$.

In other words, $x \sim y$ if and only if either $x = y$ or the closed interval between $x$ and $y$ lie in $E$. Then it is not hard to check that

*

*$\sim$ is an equivalence relation on $\mathbb{R}$, and

*each equivalence class of $\sim$ is either a singleton or an interval.

