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!
 A: 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).
A: 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...
