# Existence of a continuous function not taking on its maximum value at uncountably many points?

Let $$X$$ be a compact metric space. Does there always exist a continuous $$f : X \to \mathbb{R}$$ such that $$\{ x \in X : f(x) = \| f \|_{\infty} \}$$ is at most countable?

Certainly this is true for $$[0,1]^n$$, take $$f(x_1,\ldots,x_n) = x_1 + \cdots + x_n$$. It seems it should hold in general but I'm not sure how to attempt to prove that.

• Since $X$ is compact $m:=\max_{x,y \in X} d(x,y)$ exists. Fix any $x_0 \in X$ and set $f(x)=m-d(x,x_0)$. Then $0 \le f \le m$ on $X$ and $f(x)=m$ iff $x=x_0$. Hence $\{x \in X: f(x)=\|f\|_\infty\}=\{x_0\}$.
– Gerd
Oct 23, 2023 at 20:27
• Actually the difficulty is in the "metric space" condition, i.e. defining a distance: that is probably not possible to get separation on sets $X$ that have a greater cardinal than $\mathbb R$. Oct 23, 2023 at 21:10
• It is always possible in a perfectly normal space, regardless of its cardinality. Oct 23, 2023 at 21:38
• @freakish You are right, I was dumb. There is the trivial distance $d(x,y)=1$ if $x \ne y$, $d(x,y)=0$ if $x = y$. Oct 24, 2023 at 9:20

Take any point $$x$$ in $$X$$ and let $$f(y) = \frac 1 {1+d(x,y)}$$, where $$d$$ is the distance of metric space $$X$$.

Then $$f$$ is continuous, because $$d$$ is continuous in $$y$$ (a distance is always continuous).

$$f$$ reaches its maximum $$1$$ only on $$x$$, because of the separation property of a distance.

The compactness condition is not needed.

• The set $\{y \in X: f(y)=\|f\|_\infty\}$ is unclear to me in this example. If $X$ is not compact even $\|f\|_\infty = \infty$ is possible.
– Gerd
Oct 23, 2023 at 20:43
• One could take $(1-d(x,y))_+$ instead. Oct 23, 2023 at 20:46
• @Gerd You are right. I forgot how the infinite norm was defined. So I have to change $f$ definition. Oct 23, 2023 at 20:51
• @Gerd Now it should be correct. Oct 23, 2023 at 20:58
• @LL3.14 Yes that would work too. Oct 23, 2023 at 20:59