# Space on which all real-valued continuous functions achieve maximum but not compact?

A friend is writing a book for non-mathematicians; he has asked me some questions... One possible direction I suggested was whether a topological space (metric space can probably be assumed given what he said) for which every real-valued function achieves its maximum must be compact; and, if not, does this property have a name?

He thought this probably did not work, but neither one of us has an example. There is a bookstore nearby which has copies of Counterexamples in Topology as well as Counterexamples in Analysis, and I can go browse them when I'm over jet lag. Meanwhile, for any students confused by these topics (topology and analysis) or not seeing the motivation, counterexamples are the best way to understand the limitations of a theorem and why it was worth proving in the first place.

• Related previous question. – user642796 Jun 4 '15 at 21:20
• @ArthurFischer, yes! I did look at several questions the system suggested while I was composing this, I imagine this one was in that list but I did not notice it. – Will Jagy Jun 4 '15 at 21:35
• If you co not have Steen-Seebach at had, you can also look inline in pi-base. – Martin Sleziak Jun 5 '15 at 7:22

A non-metric counterexample is $\omega_1$, the space of countable ordinals, with the natural order topology. If $f:\omega_1\to\Bbb R$ is continuous, there are an $\eta<\omega_1$ and an $x\in\Bbb R$ such that $f(\xi)=x$ whenever $\eta<\xi<\omega_1$, and $[0,\eta]$ is compact, so $f$ must attain its maximum.

However, clearly a space with this property is pseudocompact, and every pseudocompact metric space is compact, so there are no metric counterexamples.

• Wonderful. Thank you, I will tell him. – Will Jagy Jun 4 '15 at 17:51
• @Will: You’re welcome. Good luck to him. – Brian M. Scott Jun 4 '15 at 17:51

At least in metric spaces, this is true. To see this, first assume you have a set unbounded. Then just choose a sequence such that all members are separated by some minimal distance $\epsilon > 0$, and then order the sequence arbitrarily as $x_n$ and define the function $f(x_n) = n$ and $f(x) = 0$ at all other points. This can be extended to a continuous function, if desired. It does not achieve its maximum.

Then assume you have a set that is not closed. Then take any limit point not in the set, call it $x_0$, and define the function $f(x) = 1 - d(x,x_0)$. It does not achieve its maximum, and is continuous.

• This is lovely. Thank you. – Will Jagy Jun 4 '15 at 17:51
• I'm assuming you're using the Heine-Borel theorem for metric spaces (proofwiki.org/wiki/Heine-Borel_Theorem/Metric_Space). If so, am I right to read "you have a set unbounded" as "the space is not totally bounded," and "you have a set that is not closed" as "the space is not complete"? – Vectornaut Jun 4 '15 at 21:14

Compactness in a metric space is equivalent to the space being sequentially compact. For a non-compact metric space $(X,d)$, there exists a function $f:X\rightarrow\mathbb R$ such that $f$ does not achieve a maximum. To show this, realize that, being non-compact, $(X,d)$ must not be sequentially compact, so there exists a sequence $\{x_n\}\subset X$ such that $\{x_n\}$ has no convergent subsequent. This means that for all $x\in X\setminus\{x_n\}$, there exists $\varepsilon>0$ such that $B(x,\varepsilon)$ is disjoint for $\{x_n\}$. Thus, $\{x_n\}$ is a closed subset of $X$. Define $\tilde f:\{x_n\}\rightarrow\mathbb R$ to be $f(x_n)=n$. We know that $f$ is continuous on $\{x_n\}$ since $\{x_n\}$ inherits the discrete topology from $X$ (since there are no limit points), and so every function defined thereon is continuous. Then, employing the Tietze extension theorem, $\tilde f$ extends to a continuous function $f:X\rightarrow\mathbb R$ which we know to be unbounded since it is already unbounded on $\{x_n\}$.