Is every Lebesgue measurable function on $\mathbb{R}$ the pointwise limit of continuous functions? 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? 
 A: Perhaps this would be a useful place to put a LaTeX'ed version of another old (17 July 2005) sci.math post of mine. What follows is an expository essay on Luzin's Theorem.
http://groups.google.com/group/sci.math/msg/680691c6eeb50b91
$\lambda$ denotes Lebesgue measure
LUZIN'S THEOREM (no frills version): Let $f:{\mathbb R} \rightarrow {\mathbb R}$ be measurable and $\epsilon > 0$. Then there exists a measurable set $E$ such that $\lambda({\mathbb R}-E) < \epsilon$ and the restriction of $f$ to $E$ is a continuous function from $E$ into $\mathbb R.$
Note that we're talking about the restriction of $f$ to $E$ being continuous, not $f$ itself being continuous at each point of $E$. The characteristic function of the rationals is not continuous at any point, but after the removal of just countably many points (thus, "$\lambda({\mathbb R}-E) < \epsilon$" is satisfied in a very strong way), we get a constant function (thus, a function that is continuous in a very strong way).
FRILL 1: In the above, we can choose $E$ to be closed. In fact, we can choose $E$ to be a perfect nowhere dense set, and I believe this was the form it was originally proved.
FRILL 2: In Frill 1 we can find a continuous $g:{\mathbb R} \rightarrow {\mathbb R}$ such that $g(x) = f(x)$ for all $x \in E$. This is because we can extend any continuous function defined on a closed subset of $\mathbb R$ to a continuous function defined on all of $\mathbb R$ (the Tietze extension theorem for functions defined on $\mathbb R$).
REMARK 1: Luzin's theorem fails for $\epsilon = 0$. (Consider the characteristic function of a perfect nowhere dense set with positive measure.)
REMARK 2: Any function $f:{\mathbb R} \rightarrow {\mathbb R}$ (not assumed measurable) such that Luzin's theorem holds for all measurable sets $E$ (or even just all perfect nowhere dense sets $E$) must be measurable. That is, the converse of Luzin's theorem holds, and hence the "Luzin property" characterizes the measurability of functions.
NEAT APPLICATION: If $f:{\mathbb R} \rightarrow {\mathbb R}$ is unbounded on every set of positive measure (or even on every perfect set of positive measure), then $f$ is not measurable. Note that being unbounded on every interval implies being discontinuous at every point. (Hence, no function unbounded on every interval can be Baire $1$. However, there are Baire $2$ functions that are unbounded on every interval.)
Incidentally, Henry Blumberg proved in 1922 that, given an arbitrary $f:{\mathbb R} \rightarrow {\mathbb R}$, there exists a countable dense subset $D$ of $\mathbb R$ such that the restriction of $f$ to $D$ is continuous (Blumberg, "New properties of all real functions", Transactions of the American Mathematical Society 24 (1922), 113-128). In particular, there exists an infinite subset $D$ such that the restriction of $f$ to $D$ is continuous. On the other hand, Sierpinski and Zygmund proved in 1923 that there exists a function $f:{\mathbb R} \rightarrow {\mathbb R}$ such that every restriction of $f$ to a set of cardinality $c$ is discontinuous ("Sur une fonction qui est discontinue sur tout ensemble de puissance du continu", Fundamenta Mathematicae 4 (1923), 316-318).
APPLICATION OF THE APPLICATION: One can show that any nonlinear function satisfying $f(x+y) = f(x) + f(y)$ for all $x,y \in {\mathbb R}$ is unbounded in every interval. Using the fact that if $E$ has positive measure, then $\{x-y: x,y \in E\}$ contains an interval, it is not difficult to now show that any nonlinear additive function is unbounded on every set of positive measure, and hence is nonmeasurable. In fact, any such function will also majorize every measurable function on every set of positive measure. (Being unbounded just means it majorizes every constant function.)
I pointed out above that Luzin's theorem fails if $\epsilon = 0.$ However, if we weaken "continuous" to "Baire $1$" (a pointwise limit of continuous functions), then we can get an $\epsilon = 0$ version. Although we can't get $E$ to be closed (see below), we can still get $E$ to be $F_{\sigma}$ (a countable union of closed sets).
BAIRE $1$ VERSION OF LUZIN'S THEOREM: Let $f:{\mathbb R} \rightarrow {\mathbb R}$ be measurable. Then there exists an $F_{\sigma}$ set $E$ such that $\lambda({\mathbb R}-E) = 0$ and the restriction of $f$ to $E$ is a Baire $1$ function on $E.$
REMARK 3: The analog of Frill 2 above fails. There exist measurable functions $f:{\mathbb R} \rightarrow {\mathbb R}$ that are not almost everywhere equal to any Baire $1$ function $g:{\mathbb R} \rightarrow {\mathbb R}$. (Consider the characteristic function of a set such that both the set and its complement has a positive measure intersection with every interval. Oxtoby's book "Measure and Category", 2nd edition, p. 37 gives a very nice construction of such a set that also happens to be $F_{\sigma}$. Rudin gives the same construction in "Well-distributed measurable sets", American Mathematical Monthly 90 (1983), 41-42.)
Apparently, when we try to prove a Baire $1$ "$\epsilon = 0$" version of Frill 2, the place where things break down is that if $E$ is $F_{\sigma}$, then not every Baire $1$ function $f:{\mathbb R} \rightarrow {\mathbb R}$ can be extended to all of $\mathbb R.$ (On the other hand, Baire $1$ functions on $G_{\delta}$ sets can be extended to Baire $1$ functions on all of $\mathbb R$.) There doesn't seem to be much in the literature concerning extending Baire $1$ functions, and I'd welcome any references that someone might know of. About the only relevant reference I'm aware of is a recent manuscript by Kalenda and Spurny titled "Extending Baire-one functions on topological spaces". However, their focus is on how various topological assumptions affect things rather than on a detailed analysis of the situation for real-valued functions of a real variable.
REMARK 4: The analog of Frill 2 does hold if we weaken "Baire $1$" to "Baire $2$". That is, if $f:{\mathbb R} \rightarrow {\mathbb R}$ is measurable, then there exists an $F_{\sigma}$ set $E$ and a Baire $2$ function $g:{\mathbb R} \rightarrow {\mathbb R}$ such that $\lambda({\mathbb R}-E) = 0$ and $f(x) = g(x)$ for all $x \in E.$ In fact, there exists functions $g_1$ and $g_2$ that are $C_{UL}$ and $C_{LU}$ in Young's classification (see THE YOUNG HIERARCHY below), respectively, such that $g_{1} \leq f \leq g_{2}$ and $g_{1} = g_{2}$ almost everywhere. This result is often called the Vitali-Caratheodory theorem. I don't have many references at my finger tips right now, but a fairly good treatment can be found on pp. 144-147 of Hahn/Rosenthal's 1948 book "Set Functions", and Young's own version appears on pp. 31-32 of his paper "On a new method in the theory of integration", Proceedings of the London Mathematical Society (2) 9 (1911), 15-50.
THE YOUNG HIERARCHY $g$ belongs to $C_L$ means there exists a sequence $\{f_{n}\}$ of continuous functions such that $f_{1} \leq f_{2} \leq f_{3}$ ... and $\{f_{n}\}$ converges pointwise to $g$. In short, $g$ is an increasing pointwise limit of continuous functions. $C_U$ consists of decreasing pointwise limits of continuous functions. If $g$ is bounded, then $g$ is $C_L$ iff $g$ is lower semicontinuous and $g$ is $C_U$ iff $g$ is upper semicontinuous. The "only if" halves are true even if $g$ is not bounded, and so if $g$ is both $C_L$ and $C_U$, then $g$ will be continuous. $C_{LU}$ consists of decreasing pointwise limits of $C_L$ functions, and similarly for $C_{UL}.$ Young proved (pp. 23-24 of his 1911 paper I cited above) that the collection of Baire $1$ functions is the intersection of the $C_{LU}$ and $C_{UL}$ collections. I don't remember off-hand if boundedness is needed for this last result. However, I do know that, aside from boundedness issues, the Young hierarchy continues to refine the Borel hierarchy. Thus, the Baire $2$ functions are the intersection of the $C_{LUL}$ and $C_{ULU}$ collections, and so on (even transfinitely through all the countable ordinals). There's not much in the literature about the Young hierarchy (Hahn's 1921 text is possibly the single best source), but one paper that does discuss it some is Michal Morayne, "Algebras of Borel measurable functions", Fundamenta Mathematicae 141 (1992), 229-242. In fact, Morayne studies a refinement that involves three or four sublevels inserted between each of the Young levels.
A: 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.
A: I thought of a worse example.  A pointwise limit of a sequence of continuous functions is Borel measurable, and there are Lebesgue measurable functions that are not Borel measurable.  The characteristic function of any non-Borel set of measure $0$ will do, for example.
The problem with "this seems to imply" is that "almost everywhere" and "everywhere" are different.
A: No. Pointwise limits of continuous functions are Baire functions of class 1 (or 0 if they are simply continuous). The characteristic function of the rationals is measurable but not of Baire class 1. 
