Is $f(x,y) = d(x,y)$ a continuous function from a Metric space $X \times X$ to $\mathbb R$? where $(X , d)$ is a metric space.
My Attempt :
I think it is.
If we take any open ball of radius $\epsilon > 0 $ , $(a-\epsilon , a+\epsilon)$ in $\mathbb R$. , We will get an open preimage in $X \times X$.
The preimage will be the union of all $A \times B$ where $A$ and $B $ are open balls of radius $\frac{\epsilon}{2}$ in $X$ whose centers are $a$ units apart.
Have I gone wrong anywhere?
Can anyone please check If I am correct or wrong?
Your attempt is interesting, but not correct. Consider the set$$S=\{(x,y)\in X\times X\,|\,d(x,y)=a\}.$$You claimed that$$f^{-1}\bigl((a-\varepsilon,a+\varepsilon)\bigr)=\bigcup_{(x,y)\in S}B_{\frac\varepsilon2}(x)\times B_{\frac\varepsilon2}(y).$$This would indeed prove that $f$ is continuous, but actually you only have$$f^{-1}\bigl((a-\varepsilon,a+\varepsilon)\bigr)\supset\bigcup_{(x,y)\in S}B_{\frac\varepsilon2}(x)\times B_{\frac\varepsilon2}(y).$$I sugest that you prove that $f^{-1}\bigl((a-\varepsilon,a+\varepsilon)\bigr)$ is a neighborhood of all of its points.