text:
# Approximation with continuous functions

Is it true that for every function $\mathbb{R} \to \mathbb{R}$ there exists a sequence of continuous functions $f_n(x): \mathbb{R} \to \mathbb{R}$ such that for any $x \in \mathbb{R}$ $f_n(x)$ converges to $f(x)$?

I started with characteristic function of rationals and tried to find corresponding sequence and got stuck. So additional question if this statement is true for this function.

-
See "Baire function" - en.wikipedia.org/wiki/Baire_function –  Yemon Choi Jul 10 '10 at 6:02
Is $f$ at least measurable? and are you asking about convergence everywhere, or almost everywhere? –  Piero D'Ancona Jul 11 '10 at 7:17
It's peculiar that this q. was up-voted so many times. –  Włodzimierz Holsztyński Nov 2 '13 at 5:41

What you want to do is look up Baire function'' (in Wikipedia, for example). The Baire class of functions is the least collection of functions $f:\mathbb R\to\mathbb R$ that contains the continuous functions and is closed under limits.

Here is a simple way of seeing that the answer is negative: Any continuous function $f:{\mathbb R}\to{\mathbb R}$ is determined by its value on the rationals, so by an easy counting argument, there are only as many continuous functions as there are reals. Since a sequence of reals can be easily coded by a single real, there are only $|{\mathbb R}|$-many functions that are limit of sequences of continuous functions (you could replace "pointwise limit" with just about anything you want as long as the countable sequence suffices to describe the new function). But there are $2^{|{\mathbb R}|}$ many functions from ${\mathbb R}$ to itself.

The Wikipedia entry talks about class $n$ Baire functions for all $n\in{\mathbb N}$: Baire class one functions are pointwise limits of sequences of continuous functions. Baire class two functions are pointwise limits of sequences of Baire class one functions, etc. You need to go on much longer through a transfinite process to capture all Baire functions, resulting in a hierarchy of length $\omega_1$. But even then you will fail to capture all functions $f:\mathbb R\to\mathbb R$: There are only $\mathfrak c$ many Baire functions. In fact, these are precisely the Borel measurable functions.

Let me close with something of an advertisement. Pete Clark's comments in another answer show that $\chi_{\mathbb Q}$ is not the pointwise limit of continuous functions. For this, he described a characterization of the Baire class 1 functions that clearly $\chi_{\mathbb Q}$ does not satisfy. Since the answer has been deleted, let me repeat Peter's comment:

A real function $f$ is in Baire class one iff for every nonempty perfect subset $P\subset\mathbb R$, there exists $x\in P$ such that the restriction of $f$ to $P$ is continuous at $x$ (in fact, $f\upharpoonright P$ is continuous at all points of $P$ except for a set that is first category in $P$). Taking $P$ to be a closed interval $[a,b]$, this shows that there is a dense subset of points at which $f$ is either left- or right- continuous. This is not the case for $\chi_{\mathbb Q}$.

(Note the nice corollary that, since derivatives are obviously Baire class one functions, they are continuous on a dense set of reals.)

The argument above, on the other hand, only refers to cardinality considerations, so it does not apply to specific examples.

One can refine the argument (essentially, by a sophisticated use of Cantor's diagonalization) by appealing to techniques of descriptive set theory. Here, one studies definable'' classes of functions $f:{\mathbb R}\to{\mathbb R}$ or, more generally, of subsets of ${\mathbb R}^n$, and it is therefore the right setting for this type of problems.

The simplest kind of definability a function may have is that its graph is Borel (this is the case if the function is continuous, for example). From here, a very large hierarchy of levels of complexity of subsets of ${\mathbb R}^m$ is defined, starting by taking projections of Borel subsets of ${\mathbb R}^{m+1}$, and complements, and then iterating this procedure.

The fact that we can actually iterate the procedure, i.e., that the hierarchy does not collapse, is where Cantor's diagonalization appears. Anyway, any class of functions with a simple description is easily seen to belong to a (typically, very short) initial segment of this hierarchy, and so we know it cannot capture the class of all functions. Many variants of your question are seen immediately to have negative answers through this procedure, which has the advantage of separating levels of complexity in a more refined way than mere cardinality.

An excellent reference you may want to look at is Alekos Kechris's book.

-

I quote a theorem due to Lusin:

Let $X$ be a locally compact Hausdorff space and let $\mu$ be a regular Borel measure on $X$ such that $\mu(K)<\infty$ for every compact $K\subseteq X$. Suppose $f$ is a complex measurable function on $X$, $\mu(A)<\infty$, $f(x)=0$ if $x\in X\setminus A$, and $\epsilon>0$. Then there exists a continuous complex function $g$ on $X$ with compact support such that

$\mu(\{x:f(x)\neq g(x)\})<\epsilon$.

Furthermore, the function $g$ can be chosen such that

$sup_{x\in X}|g(x)|\leq sup_{x\in X}|f(x)|$.

As an immediate corollary (which is more relevant to your question), observe that:

If the hypotheses of Lusin's theorem are satisfied and if $|f|\leq 1$, then there is a sequence $\{g_n\}$ of continuous complex functions with compact support such that $|g_n|\leq 1$ for all $n$ and

$f(x)=\lim_{n \to \infty}g_n(x)$

almost everywhere with respect to $\mu$.

Note that the proof of Lusin's Theorem requires Urysohn's lemma for locally compact Hausdorff spaces, or at least a variation of it. (A very similar argument to that used to prove Urysohn's lemma for Normal Hausdorff spaces establishes the fact that any locally compact Hausdorff space is completely regular.) For more details on these results and their proofs, see Chapter 2 of the second edition of Walter Rudin's Real and Complex Analysis. (The results can be more precisely located on pages 56 and 57.)

-

Quick, but less sharp, answer: The bounded Borel measurable functions are closed under bounded pointwise convergence. So any bounded non-measurable function is not the pointwise limit of continuous functions.

-

All the answers here rely on measure-theoretic ideas to give a negative answer. I feel that this does not exactly meet the point, instead I would say: You did not quite ask the right question, but if you did, the answer would in fact be "yes".

The space of all functions $\mathbb{R} \longrightarrow \mathbb{R}$ with the topology of pointwise convergence is a locally convex vector space, as its topology is induced by the system of seminorms $$\|f\|_x = |f(x)|.$$ However, since this system of norms in uncountable, sequences are not the right tool to describe convergence in this space.

Instead you should use nets. Using nets, you indeed have the following result: Every (yes every!) function $\mathbb{R} \longrightarrow \mathbb{R}$ is even the pointwise limit of a net of piecewise linear functions with finitely many knots. In particular, it is the limit of a net of continuous functions.

The set of finite subsets $\tau$ of $\mathbb{R}$ is ordered by inclusion and it is a directed set as the union of two finite sets is finite.

Now take a function $f:\mathbb{R} \longrightarrow \mathbb{R}$. For each finite subset $\tau$ of $\mathbb{R}$, let $f_\tau$ be the piecewise linear function with $$f_\tau(t) = f(t)~~~~~\forall t \in \tau$$ that is constant left of the smallest element of $\tau$ and right of the biggest element of $\tau$. Then $(f_\tau)$ is a net that converges to $f$.

-
I don't think your first sentence is correct. There are no measure theoretic ideas in my account, except for the passing mention that a much more complicated family than the one that the question relates to can be characterized measure theoretically. There is mention of the Baire category theorem, but even categoricity is superfluous for the problem at hand. –  Andres Caicedo Nov 3 '13 at 4:39
Ok, you are right... –  Matthias Ludewig Nov 3 '13 at 6:33