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 2010 at 6:02
Is $f$ at least measurable? and are you asking about convergence everywhere, or almost everywhere? – Piero D'Ancona Jul 11 2010 at 7:17

Quick answer since it is late:

What you want to do is look up Baire function'' (in Wikipedia, for example).

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.

This argument shows that even if you iterate the process (the Wikipedia entry talks about class $n$ Baire functions for all $n\in{\mathbb N}$. You need to go on much longer through a transfinite process), you have to iterate it for a very long time if you hope to capture all functions this way.

Let me add something of an advertisement, now that I have some time. 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.

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 my 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 (tipically, 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.

-

Well, if you look at the Dirichlet function, which is the characteristic function of the rationals in $[0,1]$ it can be written as the double pointwise limit: $$f(x)= \lim_{k\to\infty}\left(\lim_{j\to\infty}\left(\cos(k!\pi x)^{2j}\right)\right)$$ This definition holds for any $x \in \mathbb{R}$ as well.

(Taken from Wikipedia, Nowhere continuous function)

-
 Yep. So it's of Baire class 2, not of Baire class 1 (which, as already mentioned, is the set described by the asker). – Nate Eldredge Jul 12 2010 at 15:23

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. - The question is ill-posed. A function continuous in one topology might not be continuous in another topology. The same goes for convergence. When you precisely formulate your question, I am sure you will be able to come with the answer. - Huh? I think it's clear that the OP is talking about the classical topology on R and pointwise convergence... – Andy Putman Jul 10 2010 at 6:17 This is an unhelpful answer. There is a standard topology on$\mathbb{R}$, and surely that is the one the OP intends. Just asking the question precisely (as the OP has done) does not suggest the answer. Rather, as Yemon Choi points out, this question is the beginning of theory of Baire classes: a function is in Baire class one if it is a pointwise limit of continuous functions. Such functions have to have a dense subset of points of continuity, ruling out the characteristic function of$\mathbb{Q}$. – Pete L. Clark Jul 10 2010 at 6:20 Slight correction: a real function$f$is in Baire class one iff: for every nonempty closed subset$P \subset \mathbb{R}$without isolated points, there exists$x \in P$such that the restriction of$f$to$P$is continuous at$x$. 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}}\$. – Pete L. Clark Jul 10 2010 at 6:28