# Simple question regarding continuous functions on $\mathbb{Q}$

I am a self-studying masochist and I came across an interesting example (to me), that I think will help me with further results. I have little experience writing rigorous proofs, so any explicit help is appreciated.

What I am trying to prove is the following:

Find a measurable indicator function that cannot be approximated by a sequence of continuous functions (demonstrate). For this I believe the "answer" is some form of $1_{\mathbb{Q}}$ on a finite interval. I believe this function is both measurable and not a pointwise limit of continuous functions.

How can I show that if I have a continuous function arbitrarily close to 1 on the rationals, it cannot also be arbitrarily close to 0 on the irrationals? I do know that continuous functions are uniformly continuous on finite intervals, but I cant seem to put all the pieces together.

Any detail would be greatly appreciated. Thanks!

-
Ah, a fellow mathochist! One note I would make is that continuous functions are uniformly continuous on finite closed intervals. – Cameron Buie Jun 15 '12 at 18:04
@CameronBuie, you forgot bounded as $(-\infty, x]$ is a closed interval, but not a compact. – Karolis Juodelė Jun 15 '12 at 18:07
@KarolisJuodelė: I used finite instead of bounded (using the OP's terminology). – Cameron Buie Jun 15 '12 at 18:08
There are two (somewhat general) ways that I know to show the result: you could show that the limit of a sequence of continuous functions has the Darboux property, or that it is continuous in some point (in fact, on a comeager set). The indicator of rationals has neither property, so it certainly is not a limit of such a sequence. – tomasz Jun 15 '12 at 18:12
Sorry, I made a mistake -- the statement about Darboux property is not true (as shown by $x^n$ on $[0,1]$, for example). The second one is true in far more general context (functions from completely metrizable space to a second-countable one, iirc), though. – tomasz Jun 15 '12 at 18:22

A somewhat brute-force indirect proof:

Assume that we have a series of continuous functions $(f_n)$ that approximate $1_{\mathbb Q}$ pointwise. For a contradiction we will find an $x$ such that $f_n(x)$ does not converge. This $x$ will be constructed as a point in the intersection of an infinite sequence of closed intervals $I_1 \supseteq I_2 \supseteq I_3 \supseteq \cdots$, in the following way:

To begin with, let $I_0=[0,1]$ and $n_0=1$.

Now for each $i\ge 1$, choose a $y_i$ in $I_{i-1}$ such that it is irrational for even $i$ and rational for odd $i$. Since $\lim_n f_n(y_i) = 0$ (or $1$ as appropriate) by assumption, we can choose a large enough $n_i>n_{i-1}$ such that $f_{n_i}(y_i)$ is less than $0.1$ or more than $0.9$. By continuity of $f_{y_i}$ there is then a closed interval around $y_i$ where all values are less than $0.2$ or more than $0.8$. This interval becomes $I_i$; clearly it can be chosen small enough to lie within $I_{i-1}$.

Now, if we take $x$ to be in the intersection of all the intervals (for example it could be the supremum of the lower bounds), then by construction $f_{n_i}(x)$ alternates between being less than $0.2$ or more than $0.8$ according to the parity of $i$ (except for $i=0$). In particular $\lim_i f_{n_i}(x)$ cannot exist, so neither does $\lim_n f_n(x)$, which contradicts the assumption that the $f_n$'s have a pointwise limit.

Later note: Indirect proofs such as this can be difficult to follow, because they start by assuming something that turns out to be impossible, and everything that follows happens in a looking-glass world that doesn't actually exit. That makes it hard to get an intuitive picture of what is going on, because it really isn't going on after all.

Many people, including me, often find it easier to devise an indirect proof than a direct one, but since direct proofs are generally easier to read, in a more polished writeup one ought to try to rewrite he proof such that most of it works in a direct manner and the scope the assume-for-a-contradiction becomes as small as possible. After analyzing which parts of the contradicting assumptions the argument actually uses, we might end up with something like:

Lemma. Let $A$ and $B$ be subsets of $\mathbb R$, and assume that $(f_n)$ is a sequence of continuous functions that converges pointwise to $0$ on $A$ and to $1$ on $B$. If there is an interval $I$ in which $A$ and $B$ are both dense, then $I$ contains a point that is neither in $A$ nor $B$.

Proof. (Almost exactly as above, but with $A$ and $B$ for "irrational" and "rational")

Corollary. There cannot be a sequence of continuous functions that converges pointwise to $1_{\mathbb Q}$. Namely, assume that such as sequence exists. If we set $A=\mathbb R\setminus \mathbb Q$ and $B=\mathbb Q$, then the Lemma concludes that there is a number in $[0,1]$ that is neither rational nor irrational, which is absurd.

Of course, that is only an improvement if there exists some way for the assumptions of the Lemma to be true; otherwise we would still be in looking-glass land. But luckily there is; for example we could let $A$ be the set of dyadic rationals, $B=\mathbb Q\setminus A$, and let $f_n$ have the "correct" value on all fractions with denominators less than $n$ and interpolate linearly between them. (Note that this construction is not necessary for the proof to work; it just provides an example that one can keep in mind while following the steps to the proof).

-
please forgive the ignorance/newb, but I'm struggling to understand the proof. I guess on some level (maybe it's the "brute force"), I'm just trying to understand the underlying reasoning and methodology. – Justin Jun 15 '12 at 18:55
@Justin: As with many proofs this one was actually constructed in reverse -- the basic idea is to try to look for an $x$ such that $f_n(x)$ will have infinitely many of both "large" and "small" values (with thresholds 0.2 and 0.8). The $y_i$'s are successive approximations to the eventual $x$; but because some largeness/smallness is lost when we move from $y_i$ to $x$, we need to force the $y_i$'s to be extra large/small (thresholds 0.1 and 0.9) such that there's some slack left. The $I_i$ intervals now keep track of how far from $y_i$ we can afford to put our $x$. – Henning Makholm Jun 15 '12 at 19:03
@Justin: Or is it the phrasing of the proof steps you have problems with? Some of them are expressed somewhat sketchily because I thought it would be educational for you to develop the details yourself (and also because I'm lazy). I would be happy to try to clarify any particular stumbling points, though. – Henning Makholm Jun 15 '12 at 19:05
first of all, thank you for the answer, and let me say that anyone who takes time to help someone like me on this site is anything but lazy! Later tonight I will have some time to really try and dig into the details/make the connections and will come back with any specific areas of confusion. Part of it is just my lack of "reps" with rigorous math. – Justin Jun 15 '12 at 19:25

One can show that if $f_k\to f$, each $f_k$ is continuous, then the set of the discontinuity points of $f$ is of the first category.

But the set of discontinuity points of the characteristic function $\chi_\mathbb{Q}$ is the whole interval, which is not of the first category...

-