If $A, B \subseteq X$ and $A \cap B \neq \emptyset$, then $\text{diam}(A \cup B) \leq \text{diam}(A) + \text{diam}(B)$

metric-spacesreal-analysissolution-verification

I am starting to learn about Metric Spaces and I am trying to have a look at some exercises and came across this question:

Let $(X, d)$ be a metric space, and let $A, B \subseteq X$. If $A \cap B \neq \emptyset$, show that
\begin{equation*}
\text{diam}(A \cup B) \leq \text{diam}(A) + \text{diam}(B)
\end{equation*}

where $\text{diam}(S) = \sup_{x, y \in S} d(x, y)$

I have attempted this problem as follows:

Proof. We want to show that $\text{diam}(A \cup B) \leq \text{diam}(A) + \text{diam}(B)$. If $x, y \in A$, then we have that
\begin{equation*}
d(x, y) \leq \sup_{x, y \in A} d(x, y) = \text{diam}(A)
\end{equation*}

and if $x, y \in B$, then
\begin{equation*}
d(x, y) \leq \sup_{x, y \in B} d(x, y) = \text{diam}(B)
\end{equation*}

Finally, consider $x \in A$ and $y \in B$. Then for $z_1 \in A$ and $z_2 \in B$, using the Triangle Inequality gives us
\begin{equation*}
d(x, y) \leq \text{diam}(A \cup B) \leq d(x, z_1) + d(z_1, z_2) + d(z_2, y) \leq \sup_{x, z_1 \in A} d(x, z_1) + \sup_{z_2, y \in B} d(z_2, y) = \text{diam}(A) + \text{diam}(B)
\end{equation*}

I am not exactly sure if the last line I've mentioned is correct. I would appreciate some assistance on this.

Best Answer

Your last line is not correct, since you're likely to use $d(z_1, z_2)\leq 0$, which is NOT generally true, unless $z_1=z_2$, which is to say, $z_1=z_2\in A\cap B$, so now you see why the condition $A\cap B\neq \emptyset$ is given, and you clearly didn't make full advantage of this condition. To help you understand the proof better, I write an official proof below.

To prove $$\sup_{x, y \in A\cup B} d(x, y)=\text{diam}(A \cup B) \leq \text{diam}(A) + \text{diam}(B),\tag{$*$}$$ we need to prove that for any $x, y\in A\cup B$ there holds $$d(x, y)\leq \text{diam}(A) + \text{diam}(B),\tag{$**$}$$ then using the definition of supremum gives the desired result $(*)$.

For any $x, y\in A\cup B$, there are three cases. If $x, y\in A$, then $d(x,y)\leq \text{diam}(A)\leq\text{diam}(A) + \text{diam}(B)$. If $x, y\in B$, then $d(x,y)\leq \text{diam}(B)\leq\text{diam}(A) + \text{diam}(B)$. Otherwise, we have $x\in A, y\in B$ or $x\in B, y\in A$. WLOG we assume that $x\in A, y\in B$. Since $A\cap B\neq \emptyset$, there exists $z\in A\cap B$, hence by triangle inequality, $$d(x,y)\leq d(x, z)+d(z, y)\leq \text{diam}(A) + \text{diam}(B).$$ This verifies $(**)$ and the proof is complete.