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?
Best Answer
Your approach is absolutely correct.