Let $(X,d), (Y,d')$ be metric spaces. Let $f : X \to Y$ be continuous. Show that for every $x \in X$ there is an neighborhood where $f$ is constant. 
Let $(X,d), (Y,d')$ be metric spaces, where $d'$ is the discrete metric. Let $f : X \to Y$ be continuous. Show that for every $x \in X$ there is an neighborhood in which $f$ is constant.

I'm getting a bit confused with this. Since we have the discrete metric on $Y$ then for every $y \in Y$ we have a neighborhood $U= B(y,r)$ such that $U= \{y\}$.
Now from continuity I have that $\forall \varepsilon >0 $ exist $\delta >0 $ s.t  $$fB(a,\delta) \subset B(f(a), \varepsilon).$$
But $B(f(a), \varepsilon)$ seems now to be exactly the neighborhood $U$ so $B(f(a), \varepsilon) = \{f(a)\}$ e.g $$fB(a,\delta)  \subset \{f(a)\}?$$
 A: Exactly. You have proven that $f(B(a, \delta))$ must be a subset of $\{f(a)\}$.
Now, lay out what you know.

*

*You know that $B(a, \delta)$ is a neighborhood of $a$.

*You know that $f(B(a, \delta))$ is a subset of $\{f(a)\}$.

You are so close! From 2, you can conclude that $f(B(a,\delta))=\{f(a)\}$, since $\{f(a)\}$ has only one non-empty subset. So... can you conclude from here that $f$ is constant on $B(a,\delta)$?

Here are some guidelines on how the proof should look. Let's probe a slighly more general version of the statement we are interested in. In particular, the statement is:

Let $f: X\to Y$ be any function. Let $A\subseteq X$. Let $f(A)$ be a singleton, in other words, let there be some $y\in Y$ such that $f(A)=\{y\}$. Then, $f$ is constant on $A$.

Proof:
Remember that the definition of "$f$ is constant on $A$" is:

$f$ is contant on $A$ if and only if for all $a_1, a_2 \in A$, we have $f(a_1)=f(a_2)$.

Let's use this definition.
Let $a_1, a_2\in A$. Then,
[...]
[...]this is where your part of the proof comes in
[...]
We have shown that $f(a_1)=f(a_2)$. Because $a_1, a_2$ were arbitrary, we conclude that this is true for all $a_1, a_2\in A$, and therefore, by definition, $f$ is constant on $A$.
