# Let $f:X\rightarrow\textbf{R}$ be continuous and $X$ compact. Then $f$ is bounded and $f$ attains its maximum and its minimum at some points in $X$

Let $$(X,d)$$ be a compact metric space, and let $$f:X\rightarrow\textbf{R}$$ be a continuous function. Then $$f$$ is bounded. Furthermore, $$f$$ attains its maximum at some point $$x_{max}\in X$$ and also attains its minimum at some point $$x_{min}\in X$$.

MY ATTEMPT

Since $$f$$ is continuous, it maps compact sets onto compact sets.

Once compact sets are closed and bounded, we conclude that $$f(X)$$ is closed and $$f(X)\subseteq [-L,L]\subset\textbf{R}$$.

Given that $$f(X)$$ is bounded, it admits a supremum $$M = \sup f(X)$$ and an infimum $$m = \inf f(X)$$.

But both $$m$$ and $$M$$ are adherent points of $$f(X)$$. Thus $$f(X)\ni m$$ and $$f(X)\ni M$$.

In other words, $$m = f(x_{min})$$ for some $$x_{min}\in X$$ and $$M = f(x_{max})$$ for some $$x_{max}\in X$$, as previously mentioned.

Any comments or contributions to my solution?

• looks good. I've never seen "adherent points." They are limit points, and hence contained in the image of $f$ by closedness. Assuming thats what you mean, it makes sense to me – Andres Mejia May 11 '20 at 22:52
• The book which I am reading makes a distinction between adherent points and limit points. It says that $x\in\textbf{R}$ is an adherent point of $E$ iff for every $\varepsilon > 0$ there exists a $y\in E$ such that $|x-y|\leq\varepsilon$. It also says that $x\in\textbf{R}$ is a limit point of $E$ iff it is an adherent point of $E\backslash\{x\}$. – APCorreia May 11 '20 at 23:24
• I have just included it. Thanks for the comment. – APCorreia May 11 '20 at 23:50