# If every real-valued continuous function is bounded on $X$ (metric space), then $X$ is compact.

Let $X$ be a metric space. Prove that if every continuous function $f: X \rightarrow \mathbb{R}$ is bounded, then $X$ is compact.

This has been asked before, but all the answers I have seen prove the contrapositive. Realistically, this may be the way to go, but is there way to exhibit an unbounded continuous function (under the assumption $X$ is not compact) without appealing to results beyond introductory real analysis (e.g., the solution I've seen involves the Tietze Extension theorem)?

Because we're working with metric spaces, it's clear that the assumption that $X$ is noncompact (towards proving contrapositive) will lead us to extract a sequence of points in the space with no convergent subsequences. But how can we infer the existence of an unbounded continuous on the space knowing only about some sequence of points in this space (without using anything too advanced)?

• It turns out that pseudocompactness and compactness are equivalent for metric spaces: math.stackexchange.com/questions/668905/… Since a metric space is compact iff it is complete and totally bounded, it follows that pseudocompactness implies completeness. – Math1000 Dec 12 '14 at 22:11
• @Math1000 Wrong link... – YuiTo Cheng Jun 7 '19 at 14:33

But how can we infer the existence of an unbounded continuous on the space knowing only about some sequence of points in this space

By using the sequence to construct an unbounded continuous function.

Since the sequence - call it $(x_n)_{n\in\mathbb{N}}$ - has no convergent subsequence, every point occurs only finitely many times in the sequence. Passing to a subsequence, we may assume all the $x_n$ are distinct.

For every $m\in\mathbb{N}$, the distance of $x_m$ to the rest of the sequence is positive,

$$\delta_m := \inf \left\{ d(x_m,x_k) : k \in \mathbb{N}\setminus \{m\}\right\} > 0,$$

for if $\delta_m = 0$, then $(x_n)$ would have a subsequence converging to $x_m$.

Now consider the functions

$$f_m(x) = \left(1 - \frac{3}{\delta_m}d(x_m,x)\right)^+,$$

where $u^+$ is the positive part of $u$, $u^+ = \max \{u,0\}$. These functions are continuous since the maximum of two continuous functions is continuous. The function

$$f(x) = \sum_{m=0}^\infty m\cdot f_m(x)$$

is, if well-defined, unbounded, since $f(x_m) \geqslant m$.

It remains to see that $f$ is well-defined and continuous. That follows if we can show that every point $x\in X$ has a neighbourhood on which at most one of the $f_m$ attains values $\neq 0$.

If $x = x_m$ for some $m\in\mathbb{N}$, then $f_k\lvert B_{\delta_m/3}(x_m) \equiv 0$ for all $k\neq m$: Suppose we had $f_k(y)\neq 0$ for some $y\in B_{\delta_m/3}(x_m)$ and some $k\neq m$. Then

$$\max \{\delta_k,\delta_m\} \leqslant d(x_m,x_k) \leqslant d(x_m,y) + d(y,x_k) \leqslant \frac{\delta_m}{3} + \frac{\delta_k}{3} \leqslant 2\frac{\max \{\delta_m,\delta_k\}}{3} < \max \{\delta_k,\delta_m\},$$

so that is impossible.

If $x \neq x_m$ for all $m$, the argument is similar. Let $\delta = \inf \{ d(x,x_n) : n\in\mathbb{N}\}$. Then $\delta > 0$ for otherwise the sequence would have a subsequence converging to $x$. Then on $B_{\delta/4}(x)$ at most one $f_m$ can attain a nonzero value. Suppose again it weren't so, and also $f_k$ attained a nonzero value there. Then we have $y,z \in B_{\delta/4}(x)$ with $f_m(y) \neq 0$ and $f_k(z) \neq 0$. That implies $\frac{3}{4}\delta < \frac{1}{3}\min \{ \delta_m,\delta_k\}$ since $d(y,x_m) \geqslant d(x,x_m) - d(x,y) \geqslant \frac{3}{4}\delta$ and similarly for $x_k$. But then we would have

$$0 < \max \{ \delta_m,\delta_k\} \leqslant d(x_m,x_k) \leqslant d(x_m,y) + d(y,z) + d(z,x_k) \leqslant \frac{\delta_m}{3} + \frac{1}{2}\delta + \frac{\delta_k}{3} < \max \{\delta_m,\delta_k\}.$$

Since every point has a neighbourhood on which at most one $f_k$ does not identically vanish, $f$ is well-defined and continuous.

• Daniel Fischer said that since every point has a neighbourhood on which at most one $f_k$ attains values $\neq 0$ , then $f$ is well-defined and continuous.I have no idea what is going on and I thought it for a long time . Could someone tell me what is going on ? – user584393 Aug 22 '18 at 7:49
• @LiAlex For every $x$, only finitely many terms of the series are nonzero (either one term or none here), so the series converges at every point. Thus $f$ is well-defined. And if $S \subset X$ is a set on which all but finitely many of the functions vanish identically, then the series converges uniformly on $S$. Let $x \in X$, and take an open neighbourhood of $x$ on which only finitely many of the terms (here we can choose it so that it's only one term) don't vanish identically for $S$. Then, since each term is continuous, and the convergence is uniform on $S$, it follows that $f$ is … – Daniel Fischer Aug 22 '18 at 8:12
• … continuous on $S$. Since $x$ was arbitrary, $f$ is globally continuous. – Daniel Fischer Aug 22 '18 at 8:12
• The argument for 2. is essentially the same. If all but finitely many of the $f_m$ vanish identically on $S$, then there is a $k$ such that $f_m$ vanishes identically on $S$ for all $m > k$. Then for all $r \geqslant k$ we have $$\sum_{m = 1}^r mf_m(y) = \sum_{m = 1}^k mf_m(y)$$ for all $y \in S$. So on $S$ we have $$f(y) - \sum_{m = 1}^r mf_m(y) = 0$$ for every $r \geqslant k$, in particular $$\sup_{y \in S}\: \Biggl\lvert f(y) - \sum_{m = 1}^r mf_m(y)\Biggr\rvert < \varepsilon$$ for all $\varepsilon > 0$ if $r \geqslant k$. – Daniel Fischer Aug 22 '18 at 11:40
• @RabiKumarChakraborty I make the assumption that some $f_k$ with $k \neq m$ does not vanish identically on $B_{\delta_m/3}/x_m)$, and from that assumption I obtain a contradiction, namely $f_k(y) \neq 0$ implies $d(y,x_k) < \frac{\delta_k}{3}$, and that cannot be when $d(y,x_m) < \frac{\delta_m}{3}$. – Daniel Fischer Apr 24 at 22:09

Another approach: Assume $X$ is not compact, so that there exists a sequence $a_n$ in $X$ that has no converging subsequence, and denote $A$ to be the underlying set of this sequence. Define $f:A\to R$ via $f(a_n)=n$. It is continuous on A, and $A\subset X$ is a closed set, so by the Tietze extension theorem $f$ extends to a (non-bounded) function on all of $X$.

• I actually gravitated towards these ideas when I found this problem in Munkres (this problem appears in the section on the Tietze extension theorem). The only problem I had was showing that $A$ is closed and that $f$ is continuous. How did you prove these? – user193319 Feb 12 '18 at 14:09
• @user193319 1. $A$ is closed since it is sequentially closed - any converging sequence in $A$ has its limit in $A$, since such a sequence does not exist! 2. You should note that $A$ has the discreet topology. You can see easily using sequences that any point in $A$ is open. Any map from a discreet space is continuous. – Espace' etale Feb 13 '18 at 22:20
• $X$ is not necessary $C_2$ space, so you can’t use Tietze extension. – XT Chen Nov 2 '19 at 8:37
• You don't need C_2 for tietze. Normality is enough. – Espace' etale Nov 3 '19 at 9:47
• So are there no metric spaces in which every real continuous function are bounded, but does not attain its bound? – Saikat Goswami Jul 17 at 1:08

You can say the following: consider a sequence $(x_n)$, which has no convergent subsequence. Then, inductively, you can construct a sequence of positive numbers $\varepsilon_n$ such that $\overline{B(x_n,\varepsilon_n)}\cap\overline{B(x_m,\varepsilon_m)}=\emptyset$ for all $n\neq m$. Then, define a function $f$ as follows: $$f(x)=\left\{\begin{array}{c l}n\left(1-\frac{d(x,x_n)}{\varepsilon_n}\right), & x\in B(x_n,\varepsilon_n)\\ 0, & {\rm otherwise}\end{array}\right.$$ Then $f$ is continuous and not bounded.

• Nice! Perhaps $n(1-\frac{d(x,x_n)}{\epsilon_n})$ is better? – Jonathan Y. Feb 8 '14 at 23:08
• Ah, right, $n\varepsilon_n$ might not go to $\infty$. – detnvvp Feb 8 '14 at 23:13
• I remark that the continuity of $f$ is intuitively clear (from the picture in our head of $\Bbb R^2$ or $\Bbb R^3$) but does require proof. – Greg Martin Feb 8 '14 at 23:15
• @JonathanY. Right, thanks! – detnvvp Feb 8 '14 at 23:17