2

Let $(X,d)$ be compact and $f:X \rightarrow \mathbb{R}$ be continuous. Then if $X$ is compact, $f(X)$ is also compact. Compact subsets of $\mathbb{R}$ are closed and bounded. By the completeness axiom $f(X)$ must have a lowest upper bound and greatest lower bound. Thus, $f$ attains maximum and minimum values.

We now prove the opposite direction by contrapositive. Let $X = \mathbb{R}$. Then $X$ is not compact. The function $f(x) = x$ has no upper bound, and thus attains no maximum value. Therefore there exists a continuous function $f : X \rightarrow \mathbb{R}$ that does not attain maximum and minimum values.

1 Answers1

1

From the comments above.


For the forward direction, for the sake of clarity you can add that $f$ attains its maximum and minimum because the $\sup$ and $\inf$ of $f(X)$ are limit points of $f(X)$ and since it is closed, they lie in $f(X)$.

For the opposite direction, you chose $X = \mathbb{R}$, but you are supposed to examine whether for any $X$, every continuous function to the reals attaining a $\max$ and $\min$ implies compactness of $X$.