# Prove that $\lim f_n(x_n) = f(x), x_n\rightarrow x,$ then $f_n\rightarrow f$ uniformly on compact

From an exercise list:

Prove that if a sequence of continuous functions $f_n:X\rightarrow \mathbb{R}$ is such that $x_n\in X$, $\lim x_n = x \in X \Rightarrow \lim f_n(x_n) = f(x)$, then $f_n\rightarrow f$ uniformly on every compact subset of $X$.

This question is very similar to this and also this one. But in this case, it is not in the hypothesis that $f$ is continuous.

Is it possible to prove that $f$ is continuous only using the hypothesis of my problem? Or this result is not valid and there is actually a conterexample for this exercise. For me, the result does not seem valid if $f$ is not continuous.

The following is selfcontained; it does not refer to earlier questions and answers on MSE.

Lemma. Let $X$ be a compact metric space, and let $(g_n)_{n\geq1}$ be a sequence of functions $g_n:\>X\to{\mathbb R}$ satisfying $\lim_{n\to \infty}g_n(x_n)=0$ whenever the sequence $(x_n)_{n\geq1}$ is convergent to some $x\in X$. Then the $g_n$ converge to $0$ uniformly in $X$.

Proof. If not, there is an $\epsilon_0>0$, such that for each $n\geq1$ you can find a point $x_n\in X$ with $|g(x_n)|\geq\epsilon_0$. Since $X$ is compact there is a point $\xi\in X$ and a subsequence $y_k:=x_{n_k}$ $(k\geq1)$ such that $\lim_{k\to\infty} y_k=\xi$. As $|f(y_k)|\geq \epsilon_0$ for all $k$ this violates the central assumption of the Lemma.

Assume now that we are given a sequence of continuous functions $f_n:\>X\to{\mathbb R}$ and a function $f:\>X\to{\mathbb R}$, such that $\lim_{n\to \infty}f_n(x_n)=f(x)$ whenever the sequence $(x_n)_{n\geq1}$ is convergent to some $x\in X$. The auxiliary functions $g_n:=f_n-f$ then satisfy the assumptions of the Lemma. We therefore can conclude that the $f_n$ converge uniformly to $f$, which then in turn implies that $f$ is continuous.

Let us suppose there is a compact set $K$ on which $f_n$ does not converge to $f$ uniformly. If $f$ is continuous on $K$, then the linked questions show that there is a convergent sequence $x_n\to x$ such that $f_n(x_n)$ does not converge to $f(x)$. Now suppose $f$ is not continuous on $K$. That means there is some $x\in K$, some $\epsilon>0$ and a sequence of points $y_k\in K$ converging $x$ such that $|f(y_k)-f(x)|>\epsilon$ for all $k$. For each $k$, let $N(k)$ be such that $|f_n(y_k)-f(y_k)|<\epsilon/2$ for all $n>N(k)$.

Now define $k(n)$ to be the largest integer $k$ such that $N(k)<n$, if such a largest $k$ exists. If no largest such $k$ exists because there are infinitely many such $k$, just define $k(n)=k$ for some such $k$ with $k\geq n$. If no largest such $k$ exists because no such $k$ exists, let $k(n)=1$. Note that this last case can only happen for finitely many $n$ (since as soon as $n>N(1)$, there exists at least one such $k$). Note furthermore that $k(n)\to\infty$ as $n\to\infty$, since for any $m$, $k(n)\geq m$ for any $n$ such that $n>N(m)$ and $n\geq m$.

Now define $x_n=y_{k(n)}$. By construction, we have $|f_n(x_n)-f(x_n)|<\epsilon/2$ for all but finitely many $n$. Since $|f(y_k)-f(x)|>\epsilon$ for all $k$, it follows that $|f_n(x_n)-f(x)|>\epsilon/2$ for all but finitely many $n$. Since $k(n)\to\infty$ as $n\to\infty$ and $y_k\to x$ as $k\to\infty$, we have $x_n\to x$ as $n\to\infty$. It follows that $(x_n)$ is a sequence converging to $x$ such that $f_n(x_n)$ does not converge to $f(x)$.

