$f$ non-constant on $\mathbb R$ such that for any metric $d$ on $\mathbb R$ , $f:(\mathbb R,d)\to (\mathbb R,d)$ is continuous , is $f$ identity? Let $f:\mathbb R \to \mathbb R$ be a non-constant function such that for any metric $d$ on $\mathbb R$ , $f:(\mathbb R,d)\to (\mathbb R,d)$ is continuous , then is $f$ the identity function i.e. $f(x)=x, \forall x \in \mathbb R$ ?
[ background : Similar in spirit to this one To characterize uncountable sets on which there exists a metric which makes the space connected     , it is easy to see that if $f:\mathbb R \to \mathbb R$ is a function such that for any two metric $d_1,d_2$ on $\mathbb R$ , $f:(\mathbb R,d_1) \to (\mathbb R,d_2)$ is continuous , then taking $d_2$ to be discrete metric and $d_1$ to be euclidean metric , $f$ is seen to be constant . So I wondered what would happen if we want the same metric on both domain and co-domain , in this case I have not been able to make any progress ; the techniques used in Does there exist a metric $d$ on $\mathbb R$ such that the map $f:(\mathbb R,d) \to (\mathbb R,d)$ ; $f(x)=-x$ is not continuous?  seems to be rather special , only holding for the particular function $f$  ...  ] 
 A: The second question you linked will let you answer the question, I think. What you are asking $f$ to hold is a lot, so [if what I'm saying is right] f probably must be the identity function or constant.
Suppose not. Then, as $f$ is continuous with the Euclidean metric, and there is a point $x_o$ where $f(x_0) \neq x_0$, there is a whole ball $B$ around $x_0$ where $f(x)\neq x\ \forall\ x \in B$.
For simplicity, I'm going to assume that $f$ is not constant in $B$. It could be, but the argument could be fixed anyway (tell me if you want me to fix it).
Pick $x_1,x_2 \in B$ so that the images are different. Then, by Bolzano in $\mathbb{R}$ with the Euclidean metric, $f$ takes all the intermediate values there. Now you can use the same arguments that were used here Does there exist a metric $d$ on $\mathbb R$ such that the map $f:(\mathbb R,d) \to (\mathbb R,d)$ ; $f(x)=-x$ is not continuous?.
A: Let $g \colon \mathbb{R} \rightarrow \mathbb{R}$ any bijection and define a metric $d_g(x,y) = d(g(x),g(y))$ where $d$ is the standard metric on $\mathbb{R}$. Then the function $g \colon (\mathbb{R}, d_g) \rightarrow (\mathbb{R}, d)$ is an isometry and in particular continuous with a continuous inverse. If $f \colon (\mathbb{R}, d_g) \rightarrow (\mathbb{R}, d_g)$ is continuous, then so must be $g \circ f \circ g^{-1} \colon (\mathbb{R}, d) \rightarrow (\mathbb{R}, d)$. Thus, your $f$ must satisfy that $g \circ f \circ g^{-1}$ is continuous for all bijective functions $g$ when the standard metric is used on both the domain and codomain. Let $x_0 \in \mathbb{R}$, set $y_0 := f(x_0)$ and assume $x_0 \neq y_0$. Then, we can choose $\delta > 0$ such that the intervals $(x_0 - \delta,x_0+ \delta), (y_0 - \delta, y_0 + \delta)$ are disjoint. Choose a bijection $g$ such that $g|_{(x_0 - \delta,x_0 + \delta)} = \operatorname{id}$ and $|g(y) - g(y_0)| > 1$ for all $y \in (y_0 - \delta, y_0 + \delta) \setminus \{ y_0 \}$. But then $g \circ f \circ g^{-1}$ cannot be continuous at $x = x_0$ unless $f(x) = f(x_0)$ for all $x$ near $x_0$. This shows that the sets
$$ \{ x \in \mathbb{R} \, | x < f(x_0), f(x) = f(x_0) \}, \{ x \in 
\mathbb{R} \, | \, x > f(x_0), f(x) = f(x_0) \}  $$
are non-empty, open and closed and so must be $(-\infty,f(x_0))$ and $(f(x_0), \infty)$ respectively showing that $f \equiv f(x_0)$.
