[Math] Uniformly continuous function and compactness

compactnessgeneral-topologyuniform-continuity

If every continuous function $f:X\to\mathbb{R}$ (where $X$ is a subset of a compact metric space), is uniformly continuous, then am I right to assume that $X$ is compact as well?

I think it should but I'm not sure if I am correct. Like if $X$ is a subset of a compact metric space then shouldn't $X$ itself the domain be compact as well if $f$ is uniformly continuous?

Best Answer

Let $K$ be a compact metric space such that $X \subseteq K$. Suppose $X$ is not compact, then $X$ is not closed in $K$, hence there is a point $k \in \bar X \setminus X$. Consider the function $$ f \colon X \to \mathbb R, \quad x \mapsto \frac 1{d(x,k)} $$ ($d$ denoting the metric of $K$). Then $f$ is continuous, but not uniformly continuous, as in the letter case, $f$ would have a continuous extension to $\bar X$, which is impossible.

Related Question