# Hausdorff distance for compact sets

Let $(X,d)$ be a metric space, and $comp(X)$ denote the collection of compact sets of $X$. For every $K_1,K_2\in com(X)$, we define $$d_H(K_1, K_2) = \inf\{r>0\ |\ d(x,K_2), d(y,K_1) < r,\ \text{for all }x\in K_1, y\in K_2\}$$ I need to show that this defines a metric over $comp(X)$.

I have two questions:

1. For the triangle inequality, I have proven that for all $x\in K_1$, $d(x,K_2) \leq d_H(K_1,K_2) + d_H(K_2,K_3)$ and symmetrically for all $y\in K_2$. This would have been enough if the inequality was strict, because then $d_H(K_1,K_2) + d_H(K_2,K_3) \in \{r>0\ |\ d(x,K_2), d(y,K_1) < r,\ \text{for all }x\in K_1, y\in K_2\}$, which yields the needed inequality. But, the inequality is not strict, hence I cannot infer this. How can I proceed?
2. Why is compactness needed? I have proven all these properties of metric using only the closeness of compact sets. What fails if the sets are not compact?

Note: I use only notions from metric space theory, no knowledge in topology exists.

• Ad 1, you can for example add $\varepsilon > 0$ to $d_H(K_1,K_2) + d_H(K_2,K_3)$ to have a strict inequality to work with, and at the end let $\varepsilon \to 0$. Or you can argue that $\inf \{ r > 0 \mid \cdots \leqslant r \cdots\}$ doesn't change the definition, and then work with the nonstrict inequality. – Daniel Fischer Dec 10 '16 at 16:17
• @DanielFischer Thank you, it worked perfectly. Any clue about 2? – Joshhh Dec 10 '16 at 16:30
• Compactness is not needed. The Hausdorff metric defines a metric on the set of all nonempty bounded closed sets in a metric space. The nonempty compact sets certainly meet these conditions, so they're always contained in the Hausdorff metric space. – Glitch Dec 10 '16 at 16:38
• The obvious thing is that if your space isn't bounded, the corresponding $d_H$ also attains the value $+\infty$ if all closed sets are considered. Off the top of my head, I'm not sure what happens if one looks at the family of bounded closed sets. I think $d_H$ should still be a metric. But the family of bounded closed sets is just not as interesting as the family of compact sets. – Daniel Fischer Dec 10 '16 at 16:38
• @DanielFischer So, boundedness is needed for the set $\{r>0\ |\ d(x,K_2),d(y,K_1) < r,\ \text{for all }x\in K_1, y\in K_2\}$ to not be empty? – Joshhh Dec 10 '16 at 16:41