compact subset of metric space is closed and bounded

A compact subset $$A\subseteq X$$ of a metric space $$X$$ is closed and bounded. The contrary does not hold.

I want to proof this statement. Showing that $$A$$ is closed, is not hard.

A is closed iff $$A^c$$ is open. Let $$\{U_i\}$$ be an open cover of $$A$$. Then there exists a finite set of indices $$J$$ such that $$\bigcup_{i\in J} U_i = A$$.

Now we have that $$A^c=X\setminus \bigcup_{i\in J} U_i=X\cap\bigcap_{i\in J} U_i^c$$ what is closed.

Now I want to show that $$A$$ is bounded. So I have to show that it exists $$x\in X$$ and a finite $$r>0$$ such that for every $$a\in A$$ it is $$d(x,a).

The definition is taken from here: https://en.wikipedia.org/wiki/Bounded_set#Metric_space

Well, A is compact, so I take for every $$a\in A$$ an $$\varepsilon_a>0$$. Then $$\bigcup_{a\in A} B_{\varepsilon_a(a)}$$ is an open cover of A, and thus has a finite supcover. So let $$B_{\varepsilon_{a_1}}(a_1),\dotso, B_{\varepsilon_{a_n}}(a_n)$$ be this subcover.

Then $$A=\bigcup_{i=1}^n B_{\varepsilon_{a_i}}(a_i)$$ and $$0

Now I set $$x=a_1$$. Then $$d(a_1,a) for every $$a\in A$$, since there is an ball which contains $$a$$ and thus $$d(a_1,a) should trivially hold.

Unfortunatly I can not give a crystal clear proof for this, as it seems obvious. The triangle inequality should do the trick, but I just can not figure out a good way to proof it rigorously.

For a counterexample I took simply $$(\mathbb{Q},|\cdot|)$$

Then $$M:=[0,1]\cap\mathbb{Q}$$ is closed and bounded, but not compact.

If we take for every $$q\in M$$ an $$\varepsilon_q>0$$, then $$\bigcup_{q\in M} B_{\varepsilon_q}(q)$$ is an open cover, but has not a finite subcover, since $$\mathbb{Q}$$ is dense in $$\mathbb{R}$$, so there are always irrational points contained in the subcover and there can not be equality of sets.

• "$A$ is closed iff $A^c$ is bounded." Absolutely not. Nov 10 '19 at 23:37
• @IvoTerek Thanks for pointing that out. It is a typo. I mean $A$ is closed iff $A^c$ is open. Nov 10 '19 at 23:38
• Oh, I just noticed, that I did not even showed that $A$ is closed... Wait what... Nov 10 '19 at 23:43

Suppose that $$A$$ is compact.
• $$A$$ is closed because $$A^c$$ is open. The reason is as follows: if $$x \not\in A$$, for every $$a \in A$$ there is $$r_a>0$$ such that $$B(a,r_a)\cap B(x,r_a) = \varnothing$$. So $$\{B(a,r_a)\}_{a \in A}$$ is an open cover of $$A$$. Extract a finite subcover $$\{B(a_i,r_{a_i})\}_{i=1}^n$$. Then $$x \in \bigcap_{i=1}^n B(x,r_{a_i}) \subseteq A^c$$, and this intersection is open. This shows that $$A^c$$ is open.
• $$A$$ is bounded: take a finite subcover of $$\{B(x,n)\}_{n \geq 1}$$, where $$x \in X$$ is any point chosen a priori. The union of this finite subcover is in fact one of the balls $$B(x,N)$$ for some $$N \geq 1$$, meaning that $$A\subseteq B(x,N)$$ is bounded.
For your counter-example, you have to look at $$[0,1]\cap \mathbb{Q}$$ instead of $$[0,1]$$, as $$[0,1]$$ is not a subset of $$\mathbb{Q}$$. The correct way of saying "in $$\mathbb{Q}$$" is writing this intersection.
• Thanks. The $\subseteq$ was a typo too... I meant $\cap$ lol. I think I should go to sleep. xD Nov 10 '19 at 23:57