# Show that a function is continuous iff it is constant

show that a function from $\mathbb{R}$ with the standard metric to $\mathbb{R}$ with the discrete metric is continuous if and only if it is constant.

The solution states to use the $\epsilon, \delta$ definition to show that $f$ is piecewise constant, then use the derivative of $f$ to explain why $f$ is constant.

I'm having troubles understand this solution, what I take it as, I have to show that $f$ is continuous $\implies$ f is constant. So, $f$ being continuous in these two metric spaces means that $\forall \epsilon > 0 , \exists \delta > 0, \text{ s.t. } |x-y|< \delta \text{ and } x,y \in \mathbb{R} \implies d(f(x),f(y)) < \epsilon$? If so, I'm not sure how to go about showing $f$ is constant from here

Hint: Consider $\epsilon = 1/2$. Then $$d_{discrete}(f(x), f(y)) < \epsilon \iff f(x) = f(y)$$
• Hi, where did you get that from? My definition of discrete is that $d(x,y) = 0$ if $x = y$ and $d(x,y) = 1$ otherwise – DH. Apr 26 '15 at 18:37
• @DH. Yes. So, if $d(x,y)<\frac{1}{2}$, you must have $d(x,y)=0$. Hence $x=y$. – Joe Johnson 126 Apr 26 '15 at 18:41