So, you only need to prove that $f$ itself is continuous -- the rest will follow from the questions you link.

Caveat: this was more or less done on-the-fly, there may be and probably is more direct/less cumbersome.

Fix any $x\in X$, and a sequence $(x_n)_{n\geq 0}\in X^\mathbb{N}$ converging to $x$. Then, for any $n\geq 0$ $$\lvert f(x_n) - f(x)\rvert \leq \lvert f(x_n) - f_n(x_n)\rvert+\lvert f_n(x_n) - f_n(x)\rvert+\lvert f_n(x) - f(x)\rvert$$ Let's deal with the three terms separately. Fix any $\varepsilon > 0$.

• By assumption on $(f_n)_n$, since $\lim_{n\to\infty} x_n = x$ there exists $N_1\geq 0$ such that for any $n\geq N_1$ we have $\lvert f(x_n) - f_n(x_n)\rvert \leq \frac{\varepsilon}{3}$.

• By assumption on $(f_n)_n$, since $\lim_{n\to\infty} x = x$ there exists $N_3\geq 0$ such that for any $n\geq N_1$ we have $\lvert f_n(x) - f(x)\rvert \leq \frac{\varepsilon}{3}$.

Already, this gives us that for any $n\geq \max(N_1,N_3)$ it holds that $$\lvert f(x_n) - f(x)\rvert \leq \frac{2}{3}\varepsilon+\lvert f_n(x_n) - f_n(x)\rvert.$$ The last term is a bit trickier, since although $f_n$'s are continuous it's not clear how to use that when the same index $n$ appears in $f_n$ and $x_n$. But, let $N= \max(N_1,N_3)$. Now, for $n \geq m \geq N$, $$\lvert f_n(x_n) - f_n(x)\rvert \leq \lvert f_n(x_n) - f_m(x_n)\rvert +\lvert f_m(x_n) - f_m(x)\rvert+\lvert f_m(x) - f_n(x)\rvert$$ Since $\lim_{n\to\infty}f_n(x) = f(x)$ by the same argument as above, the third term go to $0$ (and the sequence is Cauchy). Therefore, we can find $N_3 \geq N$ such that for all $n\geq m \geq N_3$, $\lvert f_m(x) - f_n(x)\rvert \leq \frac{\varepsilon}{9}$ and $\lvert f_m(x) - f(x)\rvert \leq \frac{\varepsilon}{18}$. At this point, fixing $m=N_3$, we get $$\lvert f_n(x_n) - f_n(x)\rvert \leq \lvert f_n(x_n) - f_{N_3}(x_n)\rvert +\lvert f_{N_3}(x_n) - f_{N_3}(x)\rvert+\frac{\varepsilon}{9}$$ Note that using the continuity of $f_{N_3}$ (which is now fixed) the first term goes to $\lvert f(x) - f_{N_3}(x)\rvert$ when $n\to\infty$ , while the second goes to $0$. It is thus possible to find $N_4 \geq N_3$ such that, for $n\geq N_4$, $$\lvert f_{N_3}(x_n) - f_{N_3}(x)\rvert \leq \frac{\varepsilon}{9}$$ and $$\lvert f_n(x_n) - f_{N_3}(x_n)\rvert \leq \lvert f(x) - f_{N_3}(x)\rvert + \frac{\varepsilon}{18} \leq \frac{\varepsilon}{18}+\frac{\varepsilon}{18}=\frac{\varepsilon}{9}$$ where the second inequality uses the fact that $\lvert f_m(x) - f(x)\rvert \leq \frac{\varepsilon}{18}$ for any $m\geq N_3$, by choice. Piecing it together, for any $n\geq N_4$ $$\lvert f_n(x_n) - f_n(x)\rvert \leq \frac{\varepsilon}{9}+\frac{\varepsilon}{9}+\frac{\varepsilon}{9} = \frac{\varepsilon}{3}$$ and overall $$\lvert f(x_n) - f(x)\rvert \leq \frac{2}{3}\varepsilon+\frac{\varepsilon}{3} = \varepsilon.$$ This shows continuity of $f$ at $x$, which was arbitrary: $f$ is continuous.