Let $X$ a topological space and $(Y, d)$ a metric space. Let $f: X \rightarrow Y$ a function. Then, $f$ is continuous iff $\forall \, x \in X \, \, \, \forall \, \epsilon >0 \, \, \, \exists \, U \subset X$ open neighborhood of $x$ such that $d(f(x), f(y)) < \epsilon \, \, \forall \, y \in U$.
I know how to prove a similar statement for a map between metric spaces (using as definition that if $f$ is continuous, then $f^{-1}(U)$ is open for all $U \subset Y$ open set), but it didn't worked in this case.
Any suggestions? Thanks in advance!
From the condition to continuity of $f$: let $O$ be open in $Y$. We want to show that $f^{-1}[O]$ is open in $X$. So let $X \in f^{-1}[O]$, so we know that $y:=f(x) \in O$. As $O$ is open in the metric space $(Y,d)$ we have some $\varepsilon>0$ such that $$B(y, \varepsilon) \subseteq O$$
Applying the condition to $x,\varepsilon$ we get some open neighbourhood $U$ of $x$ such that for all $p \in U$ we have $d(y, f(p)) < \varepsilon)$. This means that for all $p \in U$, $f(p) \in B(y,\varepsilon)$ and so for all $p \in U$, $f(p) \in O$ and so $$\forall p \in U: p \in f^{-1}[O]$$
and this shows that $U \subseteq f^{-1}[O]$ and so $x$ is an interior point of $f^{-1}[O]$. As $x$ was arbitary, $f^{-1}[O]$ is open in $X$.
From continuity to the condition is similar and even simpler: given $x$ and $\varepsilon >0$ the set $O= B(f(x), \varepsilon)$ is open in $Y$ so $x \in f^{-1}[O]$ and the latter set is open (as $f$ is continuous), call it $U$ and check it obeys what we want: all points $y$ in $U$ map to $O$ which is the open ball so $d(f(y), f(x)) < \varepsilon$.