Let be $A, B$ disjoint sets with $d(A,B) = 0$ in a metric space $M$ compact. Show that $\partial A \cap \partial B \neq \emptyset$.
My attempt:
Suppose that $\partial A \cap \partial B = \emptyset$. If $p \in \partial A$, so $\forall \epsilon > 0$, $B(p, \epsilon) \cap A \neq \emptyset$ and $B(p, \epsilon) \cap (M-A) \neq \emptyset$. On the other hand, $p \notin \partial B$, so exists $r > 0$ such that $B(p, r) \subset B$ or $B(p, r) \subset (M-B)$. It's clear that $B(p, r) \subset B$, because $p \in \partial A$ and $A \cap B = \emptyset$ (this last one by hypothesis), so $d(p,B) > 0$, in particular, exists $b \in B$ such that $d(p,b) > 0$, therefore, $d(p,b) \leq d(p,a) + d(a,b)$, $\forall a \in A$ and $\forall b \in B$, because $p \in \partial A$ and $d(A, B) = 0$, $d(p,b) \leq d(p,a) + d(a,b) < \frac{1}{2n} + \frac{1}{2n}$, $\forall n \in \mathbb{N}$, so, taking the limit when $n \longrightarrow \infty$, we have $d(p,b) \leq d(p,a) + d(a,b) < 0$, so $d(p,b) < 0, \forall a \in A, \forall b \in B$, but $d(p,b) > 0$ for some $b \in B$ and here we have a contradiction, so $p \in \partial A \cap \partial B$ $\square$.
I know this proof it isn't correct because I didn't use the compactness of the space $M$, but I have no idea how use compactness here. Can someone help me? Thanks in advance!
The first and most basic error in your proof is that you don't necessarily know that any element $p\in\partial A$ exists at all. Even given $p$, you can't necessarily choose $a\in A$ and $b\in B$ such that $d(p,a)<\frac{1}{2n}$ and $d(a,b)<\frac{1}{2n}$ (you can choose $a$ such that $d(p,a)<\frac{1}{2n}$, and you can choose a different $a'$ and $b$ such that $d(a',b)<\frac{1}{2n}$, but there's no reason you can choose $a'$ to be the same as $a$).
Here's a hint on how you can use compactness. Since $d(A,B)=0$, you can find sequences $(a_n)$ in $A$ and $(b_n)$ in $B$ such that $d(a_n,b_n)<1/n$ for all $n$. Use compactness to show you can assume these sequences both converge, and then think about what you can say about their limits.