# How to prove the continuity of the metric function?

Given a metric space $(X,d)$, how to prove that the function $d \colon X \times X \to \mathbf{R}$ is continuous?

If we take any two arbitrary real numbers $a$ and $b$ such that $a < b$, then we need to show that the set $d^{-1} (a,b)$ given by

$$d^{-1} (a,b) := \{ (x, y) \in X \times X | a < d(x,y) < b \}$$

is open in the product topology on $X \times X$.

A basis for this product topology is the collection of all cartesian products of open balls in $(X,d)$.

For $a, b ∈ ℝ$, let $(x,y) ∈ d^{-1} (a..b)$, i.e. $a < d(x,y) < b$. Now choose $ε$ such that $U_{2ε} (d(x,y)) ⊂ (a..b)$ and look at $U_ε (x) × U_ε (y)$.
For any tuple of points $(x',y') ∈ U_ε (x) × U_ε (y)$ you have $$d(x',y') ≤ d(x',x) + d(x,y) + d(y,y') < d(x,y) + 2ε$$ as well as $$d(x,y) ≤ d(x,x') + d(x',y') + d(y',y) < d(x',y') + 2ε$$ This means $a < d(x,y) - 2ε < d(x',y') < d(x,y) + 2ε < b$.
Therefore $U_{ε} (x) × U_{ε} (y) ⊂ d^{-1} (a..b)$.
• Sorry, I didn't recognize the notation, but by $(a..b)$ do you mean the set of all real numbers from $a$ to $b$ exclusive (i.e. the open interval)? – Jason Nichols Jul 16 '16 at 21:07
• Yeah, it’s a notation introduced by Knuth, I believe. It’s quite handy. It avoids the confusion of regarding $(a,b)$ both as a tuple and as an open interval. See the good notations thread on mathoverflow. – k.stm Jul 17 '16 at 17:53