show that a distance function is continuous
Solution 1:
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)\;.$$
Solution 2:
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.