Show that $\operatorname{diam}(A\cup B)\le \operatorname{diam}(A)+\operatorname{diam}(B)+d(A,B)$

I'm beginning to study metric spaces and I see this question

Consider $A$ and $B$ bounded and non-empty subsets of $M$, where $M$ is a metric space.
Show that $\operatorname{diam}(A\cup B)\le \operatorname{diam}(A)+\operatorname{diam}(B)+d(A,B)$.

Does anyone know how can I do?


Solution 1:

For any two points $a,b\in A\cup B$, there are three cases:

  1. $a,b\in A$, then $d(a,b)\le diam(A)$.
  2. $a,b\in B$, then $d(a,b)\le diam(B)$.
  3. $a\in A$ and $b\in B$, then for any $x\in A,y\in B$: $$d(a,b)\le d(a,x)+d(x,y)+d(y,b)\le diam(A)+d(x,y)+diam(B).$$ Now, take $\inf$ of the right hand side.