A metric space $X$ is compact if every continuous real-valued function on $X$ is bounded.

compactnesscontinuitymetric-spacesproof-explanation

I found an application of Tietze's extension theorem here, however, in the proof I don't understand why he says that any convergent sequence with terms in $S$ must be constant and that its limit is in $S$. Why? Also, why is $S$ discrete and closed?

Theorem: A metric space $X$ is compact if every continuous real-valued function on $X$ is bounded.

Proof: If instead $X$ is not compact, then we have some sequence $(x_n)$ in $X$ which has no convergent subsequence. Hence every convergent sequence with terms in the set $S=\{x_1,x_2,\ldots\}$ must be eventually constant, so has limit in $S$, hence $S$ is closed. Define the function $f:S\to \mathbb R$ by $f(x_n)=n$, which is continuous because $S$ is a discrete set. By the Tietze extension theorem, we can extend $f$ to a continuous unbounded function $g:X\to\mathbb R$.

Best Answer

Let $(s_n)_{n\in\Bbb N}$ be a sequence of elements of $S$ which converges to some element $x\in X$. Then each $s_n$ is some $x_k$. Since $x$ is not the limit of the sequence $(x_n)_{n\in\Bbb N}$, then there is some open ball $B_r(x)$ with no $x_n$ in it, with the possible exception of $x$ itself. But, since $\lim_{n\to\infty}s_n=x$, this would mean that $s_n=x$ if $n\gg1$.

This proves that the limit of every convergent sequence of elements of $S$ is an element of $S$. Therefore, $S$ is a closed set.

And it is a discrete set because, if $x_N\in S$ was not an isolated point of $S$, then there would be a sequence $(s_n)_{n\in\Bbb N}$ that would not be eventually constant and that would converge to $x_N$. But it was already proved that such a sequence does not exist.