Uniform convergence of sequences of piecewise functions (a) Define a sequence of functions on $\mathbb{R}$ by
$f_n(x) = 1$ if   $x\in\{\dfrac{1}{2}, \dfrac{1}{3},\cdots ,\dfrac{1}{n}\},$ $f=0$ otherwise. Let $f$ be the pointwise limit of $f_n$
Does $f_n \rightarrow f$ uniformly on $\mathbb{R}$? Is $f$ continuous at $0$?
(b) Repeat this exercise using the sequence of functions $g_n(x) = x$ if   $\{ x=1,\dfrac{1}{2}, \dfrac{1}{3},...\dfrac{1}{n}$ or $0$ otherwise. Let $f$ be the pointwise limit of $f_n$
For part (a) I see I can get an $N \geq \dfrac{1}{\epsilon}$ so that only a finite many points are outside the epsilon, thus when $n > N$, $|f_n(x)-f(x)|<\epsilon$. This means that it converges uniformly to $0$? What happens at 0, that is what is confusing me.
For part (b) I'm at a loss as to where to start.
Thank you in advance for any help.
 A: Let's do (a) first. I recommend you to first study the pointwise convergence. So, pick $x_0\in \mathbb R$ and study the limit $\lim_{n\to +\infty} f_n(x_0)$. We have:


*

*If $x_0\notin\{\frac1m, m\in\mathbb N\}$, then $f_n(x_0)=0$ $\forall n\in \mathbb N$, so $\lim_{n\to +\infty} f_n(x_0)=0$.

*If $x_0=\frac{1}{m}$ for $m\in \mathbb N$, then we have $f_n(x_0)=1$ if we pick $n>m$. So $\lim_{n\to +\infty} f_n(x_0$)=1$.


So the pointwise limit would be $$f(x)=\begin{cases} 1 \text{ if $x=\frac{1}{n}$ for $n\in\mathbb N$}  \\ 0 \text{ otherwise}\end{cases}$$
Now, to prove uniform convergence, you have to see that when $n\to+\infty$
$$\sup_{x\in\mathbb R}|f_n(x)-f(x)|\to 0$$
So, let's study the quantities $|f_n(x)-f(x)|$. Note that $f_n(\frac1{n+1})=0$, but $f(\frac{1}{n+1})=1$. So $\sup_{x\in\mathbb R}|f_n(x)-f(x)|>1$, and that means it cannot converge to $0$. So $f_n$ does not converge uniformly to $f$.
To study if $f$ is continuous at $0$, note that if there wasn't for the points $\frac{1}{n}$, $\lim_{x\to 0} f(x)=0$. That's the only possibility. But if you try to apply the definition of limit:
$$\forall \varepsilon>0, \ \exists \delta>0 : |x|<\delta \Rightarrow |f(x)|<\varepsilon$$
you quickly know that if you take $\varepsilon<1$, this can't be satisfied, because for every $\delta>0$ you can find a point $\frac1n$ so that $\frac1n<\delta$ and $|f(\frac1n)|=1\nless \varepsilon$.

Now, for part $(b)$, let's study pointwise convergence. If $x_0\in\mathbb R$, we have:


*

*If $x_0\notin\{\frac1m, m\in\mathbb N\}$, then $g_n(x_0)=0$ $\forall n\in \mathbb N$, so $\lim_{n\to +\infty} g_n(x_0)=0$.

*If $x_0=\frac{1}{m}$ for $m\in \mathbb N$, then we have $g_n()=\frac{1}{m}$ if we pick $n>m$. So $\lim_{n\to +\infty} g_n(x_0)=\frac1m$.


so the pointwise limit is, in this case, $$g(x)=\begin{cases} \frac1n \text{ if $x=\frac{1}{n}$ for $n\in\mathbb N$}  \\ 0 \text{ otherwise}\end{cases}$$
Note that $\sup_{x\in \mathbb R} |f_n(x)-f(x)| = \frac{1}{n+1}$, because these two functions only differ in the points $\{\frac{1}{n+1}, \frac{1}{n+2}, ...\}$ and the maximum difference is reached at $\frac{1}{n+1}$. So:
$$\sup_{x\in \mathbb R} |f_n(x)-f(x)| = \frac{1}{n+1} \to 0$$ when $n\to +\infty$. There is uniform convergence to the function $f(x)=0$.
