Solution.
Since f is monotone, it is continuous except at countably many points D, hence Borel. For each x∈D, define f+(x)=limy→x+f(y) and f−(x)=limy→x−f(y). By modifying f on a countable set, we may assume without loss of generality that f−(x)=f(x), i.e., f is left continuous. Then given x∈D, let
Ix=(f−(x),f+(x)]∖Ux,
where Ux={f+(x)} if f+(x)∈f(R) and ∅ otherwise.
We claim that f(R)c=⋃x∈DIx. It's clear that "⊇", since f is monotone and Ux handles the upper endpoint. Conversely, suppose y∈/f(R). Let x−=sup{x∣f(x)<y} and x+=inf{x∣f(x)>y}. We claim that x−=x+: otherwise, x−<x+, so let x∈(x−,x+). Since x>x−, this means f(x)≥y, and because x<x+, f(x)≤y, so f(x)=y, which is a contradiction. Thus, x=x−=x+, which means f−(x)≤y≤f+(x).
Since y∈/f(R), this means that f−(x)<y. On the other hand, if y=f+(x), then f+(x)∈/f(R)⟹Ix=(f−(x),f+(x)]. If y=f+(x), then y∈(f−(x),f+(x))⊆Ix. Hence, f(R)c=⋃x∈DIx. Thus, f(R)c is a countable union of Borel sets (intervals) hence Borel, which means that f(R) is also Borel.
Another important property is that f is injective after removing a countable set. Indeed, by monotonicity, f−1({y}) is either empty, a singleton, or a non-trivial interval. Let C be the set of y where f−1({y}) is an interval. By density, this contains a rational number r(y), and if y=z, then f−1({y})∩f−1({z})=∅, so r(y)=r(z), i.e., y↦r(y) is an injection, so C is countable.
Let F={A∣f(A) is Borel}. We will show that F is a σ-algebra containing the closed intervals.
Given [a,b], monotonicity of f implies
f([a,b])=[f(a),f(b)]∩f(R),
which is an intersection of Borel sets, so F contains closed intervals.
First, it's clear that ∅∈F. We also know that ⋃n=1∞f(An)=f(⋃n=1∞An) for any collection of sets. Thus, to show that F is a σ-algebra, we just need to show that it is closed under complements. Let A∈F so that
f(R)=f(A)∪f(Ac).
Notice that if y∈f(A)∩f(Ac), then there exist x=x′ so that f(x)=f(x′), so f=y on an interval containing x and x′. Thus, y∈C, so f(A)∩f(Ac) is at most countable which means
f(Ac)=f(A)c∪(f(A)∩f(Ac))
is Borel, so Ac∈F. Thus, F is a σ-algebra containing closed intervals, so F contains all Borel sets.