Dini's theorem

In the mathematical field of analysis, Dini's theorem says that if a monotone sequence of continuous functions converges pointwise on a compact space and if the limit function is also continuous, then the convergence is uniform.

Formal statement
If $$X$$ is a compact topological space, and $$(f_n)_{n\in\mathbb{N}}$$ is a monotonically increasing sequence (meaning $$f_n(x)\leq f_{n+1}(x)$$ for all $$n\in\mathbb{N}$$ and $$x\in X$$) of continuous real-valued functions on $$X$$ which converges pointwise to a continuous function $$f\colon X\to \mathbb{R}$$, then the convergence is uniform. The same conclusion holds if $$(f_n)_{n\in\mathbb{N}}$$ is monotonically decreasing instead of increasing. The theorem is named after Ulisse Dini.

This is one of the few situations in mathematics where pointwise convergence implies uniform convergence; the key is the greater control implied by the monotonicity. The limit function must be continuous, since a uniform limit of continuous functions is necessarily continuous. The continuity of the limit function cannot be inferred from the other hypothesis (consider $$x^n$$ in $$[0,1]$$.)

Proof
Let $$\varepsilon > 0$$ be given. For each $$n\in\mathbb{N}$$, let $$g_n=f-f_n$$, and let $$E_n$$ be the set of those $$x\in X$$ such that $$g_n(x)<\varepsilon$$. Each $$g_n$$ is continuous, and so each $$E_n$$ is open (because each $$E_n$$ is the preimage of the open set $$(-\infty, \varepsilon)$$ under $$g_n$$, a continuous function). Since $$(f_n)_{n\in\mathbb{N}}$$ is monotonically increasing, $$(g_n)_{n\in\mathbb{N}}$$ is monotonically decreasing, it follows that the sequence $$E_n$$ is ascending (i.e. $$E_n\subset E_{n+1}$$ for all $$n\in\mathbb{N}$$). Since $$(f_n)_{n\in\mathbb{N}}$$ converges pointwise to $$f$$, it follows that the collection $$(E_n)_{n\in\mathbb{N}}$$ is an open cover of $$X$$. By compactness, there is a finite subcover, and since $$E_n$$ are ascending the largest of these is a cover too. Thus we obtain that there is some positive integer $$N$$ such that $$E_N=X$$. That is, if $$n>N$$ and $$x$$ is a point in $$X$$, then $$|f(x)-f_n(x)|<\varepsilon$$, as desired.