For two disjoint compact subsets $A$ and $B$ of a metric space $(X,d)$ show that $d(A,B)>0.$ [duplicate]

I was thinking about the following problem: For two disjoint compact subsets $A$ and $B$ of a metric space $(X,d)$ show that $d(A,B)>0.$ I'm having doubt with my attemp. Please have a look and do comment:

Let $d(A,B)=\inf\{d(a,b):a\in A,b\in B\}=0.$ Then $\exists$ sequences $\{a_n\}\subset A,\{b_n\}\subset B$ such that $0\le d(a_n,b_n)<\dfrac{1}{n}~\forall~n.$ Since $A$ is compact, $\exists$ a convergent subsequene $\{a_{r_n}\}$ of $\{a_n\}$ converging to some $a\in A.$ Then $0\le d(a_{r_n},b_{r_n})<\dfrac{1}{r_n}~\forall~n.$ Similarly since $B$ is compact, $\exists$ a convergent subsequene $\{b_{r_{n_m}}\}$ of $\{b_{r_n}\}$ converging to some $b\in B.$ Then $0\le d(a_{r_{n_m}},b_{r_{n_m}})$$<\dfrac{1}{r_{n_m}}~\forall~m.$ We note that $r_{n_m}\ge n_m\ge m>0$$\implies0<\dfrac{1}{r_{n_m}}<\dfrac{1}{m}\to0$$\implies\dfrac{1}{r_{n_m}}\to0.$ Using the sqeezing lemma once again we can see that $\exists$ convergent sequences $\{a_n\}\subset A$ and $\{b_n\}\subset B$ such that $a_n\to a\in A,b_n\to b\in B.$ $\exists$ convergent sequences $\{a_n\}\subset A$ and $\{b_n\}\subset B$ such that $a_n\to a\in A,b_n\to b\in B.$ Then $d(a_n,b_n)\to d(a,b)$ Consequently, $d(a,b)=0\implies a=b,$ a contradiction to $A\cap B=\emptyset.$


Solution 1:

Your solution is correct. Here is another one.

Assume $d(A,B)=0$. Consider function $d(x, B)=\inf\{d(x,y):y\in B\}$ It is continuous, and defined on compact metric space $A$. So it attains its minimum, i.e. there exist $a\in A$ such that $d(a,B)=\inf\{d(x,B):x\in A\}=d(A,B)=0$. Since $d(a,B)=0$, then $a\in \operatorname{cl}_X(B)$. Since $B$ is compact it is closed, so $a\in \operatorname{cl}_X(B)=B$. Contradiction, since $A\cap B=\varnothing$.