# Maximum point of continuous function in metric space.

Let $(X,d)$ be a metric space and $f: X \rightarrow [0, \infty )$ be a continuous function. Assume that for any $\epsilon > 0$, there exists a compact set $K_\epsilon \subseteq X$ such that $f(x) < \epsilon$ whenever $x \notin K_\epsilon.$ Show that $f$ has a maximum point.

Well, for any $\epsilon > 0$, we have a compact set $K_\epsilon$ such that if $f(x) \geq \epsilon$ then $x \in K_\epsilon$. Since each $K_\epsilon$ is compact and since $f$ is continuous, I know that $f$ obtains a maximum on each non-empty $K_\epsilon$. One of these must be the biggest, so $f$ has a maximum point? Is there a better way?

• I'm afraid you are wrong. It is not always true that $f(x)\ge\varepsilon$ whenever $x\in K_{\varepsilon}$. Consider zero-function. You have made a classical logical mistake with contraposition. – szw1710 Feb 6 '17 at 15:26
• We know however that if $f(x) \geq \epsilon$, then $x \in K_\epsilon$ – Ben Grossmann Feb 6 '17 at 15:26
• @Omnomnomnom, this is, of course, correct. :) – szw1710 Feb 6 '17 at 15:27
• Whoops. Math before coffee does not work so well. :) – user389056 Feb 6 '17 at 15:28
• How do you know that $f(x)\geq\epsilon$ for some $x\in K_\epsilon$ – user178826 Feb 6 '17 at 15:32

Here's a proof: suppose that $f$ is non-zero. Let $x_0 \in X$ be such that $f(x_0) > 0$. Take $\epsilon = f(x_0)$. We know that $x_0 \in K_\epsilon$, so $K_\epsilon$ is non-empty. Moreover, $f(x) < f(x_0)$ for all $x \notin K_\epsilon$. We conclude that if the restriction $f|_{K_\epsilon}$ attains a maximum, then $f$ attains this same maximum.
So, consider the restriction $f|_{K_\epsilon}$. This is a continuous map on a compact set, so it attains a maximum.
Suppose for contradiction that $f$ attains no maximum. Then, we may construct a sequence $\{x_i\}_{i \in \Bbb N}$ such that $\{f(x_i)\}$ is strictly increasing towards a supremum. However, $x_i$ must have a subsequence with a limit in $K_{f(x_1)}$. The value of $f$ at this limit must be an overall maximum, which is a contradiction.
• It seems that no matter how you approach the problem, there is no advantage from several $K_\epsilon$s, which I find surprising. – Ben Grossmann Feb 6 '17 at 15:43
• I was considering using the finite intersection property, but in that case one still must argue that $f$ attains the desired maximum on the intersection of the $K_\epsilon$s in question. – Ben Grossmann Feb 6 '17 at 15:45