The real Stone-Weierstrass theorem states that if is a compact Hausdorff space and is a subalgebra containing the constants and separating points of , then is dense in in the uniform norm.
The Tietze extension theorem states that if is a normal topological space, is closed, and is continuous, then extends to a continuous function on . In its bounded form, an taking values in has an extension with the same range bound. The underlying separation step is the Urysohn lemma.
The Urysohn lemma states that if and are disjoint closed subsets of a normal space , there is a continuous with on and on .
The Tietze extension theorem states that if is a closed subset of a normal space , then every continuous has a continuous extension . In the bounded form, if , the extension can be chosen with .
If is compact and is continuous, then is compact by the continuous image of a compact space theorem. Every compact subset of is bounded, so is bounded.
Conversely, suppose the metric space is not compact. For metric spaces, compactness is equivalent to sequential compactness, so there is a sequence of distinct points having no convergent subsequence. The set
is closed: an accumulation point would supply a convergent subsequence. It is also discrete for the same reason. Consequently the function
is continuous. By part (a), is normal, and the Tietze extension theorem extends to a continuous . Since , this extension is unbounded. Therefore, if every continuous real-valued function on is bounded, must be compact. This is the bounded-continuous-function characterization of compact metric spaces.
The Tietze extension theorem states: if is a normal topological space, is closed, and is continuous, then there is a continuous with .
We first prove an approximation lemma. Given continuous , the closed subsets
are disjoint and closed in . By the Urysohn lemma, there is a continuous equal to on and on . Then
Starting with and , apply the lemma recursively to obtain continuous such that
where . The series
converges uniformly by the Weierstrass test, so its sum is continuous. On , its remainder after terms is , which tends uniformly to zero; hence . The bounds also keep in after the standard endpoint-preserving version of the construction, proving the theorem.