Theorem (Dini's Theorem) Let $K$ be a compact metric space. Let $f: K \rightarrow \mathbb{R}$ be a continuous function and $f_{n}: K \rightarrow \mathbb{R}, n \in \mathbb{N}$, be a sequence of continuous functions. If $\left\{f_{n}\right\}_{n \in \mathbb{N}}$ converges pointwise to $f$ and if$$
f_{n}(x) \geq f_{n+1}(x) \quad \text { for all } x \in K \text { and all } n \in \mathbb{N}
$$then $\left\{f_{n}\right\}_{n \in \mathbb{N}}$ converges uniformly to $f$.
Proof. Set, for each $n \in \mathbb{N}, g_{n}(x)=f_{n}(x)-f(x)$. Then $\left\{g_{n}\right\}_{n \in \mathbb{N}}$ is a sequence of continuous functions on the compact metric space $K$ that converges pointwise to 0 . Furthermore $g_{n}(x) \geq g_{n+1}(x) \geq 0$ for all $x \in K$ and $n \in \mathbb{N}$. Set $M_{n}=\sup \left\{g_{n}(x) \mid x \in K\right\}$. We must prove that $\lim _{n \rightarrow \infty} M_{n}=0$.
We use the finite open subcover property of $K$. Let $\varepsilon>0$ and define $\mathcal{O}_{n}=$ $g_{n}^{-1}((-\infty, \varepsilon))$. Since $g_{n}$ is continuous, this is an open set. Since $g_{n}(x) \geq g_{n+1}(x)$, $\mathcal{O}_{n} \subset \mathcal{O}_{n+1}$. For each $x \in K, \lim _{n \rightarrow \infty} g_{n}(x)=0$ so that there is an $n \in \mathbb{N}$ with $g_{n}(x)<\varepsilon$ so that $x \in \mathcal{O}_{n}$. Thus $\bigcup_{n=1}^{\infty} \mathcal{O}_{n}=K$. Since $K$ is compact, there is a finite collection of $\mathcal{O}_{n}$ 's that also covers $K$. Since $\mathcal{O}_{n} \subset \mathcal{O}_{n+1}$, the $\mathcal{O}_{n}$ in that finite collection with the largest index covers $K$. Thus there is an $N \in \mathbb{N}$ with $\mathcal{O}_{N}=K$. That is $g_{N}(x)<\varepsilon$ for all $x \in K$. Thus $M_{N} \leq \varepsilon$. Since $M_{n}$ decreases with $n$ and every $M_{n} \geq 0$, this forces $\lim _{n \rightarrow \infty} M_{n}=0$. $\blacksquare$
Here are examples that show that the hypotheses
(a) $K$ is compact
(b) $f$ is continuous
(c) $f_{n}(x)$ decreases as $n$ increases
are each necessary.
Example (a) The set $K=(0,1)$ is not compact. As $n \rightarrow \infty$, the sequence $f_{n}(x)=x^{n}$ of continuous functions decreases pointwise to zero. But the convergence is not uniform because$$\sup \left\{f_{n}(x) \mid x \in \mathbb{R}\right\}=1$$for all $n \in \mathbb{N}$.
Example (a') The set $K=\mathbb{R}$ is not compact. As $n \rightarrow \infty$, the sequence
\sup \left\{f_{n}(x) \mid x \in \mathbb{R}\right\}=1
$$for all $n \in \mathbb{N}$.
Example (b) The set $K=[0,1]$ is compact. As $n \rightarrow \infty$, the sequence
Example (c) The set $K=[0,1]$ is compact. As $n \rightarrow \infty$, the sequence
\sup \left\{f_{n}(x) \mid x \in \mathbb{R}\right\}=1
$$for all $n \in \mathbb{N}$.
f_{n}(x) \geq f_{n+1}(x) \quad \text { for all } x \in K \text { and all } n \in \mathbb{N}
$$then $\left\{f_{n}\right\}_{n \in \mathbb{N}}$ converges uniformly to $f$.
Proof. Set, for each $n \in \mathbb{N}, g_{n}(x)=f_{n}(x)-f(x)$. Then $\left\{g_{n}\right\}_{n \in \mathbb{N}}$ is a sequence of continuous functions on the compact metric space $K$ that converges pointwise to 0 . Furthermore $g_{n}(x) \geq g_{n+1}(x) \geq 0$ for all $x \in K$ and $n \in \mathbb{N}$. Set $M_{n}=\sup \left\{g_{n}(x) \mid x \in K\right\}$. We must prove that $\lim _{n \rightarrow \infty} M_{n}=0$.
We use the finite open subcover property of $K$. Let $\varepsilon>0$ and define $\mathcal{O}_{n}=$ $g_{n}^{-1}((-\infty, \varepsilon))$. Since $g_{n}$ is continuous, this is an open set. Since $g_{n}(x) \geq g_{n+1}(x)$, $\mathcal{O}_{n} \subset \mathcal{O}_{n+1}$. For each $x \in K, \lim _{n \rightarrow \infty} g_{n}(x)=0$ so that there is an $n \in \mathbb{N}$ with $g_{n}(x)<\varepsilon$ so that $x \in \mathcal{O}_{n}$. Thus $\bigcup_{n=1}^{\infty} \mathcal{O}_{n}=K$. Since $K$ is compact, there is a finite collection of $\mathcal{O}_{n}$ 's that also covers $K$. Since $\mathcal{O}_{n} \subset \mathcal{O}_{n+1}$, the $\mathcal{O}_{n}$ in that finite collection with the largest index covers $K$. Thus there is an $N \in \mathbb{N}$ with $\mathcal{O}_{N}=K$. That is $g_{N}(x)<\varepsilon$ for all $x \in K$. Thus $M_{N} \leq \varepsilon$. Since $M_{n}$ decreases with $n$ and every $M_{n} \geq 0$, this forces $\lim _{n \rightarrow \infty} M_{n}=0$. $\blacksquare$
Here are examples that show that the hypotheses
(a) $K$ is compact
(b) $f$ is continuous
(c) $f_{n}(x)$ decreases as $n$ increases
are each necessary.
Example (a) The set $K=(0,1)$ is not compact. As $n \rightarrow \infty$, the sequence $f_{n}(x)=x^{n}$ of continuous functions decreases pointwise to zero. But the convergence is not uniform because$$\sup \left\{f_{n}(x) \mid x \in \mathbb{R}\right\}=1$$for all $n \in \mathbb{N}$.
Example (a') The set $K=\mathbb{R}$ is not compact. As $n \rightarrow \infty$, the sequence
$f_{n}(x)=$
( the right hand plateau is at height 1 ) of continuous functions decreases pointwise to zero. But the convergence is not uniform because$$\sup \left\{f_{n}(x) \mid x \in \mathbb{R}\right\}=1
$$for all $n \in \mathbb{N}$.
Example (b) The set $K=[0,1]$ is compact. As $n \rightarrow \infty$, the sequence
$f(x)=$
of continuous functions (the dot is at height 1) decreases pointwise to the discontinuous function$f(x)=$
But the convergence is not uniform because$\displaystyle\sup \left\{x^{n} \mid 0<x<1\right\}=\sup$
for all $n \in \mathbb{N}$.Example (c) The set $K=[0,1]$ is compact. As $n \rightarrow \infty$, the sequence
$f_n(x)=$
of continuous functions (the triangle has height 1) converges pointwise to zero. But the convergence is not uniform because$$\sup \left\{f_{n}(x) \mid x \in \mathbb{R}\right\}=1
$$for all $n \in \mathbb{N}$.