TITLE: show that a distance function is continuous
QUESTION [16 upvotes]: Let $X$ be a metric space with metric $d$. Define $d: X \times X \to \mathbb{R}$, show that $d$ is continuous.
I would like to show that the function is continuous the topology way (since it is a course on topology). 
Let $(a,b)$ be a basic open set in $\mathbb{R}$, then $d^{-1}(a,b) = \{(x,y): a<d(x,y)<b\}$. Define $A= \bigcup_{x \in X} B_{b} (x)$, where $B_b (x) = \{y \in X| d(x,y)<b$}. Clearly $A$ is open. Now define $C = \{(x,y):d(x,y)>a \}.$ Essentially I hope that $A \cap C$ is open. But I am stuck in showing that $C$ is open.
Any help please? :)

REPLY [7 votes]: HINT: Suppose that $d(x,y)>a$. Let $r=\frac12\big(d(x,y)-a\big)$. If $\langle u,v\rangle\in B_r(x)\times B_r(y)$, then 
$$d(x,y)\le d(x,u)+d(u,v)+d(v,y)\;,$$
so $$d(u,v)\ge d(x,y)-d(x,u)-d(v,y)\;.$$

REPLY [4 votes]: To show that $d^{-1}(a,b)$ is open, you need to specify for each point $(x,y)$ in it a basic open set of the product topology (yes, we should use properties of the product topology somewhere), i.e. a set of the form $U\times V$ with $u,V$ open, $x\in U$, $y\in V$.
As $X$ is a metric space, we may try open balls $U=B_r(x)$, $V=B_r(y)$ for suitable $r$.
How can we choose $r>0$ to enforce $B_r(x)\times B_r(y)\subseteq d^{-1}(a,b)$? (Simply translate what this means) You will need (alas!) the defining properties of metric for this.