# sequence of functions converges pointwise at irrationals

Let $$g:\mathbb{N}\to \mathbb Q$$ be a bijection; let $$x_n=g(n)$$. Define the function $$f:\mathbb{R}\to \mathbb{R}$$ as $$x_n\mapsto 1/n \text{ for } x_n\in \mathbb Q$$ $$x\mapsto 0 \text{ for } x\notin \mathbb Q.$$ I proved that this function is continuous precisely at $$\mathbb R\setminus\mathbb Q$$. But I need to find also a sequence of continuous functions $$f_n:\mathbb R\to \mathbb R$$ that converge pointwise to $$f$$. Here is my attempt:

Fin $$n\in \mathbb N$$, for every $$k\in \{1,\ldots, n\}$$ set $$\delta_{nk}=1/4 \text{ min}\bigr(\{1/n\}\cup \{\vert x_m-x_r\vert: m\neq r\text{ and }m,r=1,\ldots,n\} \bigr)$$. Then use Urysohn Lemma to set continuous functions $$h_{nk}:\mathbb{R}\to [0,1/n]$$ such that $$h_{nk}(x_k)=1/k$$ and $$h_{nk}(U_{nk}^c)=0$$, where $$U_{nk}$$ is the open interval about $$x_k$$ with diameter $$\delta_{nk}$$; and $$U_{nk}^c$$ denotes its complement. So defined, the sequence $$\{f_n\}$$ clearly converges pointwise at $$\mathbb Q$$; but I cannot shows it also converges at each irrational.

Also, this is a question at the end of the section on Baire Cathegory Theorem in Munkres' Topology book. I do not find the connection of this with this exercise.

Suppose there is some irrational $$x$$ such that $$f_n(x)\not\to f(x)=0$$. That is, for every $$\epsilon<0$$ and every $$N\in \mathbb N$$ we can find some positive integer $$m>N$$ such that $$f_m(x)\geq \epsilon$$. Thus there is some subsequence $$\{f_{n_i} \}$$ such that $$f_{n_i}\geq \varepsilon$$ for some positive real $$\varepsilon$$. By the construction of the $$f_{n}$$'s for fixed $$n_i$$, we have that $$x$$ lies within $$U_{n_i k_i}$$ for some rational $$x_{k_i}$$. The construction of $$\delta_{nk}$$ implies that if $$i, then $$k_i (This is because $$U_{nk}$$ and $$U_{n\tau}$$ are disjoint for $$k\neq \tau$$). This means that $$k_i\to \infty$$ as $$i\to \infty$$. Continuity of $$f_{n_i}$$ implies that $$f(x)\leq f(x_{k_i})=1/k_i\to 0$$, a contradiction.

First note that $$\delta_{nk}$$ has nothing to do with $$k$$, so write $$\delta_n$$ instead. Note also that, by construction, $$\delta_n\downarrow 0$$.

Fix an irrational $$\alpha$$ and let $$\epsilon>0$$. There are only finitely many $$n$$ with $$\frac1n>\epsilon$$, so choose some $$n_1$$ such that $$\frac1{n_1}<\epsilon$$.

If $$\alpha$$ is distance $$>\delta_{n_1}$$ away from $$x_1,\dots,x_{n_1}$$ then we are done: for all $$n>n_1$$, $$\alpha$$ is never within $$\delta_n$$ of $$x_1,\dots,x_{n_1}$$ so $$f_n(\alpha)\leq\frac1{n_1+1}$$.

On the other hand, if $$\alpha$$ is within $$\delta_{n_1}$$ from some $$x_k$$, then find some $$n_2$$ such that $$\alpha$$ is not within $$\delta_{n_2}$$ of $$x_k$$, and $$\alpha$$ is not within distance $$\delta_{n_2}$$ of other $$x_1,\dots,x_{n_1}$$. So $$f_n(\alpha)$$, for $$n>n_2$$, is at most $$\frac1{n_1+1}$$.

So $$f_n(\alpha)<\epsilon$$ for all sufficiently large $$n$$, hence $$f_n\to f$$ pointwise on the irrationals too.

Your $$f$$ is a Baire-1 function. We know set of discontinuity of pointwise limit of continuous is meagre, but not every meagre set can appear as the set of discontinuity of pointwise limit of continuous, see this question.