Continuous Image of Compact Space is Compact/Corollary 3

Corollary to Continuous Image of Compact Space is Compact
Let $f: S \to \R$ be a real-valued function.

If $S$ is a compact space, then $f$ attains its bounds on $S$.

Proof
By Corollary 2, $f \left({S}\right)$ is bounded.

By Closure of Real Interval, $\sup \left({f \left({S}\right)}\right) \in \operatorname {cl} \left({f \left({S}\right)}\right)$ and $\inf \left({f \left({S}\right)}\right) \in \operatorname {cl} \left({f \left({S}\right)}\right)$.

By the above and Compact Subspace of Hausdorff Space is Closed, $f \left({S}\right)$ is closed in $\R$.

Hence $\sup \left({f \left({S}\right)}\right) \in f \left({S}\right)$ and $\inf \left({f \left({S}\right)}\right) \in f \left({S}\right)$.

Hence the result.

Alternatively, one could reason as follows:

By the main theorem, $f \left({S}\right)$ is compact.

By the Heine-Borel Theorem (General Case), $f \left({S}\right)$ is complete and totally bounded.

A totally bounded metric space is bounded.

Hence the supremum $\sup f \left({S}\right)$ and the infimum $\inf f \left({S}\right)$ exist.

Because $f \left({S}\right)$ is complete, $\sup f \left({S}\right) \in f \left({S}\right)$ and $\inf f \left({S}\right) \in f \left({S}\right)$.