Interchanging limit with infimum/supremum

I'm sure I'm having a notational misunderstanding. Anyway, suppose $(f_n)$ is a sequence of continuous functions from a metric space $X$ to $\mathbb{R}$. So, if $(f_n)$ converges uniformly to a function $f$, then

$$\lim_{n \to \infty} \inf_{x \in X} f_n(x) = \inf_{x \in X} \lim_{n \to \infty} f_n(x)$$

and

$$\lim_{n \to \infty} \sup_{x \in X} f_n(x) = \sup_{x \in X} \lim_{n \to \infty} f_n(x).$$

Can somebody explain to me why is that? Again, this might be really simple...


I think to talk about $\sup$ and $\inf$ you need some sort of order on $Y$? Anyways, I'm going to take $Y = \mathbb{R}$ in what follows.

We have $f$ is the uniform limit of the $f_i$, and the claim is $$\lim_i \sup_{x \in X} f_i(x) = \sup_{x \in X} f(x)$$I treat the case $\sup_{x \in X} f(x) = M < \infty$, for $M = \infty$ you can minimally alter the same argument. Lemme know if you want details.

First of all, why does $\lim_i \sup_{x \in X} f_i(x)$ exist? Well indeed, let's show this sequence is Cauchy. Fix $\epsilon > 0$, for $i$ large enough we have all the $f_i$ uniformly within $\epsilon$ of $f$. For $j, j' > i$ take a sequence $x_n$ such that $f_j(x_n)$ converges to $\sup_{x} f_j(x)$, we have $$\sup_x f_{j'}(x) \geqslant \limsup_n f_{j'}(x_n) \geqslant \lim f_j(x_n) - \epsilon = \sup_x f_j(x) - \epsilon$$by symmetry we have the result.

Now onto business, we want to show $$\lim_j \sup_x f_j(x) = M$$

Well let's see $\geqslant$: for any $\epsilon > 0$, we can find $x$ such that $f(x)$ is within $\epsilon$ of $M$, and for big enough $n$ we have $f_n(x)$ is within $\epsilon$ of $f(x)$. In particular $\sup_{x' \in X} f_i(x ') \geqslant f_i(x) \geqslant M - 2\epsilon$

So we get $$\lim_i \sup_{x \in X} f_i(x) \geqslant M$$

Now let's see $\leqslant$: it suffices to show $\leqslant M + \epsilon$, for any $\epsilon > 0$. Indeed, for $i >> 0$, we have $f_i(x)$ is uniformly within $f(x)$. For such large $i$, take a sequence $x_n$ such that $\lim_n f_i(x_n) = \sup_x f_i(x)$. We have $$\lim_n f_i(x_n) \leqslant \limsup_n f(x_n) + \epsilon \leqslant M + \epsilon$$as desired.