TITLE: $f: \mathbf{R} \rightarrow \mathbf{R}$ monotone increasing $\Rightarrow$ $f$ is measurable
QUESTION [21 upvotes]: Problem. Let $f: \mathbf{R} \rightarrow \mathbf{R}$ be a monotone increasing function. Show that $f$ is measurable. 
Solution.
We know that the set of discontinuites of any monotone increasing function $f$ is measure zero (since it is at most countable). We define a continuous function $g$ such that $g(x)=f(x)$ except the discontinuous points of $g$. Then $g(x)=f(x)$ almost everywhere. Note that any continuous function $g: \mathbf{R}\rightarrow \mathbf{R}$ is measurable. Also note that if $g$ is measurable and $f=g$ almost everywhere, then $f$ is measurable. Hence we conclude that $f$ is measurable.

Is my solution correct? Thanks.

REPLY [13 votes]: It is true that $f$ is continuous almost everywhere, but it is not true that there exists a continuous function $g:\mathbb R\to\mathbb R$ such that $f=g$ almost everywhere, unless $f$ is already continuous, as Jacob said in a comment.  Note that the left-hand and right-hand limits of $f$ exist everywhere, and if they are not equal for $f$, then they cannot be equal for any function equal to $f$ almost everywhere.  E.g., the characteristic function of $[0,\infty)$ is monotone and not equal almost everywhere to a continuous function.  
(The characteristic function of the rationals is equal almost everywhere to a continuous function, but is continuous nowhere.  This shows from the other direction why "continuous almost everywhere" and "equal almost everywhere to a continuous function" are very different.)
Modifying your work to something correct takes more effort than the simpler and clearer solution given by Cass.  Let $D$ be the set of discontinuities of $f$.  Then $D$ is countable, hence of measure $0$.  The restriction $f|_D$ is measurable on $D$ because every subset of $D$ is measurable, and the restriction $f|_{\mathbf R\setminus D}$ is measurable on $\mathbf R\setminus D$ because it is continuous.  You can show this implies that $f$ is measurable.