# Show that a metric space $M$ is compact iff for every continuous function $f:M\rightarrow \mathbb{R}$, such that $f(x)>0$ for all $x\in M$

everybody! Could you give me feedback if my statements below $$\Leftrightarrow$$ are correct or I need to change them?

$$\quad$$Show that a metric space $$M$$ is compact iff 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$$.

($$\Rightarrow$$)

$$\quad$$If $$A$$ is a bounded subset of $$\Bbb R$$, and if $$s=\sup A$$ then for each $$\epsilon >0$$, $$s−\epsilon$$ is not an upper bound of $$A$$ (since s is the least upper bound of $$A$$) and therefore, there is some $$a\in A$$ such that $$a>s−\epsilon$$. But, since $$s$$ is an upper bound of $$A$$, $$a\leq s$$. So, $$|s−a|<\epsilon$$. Since this occurs for every $$\epsilon>0$$, $$s\in \overline{A}$$. For a similar reason, $$\textbf{inf}$$ $$A \in \overline{A}$$. And, since $$\inf f(M)\in f(M)\subset(0,\infty)$$, there is some $$m\in M$$ such that $$\inf f(M)>0$$ and, since $$f(M)>0$$, this proves that $$\inf f(M)>0$$.

($$\Leftarrow$$)

$$\quad$$ If there is a sequence $$\{x_n\}$$ with no convergent subsequence the $$E=\{x_1,x_2,⋯\}$$ is a closed set. Define $$f:E\rightarrow (0,1)$$ by $$f(x_n)=\frac 1 n$$. Then $$f$$ is continuous. By (one form of) Tietze Extension Theorem there exists a continuous function $$F:X\rightarrow (0,1)$$ such that $$F=f$$ on $$E$$. This continuous function does not have a positive infimum. $$\textbf{(why isn't there a infimum postive?)}$$

$$\square$$

If $$M$$ is compact and $$f$$ is continuous then $$f(M)$$ is compact. The infimum of any compact subset of $$\mathbb R$$ is attained. So there exists $$t \in f(M)$$ such that $$t \leq f(x)$$ for all $$x \in M$$. Since $$t \in f(M)$$ we can write $$t=f(x_0)$$ for some $$x_0$$. Now $$\inf \{f(x): x \in N\}=f(x_0)>0$$.
• @FernandoSousa I sued two basic theorems: 1. Continuous image of a compact space is compact. 2. The infimum of a compact subset of $\mathbb R$ is attained (so the infimum is actually the minimum of the set). Dec 19 '20 at 6:26
• The Extreme Value Theorem??? Suppose that $K￼$ is a compact subset of $\mathbb{R}^n$￼, and that $f:K \to \mathbb{R}$ is continuous. Then the set $f(K)=\{f(x):x \in K\}$￼ is compact, and there exists $x_∗$￼ and $x_∗$￼ in $K$￼ such that $f(x_∗)=\sup\{f(x):x \in K\},f(x_∗)=\inf \{f(x):x \in K\}$ Dec 19 '20 at 6:48