As a homework question, we got asked the following:
Construct a function $f:[0,1] \rightarrow \mathbb{R}$ which is not the pointwise limit of any sequence of continuous functions
Thinking about it, a function which is nowhere continuous should be sufficient; thus I decided to try to use the indicator function on the rationals, $1_\mathbb{Q}$. Basically, I was just wondering if my proof was alright or not:
Suppose $(f_n)$ is a sequence of continuous functions converging pointwise to $1_\mathbb{Q}$; thus for any $\epsilon > 0$ we have that for all $x$ we can find a $N$ such that if $n \geq N$ then $| f_n(x) - 1_\mathbb{Q} (x) | < \epsilon$. In particular, we have for some $x_1 \in \mathbb{Q}, x_2 \notin \mathbb{Q}$ a $N_1$ and $ N_2$ respectively such that
- if $ n \geq N_1$ then $ | f_n(x_1) - 1 | < \epsilon$
- if $ n \geq N_2$ then $ | f_n(x_2) | < \epsilon$
Now, as $f_k$ is continuous, for any $\epsilon > 0$ we have that for all $x$ there exists a $\delta > 0$ such that if $ | x- y | < \delta$ then $|f_k(x) - f_k(y) | < \epsilon $. However, if we pick an arbitrary $x \in \mathbb{Q}$, for $n \geq \max\{N_1, N_2\}$, for any $\delta > 0$ we can pick a $ y \notin \mathbb{Q}$ such that $| x- y| < \delta$ yet $ | f_n(x) - f_n(y) - 1| < 2\epsilon$ (by the triangle inequality and using the pointwise convergence properties); so if we choose $\epsilon = 1/10$, say, then we have by continuity that $|f_n(x) - f_n(y)| < 1/10$, yet $| f_n(x) - f_n(y) - 1| < 1/5$, which (I believe) is absurd, so we have a contradiction.
I'm a bit iffy about whether this is alright or not (I feel I may be subtly abusing the definitions here), so any feedback would be much appreciated.