Determining whether a metric space is Compact or not If $X$ is a compact metric space and $f$ is a continuous function from $X$ to real numbers, then $f$ is uniformly continous.
My question is is there any metric space such that every continous function is uniformly continous? If there exist such metric space can we conclude that $X$ is compact?
 A: As already observed there are non-compact spaces like $\mathbb N$ where every continuous function is uniformly continuous. I will answer the question raised in the comments about the case of connected metric spaces.
Suppose every real continuous function on a connected
metric space $X$ is uniformly continuous. We claim that $X$ is compact. In fact connectedness can be replaced by the weaker condition that $X$ has no isolated points.
Suppose $X$ has a sequence $\{x_{n}\}$ with no convergent subsequence.
Choose positive numbers $\delta _{n},n=1,2,...$ such that $B(x_{n},\delta
_{n})$ does not contain any $x_{m}$ with $m\neq n$ and $\delta _{n}<\frac{1}{%
n}$ $\forall n.$ Since $x_{n}$ is not an isolated point for any $n$  we can find distinct points $x_{n,m},m=1,2,...$
in $B(x_{n},\delta _{n})\backslash \{x_{n}\}$ converging to $x_{n}$ as $%
m\rightarrow \infty $ (for $n=1,2,...$). We may suppose $d(x_{n,m},x_{n})<%
\frac{1}{n}$ $\forall n,m.$ Let $A=\{x_{n,n}:n\geq N\}$ and $B=\{x_{n}:n\geq
1\}$. Claim: $A$ is closed. Suppose $x_{n_{j},n_{j}}\rightarrow y$. Then $%
d(y,x_{n_{j}})\leq
d(y,x_{n_{j},n_{j}})+d(x_{n_{j},n_{j}},x_{n_{j}})<d(y,x_{n_{j},2m_{j}})+%
\delta _{n_{j}}\rightarrow 0$. Thus $x_{n_{j}}\rightarrow y.$ Since $%
\{x_{n}\}$ has no convergent subsequence it follows that $\{n_{j}\}$ is
eventually constant and hence $y=\underset{j}{\lim }$ $x_{n_{j},n_{j}}$
belongs to $A.$ Clearly $B$ is also closed. Further, $A\cap B=\emptyset $.
Let $f:X\rightarrow \lbrack 0,1]$ be a continuous function such that $%
f(A)=\{0\}$ and$\ f(B)=\{1\}$. By hypothesis $f$ is uniformly continuous.
Note that $d(A,B)\leq d(x_{n},x_{n,n})<\frac{1}{n}$ $\forall n.$ Thus $%
d(A,B)=0$ and, by uniform continuity $d(f(A),f(B))=0.$ This contradicts the fact
that $f(A)=\{0\}$ and$\ f(B)=\{1\}$. This contradiction shows that $X$ is
compact.
