Show that if \(f:X\to \RR\) and \(X\) is compact then \(f\) is bounded and attains its min/max.
Solution
Goal: Show that if \(f: X \to \RR\) is continuous and \(X\) is compact, then \(f\) is bounded and attains its minimum and maximum.
1. \(f(X)\) is compact in \(\RR\).
Continuous image of the compact space \(X\).
2. \(f(X)\) is closed and bounded.
Compact subsets of \(\RR\) are closed and bounded (Heine–Borel).
3. \(f\) is bounded.
\(f(X)\) bounded (<1>2) means \(f\) is bounded above and below.
4. \(f\) attains its supremum.
4.1. \(\sup f(X)\) is finite.
4.2. \(\sup f(X) \in f(X)\).
\(f(X)\) is closed (<1>2), and the supremum of a bounded set lies in its closure; since the set is closed, the supremum belongs to it.
4.3. Some \(x_{\max} \in X\) satisfies \(f(x_{\max}) = \max f\).
\(\sup f(X) \in f(X)\) means \(\sup f(X) = f(x_{\max})\) for some \(x_{\max} \in X\).
5. \(f\) attains its infimum.
Same argument as 4 with \(\inf\) in place of \(\sup\) (or apply 4 to \(-f\)).
6. Q.E.D.
3 gives boundedness; 4 and 5 give attainment of max and min.