[Math] If $X$ is compact and $f:X\to\mathbb{R}$ is continuous, then $f$ attains the values $\inf\{f(x):x\in X\}$ and $\sup\{f(x):x\in X\}$

general-topologyreal-analysis

I need to show that if $f$ is continuous real valued function on the compact space $X$,
then there exist points $x_1,x_2\in X$ such that $f(x_1)=\inf\{f(x):x\in X\}$ and $f(x_2)=\sup\{f(x):x\in X\}$.

Now since $X$ is compact then $f(X)$ is compact as the continuous image of a compact space. And what is next? Also in a T2 space a compact space is closed and bounded. So f[X] being in the Reals is compact thus bounded thus it has a infimum and a supremum?

Best Answer

Since $f(X)$ is compact it is closed and bounded. Every closed set contains all it's limit points. $\inf\{f(x):x \in X\}$ and $\sup\{f(x):x \in X\}$ are limit points of $f(X)$ and thus in $f(X)$. Since $f$ is a function there must be a point in the domain which corresponds to every point in the image. This shows the existence of $x_1$ and $x_2$.