Prove that a metric space $M$ is compact if, and only if, for every continuous function $f:M \rightarrow \mathbb{R}$, such that $f(x) > 0$ for all $x \in M$, we have $\inf\limits_{x\in M} f(x) >0$
The proof I made is in accordance with the corollary that says: Let $M$ be a compact metric space, and let $f:M\rightarrow \mathbb{R}$ be continuous. Then $f[M]$ is delimited, and there is $x \in M$ such that $f(x) =\inf\limits_{x\in M}f(x)>0$. $\textbf{If anyone can give me a feedback on my demo. I would be very grateful.}$
Proof: $f[M]$ is a compact subset of $\mathbb{R}$, hence closed and bounded. Now, any bounded set $A\subseteq \mathbb{R}$ has a least upper bound $\sup$ $A$ and a greatest lower bound $\inf A$, and these two points belong to the closure $\overline{A}$ (why?). But applying this to $A = f[M]$, which is closed, we conclude that $\sup$ $f[M]$ and $\inf$ $f[M]$ belong to $f[M]$ itself, which is exactly what is being claimed (why?). \
$\square$