Proving the validity of a metric on $X \sqcup Y$.
I am trying to solve the below problem.
Let $X$ and $Y$ be metric spaces and consider the set $Z := X \sqcup Y$. Let $C$ be a positive constant. Define a function $\rho: Z \times Z \to \mathbb{R}^{\geq 0}$ by \begin{cases} & \rho_Z (x_1, x_2) = \rho_X (x_1, x_2) \\ & \rho_Z (y_1, y_2) = \rho_Y (y_1, y_2) \\ & \rho_Z (x,y) = \rho(y,x) = C. \end{cases} Show that $\rho$ is a metric if and only if for any $x_1, x_2 \in X$ and $y_1, y_2 \in Y$, we have $$ \rho_X (x_1, x_2) \leq 2C \text{ and } \rho_Y (y_1, y_2) \leq 2C. $$
My first thought is that $X$ and $Y$ are not required to be disjoint, so the definition of $Z$ is a bit uncertain. In this case, I believe disjoint union is defined by taking isomorphic copies of $X$ and $Y$ were the elements are distinct, e.g., by replacing $x$ with $(x,0)$ or some similar construction. This does present a question of whether I need to test for consistency across definitions for elements $x_1 \in X \cap Y$ (or $y_1 \in X \cap Y$). Otherwise, the metric is not well-defined. Since it's given as a well-defined functions, I assume these complications have been assumed away, but I can't say that I fully understand how. In other words, does the definition quietly replace $X$ with $X'$ and $Y$ with $Y'$, where $X \cong X'$ and $Y \cong Y'$ as sets, update the distance function, and then take $x_1, x_2 \in X'$ and $y_1, y_2 \in Y'$?
Here is my attempt at a proof.
($\Leftarrow$) Suppose for any $x_1, x_2 \in X$ and $y_1, y_2 \in Y$, we have $\rho_X (x_1, x_2) \leq 2C$ and $\rho_Y (y_1, y_2) \leq 2C$. We check that $\rho$ gives a metric on $Z$.
By definition, for any $z_1, z_2 \in Z$, $\rho(z_1, z_2) \geq 0$. If $z_1 = z_2$, then we either have $z_1 = z_2$ in $X$ or $z_1 = z_2$ in $Y$. (This assumes $X$ and $Y$ have been replaced with isomorphic copies that are disjoint, but I still am not fully clear on this step.) Since $\rho_X$ and $\rho_Y$ are metrics on $X$ and $Y$, respectively, the former yields $\rho_Z (z_1, z_2) = \rho_X (z_1, z_2) = 0$ and the latter yields $\rho_Z (z_1, z_2) = \rho_Y (z_1, z_2) = 0$.
By definition (the third line in the definition), $\rho_Z$ is symmetric.
Let $z_1, z_2, z_3 \in Z$. We must show that $$ \rho_Z (z_1, z_2) \leq \rho_Z (z_1, z_3) \leq \rho_Z (z_2, z_3)$. $$ This also seems to be "inherited" by restricting to either $X$ or $Y$ and using the triangle inequality established on $\rho_X$ and $\rho_Y$. I haven't used the assumption, so I must be doing something wrong, and the trick must be in mixing elements of $X$ and $Y$.
($\Rightarrow$) Suppose that $\rho$ is a metric. Then for any $x,y \in Z$, we have $\rho_Z (x,y) = C \leq 2C$ since $C > 0$. This is true regardless of whether $x,y$ originally lived in $X$ or $Y$.
The above proof sounds almost trivial, so I think I could also be misunderstanding the definition there.
Solution 1:
The concept of the disjoint union is specifically designed to let you assume that $X$ and $Y$ are disjoint subsets of $Z = X \sqcup Y$.
You could choose to avoid that assumption and to work with the set theoretic formalities of the disjoint union, but I would only advise doing that if you can avoid tying yourself in knots (don't work with $X$ and $Y$ themselves, instead work with $X' = \{(x,0) \mid x \in X\}$ with the metric on $X$ transported to $X'$; and similarly work with $Y' = \{(y,1) \mid y \in Y\}$).
Anyway, if you are willing to assume that $X$ and $Y$ are disjoint subsets of $Z = X \sqcup Y$, then your proof is perfectly fine as far as it goes, and as you observe it's rather a trivial matter, and there's nothing wrong with that. However, you do have a gap in your proof. Letting $z_1,z_2,z_3 \in Z$, you should be more careful to break into cases depending on which of $z_1,z_2,z_3$ are in $X$ and which are in $Y$, which makes 8 cases in all. For example: in the case that $z_1 \in X$ and $z_2 \in Y$ and $z_3 \in X$ we have $d(z_1,z_2) + d(z_2,z_3) = C + C = 2C$, and $d(z_1,z_3) \le 2C$.