[Math] $A \subset \mathbb{R}^n$. If every continuous function $f: A \rightarrow \mathbb{R}$ is is bounded and attains its bounds then A is compact.

compactnessmetric-spaces

I'm doing a metric spaces course and got stuck on proposition. I have a feeling that I want to show that $A$ is bounded and closed then use Heine-Borel theorem. The proposition states that $f$ is bounded and attains its bounds so I don't know how to show that $A$ is bounded and closed. It just seems obvious and I seem to be going around in a circular argument.

Best Answer

Since $A\subset \mathbb R^n$, then in order to show that $A$ is compact, it suffices to show that $A$ is bounded and closed.

$A$ is bounded. Clearly the function $f:A\to\mathbb R$, with $f(x)=\|x\|$ is continuous, and as it has to be bounded, then there exists an $M>0$, such that $f(x)=\|x\|\le M$, for all $x\in A$. But this means that $A$ is bounded.

$A$ is closed. If not, then there exists a sequence $\{x_n\}_{n\in\mathbb N}\subset A$, with $x_n\to x_0\not\in A$. Then the function $\,f:A\to\mathbb R$, with $$ f(x)=\frac{1}{\|x-x_0\|}, $$
in continuous and unbounded. A contradiction, and hence $A$ is closed.

Altogether, indeed $A$ is compact.

Note. Another way to obtain contradiction, is by observing that the function $g(x)=\|x-x_0\|$ is also continuous, but it does not attain a minimum. The infimum of $f$ is equal to zero, while $f$ takes only positive values.