TITLE: Is every Lebesgue measurable function on $\mathbb{R}$ the pointwise limit of continuous functions?
QUESTION [54 upvotes]: I know that if $f$ is a Lebesgue measurable function on $[a,b]$ then there exists a continuous function $g$ such that $|f(x)-g(x)|< \epsilon$ for all $x\in [a,b]\setminus P$ where the measure of $P$ is less than $\epsilon$. 
This seems to imply that every Lebesgue measurable function on $\mathbb{R}$ is the pointwise limit of continuous functions.  Is this correct?

REPLY [4 votes]: This is a comment adding to the discussion following the selected answer but it's a long comment, so I'm putting it here.
OP asked this second question, "can I conclude that every Lebesgue measurable function is the the pointwise limit of continuous functions a.e. ?"
Remark 0. A measurable function defined on the whole real line can be transformed into one that is defined on just the open interval (0,1), by mapping the domain $\mathbb R$ to the new domain (0,1). Therefore we only need to consider measurable functions defined on intervals.
Remark 1. Given a sequence of functions $f_n$ on $I = [a,b]$ such that it gets closer and closer to $f$ in the sense that $|f_n(x) - f(x)| < \frac{1}{n}$ holds for all $x$ on $I$ minus a set of measure $< \frac{1}{n}$, it does NOT follow that $f$ is the a.e. pointwise limit of $f_n$. 
Remark 2. Given a sequence of functions $f_n$ on $I = [a,b]$ such that it gets closer and closer to $f$ in the sense that $|f_n(x) - f(x)| < 2^{-n}$ holds for all $x$ on $I$ minus a set of measure $< 2^{-n}$, it DOES follow that $f$ is the a.e. pointwise limit of $f_n$. This is an easy consequence of Borel-Cantelli lemma..
Borel-Cantelli lemma on $\mathbb R$: If $E_n$ is a sequence of (measurable) subsets of $\mathbb R$ with rapidly decreasing measure in the sense that $\sum_n \lambda(E_n) < \infty$, then for all $x$ except on a null set, $x$ belongs to $E_n$ for only finitely many values of $n$.
Proof: By abuse of notation, if we write $E_n$ to also mean its indicator function, and we consider the function $\sum E_n$. The integral of this function is finite, therefore the function is a.e. finite.
To prove Remark 2, just set $E_n$ to be the exception set of measure $< 2^{-n}$.
See Convergence in measure - Wikipedia, the free encyclopedia
Remark 3. If the sequence of functions $f_n$ is such that $|| f_n - f ||_1 < 2^{-n}$, then it also follows that $f$ is the a.e. pointwise limit of $f_n$. (Proof: To show that the measure of $E_n$ = $\{x \in I : |f_n(x)-f(x)| \ge \epsilon \}$ is rapidly decreasing, use Markov's inequality.) Now you see there's a pattern. It's that fast convergence implies a.e. pointwise convergence.
Remark 4. One might say that Remark 3 answers the second question only for $L^1$ functions, but any measurable function can be transformed into a bounded function by transforming the codomain of $(-\infty, +\infty)$ to the bounded interval $(-1,1)$, and the second problem is invariant under this transform.
Remark 5. If we define $f_n$ to be the convolution of $f$ with the indicator function of $[-\frac{1}{n}, +\frac{1}{n}]$ times $2n$, then $f_n$ is a sequence of continuous functions converging to $f$ a.e. if $f$ is integrable. See Lebesgue differentiation theorem.
Remark 6. The second principle from Littlewood's three principles of real analysis says that any measurable function on I is approximately continuous, and Luzin's theorem is an instance of that principle, but I have always felt that other instances such as "Any measurable function on I can be approximated by continuous functions in the sense of convergence in measure" or "Any measurable $L^1$ function on I can be approximated by continuous functions in the sense of $L^1$ distance." to be better instances because they are easier to work with. Easier to remember as well.