[proofplan]
We prove the equivalence directly from the $\varepsilon$-$\delta$ definition of continuity for metric spaces. If $f$ is continuous, then near any point mapping to $y$, the choice
\begin{align*}
\varepsilon &= \frac{1}{2}
\end{align*}
forces nearby points to map exactly to $y$, so the fiber over $y$ is open. Conversely, if every fiber is open, then for each point $x_0\in X$ the open fiber through $x_0$ supplies a radius on which $f$ is constant; this gives the $\varepsilon$-$\delta$ condition for the [discrete metric](/page/Discrete%20Metric).
[/proofplan]
[step:Use continuity to show that each point fiber is open]
Assume that $f:(X,d_X)\to (Y,d_Y)$ is continuous. Fix $y\in Y$ and define the fiber
\begin{align*}
A_y := f^{-1}(\{y\}) = \{x\in X : f(x)=y\}.
\end{align*}
We prove that $A_y$ is open in $X$. Let $x_0\in A_y$. Since $f$ is continuous at $x_0$, applying the $\varepsilon$-$\delta$ definition with
\begin{align*}
\varepsilon &= \frac{1}{2}
\end{align*}
gives a number $\delta_{x_0}>0$ such that, for every $x\in X$,
\begin{align*}
d_X(x,x_0)<\delta_{x_0} \implies d_Y(f(x),f(x_0))<\frac{1}{2}.
\end{align*}
Because $x_0\in A_y$, we have $f(x_0)=y$. In the discrete metric, the only distances strictly smaller than $\frac{1}{2}$ are zero, so $d_Y(f(x),f(x_0))<\frac{1}{2}$ implies $f(x)=f(x_0)=y$. Hence
\begin{align*}
B_X(x_0,\delta_{x_0}) \subset A_y,
\end{align*}
where $B_X(x_0,\delta_{x_0}) := \{x\in X : d_X(x,x_0)<\delta_{x_0}\}$ is the open ball in $(X,d_X)$.
Thus every point of $A_y$ is contained in an open ball lying inside $A_y$, so $A_y$ is open in $X$. Since $y\in Y$ was arbitrary, $f^{-1}(\{y\})$ is open in $X$ for every $y\in Y$.
[/step]
[step:Use open fibers to prove the epsilon-delta condition]
Assume conversely that $f^{-1}(\{y\})$ is open in $X$ for every $y\in Y$. We prove that $f$ is continuous at every point of $X$.
Fix $x_0\in X$ and define
\begin{align*}
y_0 := f(x_0).
\end{align*}
The fiber
\begin{align*}
A_{y_0} := f^{-1}(\{y_0\})
\end{align*}
is open in $X$ by hypothesis, and $x_0\in A_{y_0}$ by definition of $y_0$. Therefore there exists a radius $r_{x_0}>0$ such that
\begin{align*}
B_X(x_0,r_{x_0}) \subset A_{y_0}.
\end{align*}
Let $\varepsilon>0$ be arbitrary. Define
\begin{align*}
\delta := r_{x_0}.
\end{align*}
If $x\in X$ satisfies $d_X(x,x_0)<\delta$, then $x\in A_{y_0}$, so $f(x)=y_0=f(x_0)$. Hence
\begin{align*}
d_Y(f(x),f(x_0))=0<\varepsilon.
\end{align*}
This proves continuity of $f$ at $x_0$. Since $x_0\in X$ was arbitrary, $f$ is continuous on $X$.
[guided]
We assume that every point fiber is open and want to prove metric continuity. The relevant continuity condition is local at a point: for each $x_0\in X$ and each $\varepsilon>0$, we must find a radius $\delta>0$ such that points within $\delta$ of $x_0$ have images within $\varepsilon$ of $f(x_0)$.
Fix $x_0\in X$. The value of $f$ at this point is an element of $Y$, so define
\begin{align*}
y_0 := f(x_0).
\end{align*}
Now consider the fiber over this value:
\begin{align*}
A_{y_0} := f^{-1}(\{y_0\}) = \{x\in X : f(x)=y_0\}.
\end{align*}
By the hypothesis of this direction, $A_{y_0}$ is open in $X$. Also $x_0\in A_{y_0}$, because $f(x_0)=y_0$ by definition.
The definition of openness in the [metric space](/page/Metric%20Space) $(X,d_X)$ now gives a radius $r_{x_0}>0$ such that the open ball
\begin{align*}
B_X(x_0,r_{x_0}) := \{x\in X : d_X(x,x_0)<r_{x_0}\}
\end{align*}
satisfies
\begin{align*}
B_X(x_0,r_{x_0}) \subset A_{y_0}.
\end{align*}
This is the key point: inside this ball, the function $f$ is not merely close to $f(x_0)$; it is equal to $f(x_0)$. Let $\varepsilon>0$ be arbitrary and set
\begin{align*}
\delta := r_{x_0}.
\end{align*}
If $x\in X$ satisfies $d_X(x,x_0)<\delta$, then $x\in B_X(x_0,r_{x_0})$, hence $x\in A_{y_0}$. Therefore $f(x)=y_0=f(x_0)$, and the discrete metric gives
\begin{align*}
d_Y(f(x),f(x_0))=0<\varepsilon.
\end{align*}
Thus the $\varepsilon$-$\delta$ condition holds at $x_0$. Since the point $x_0\in X$ was arbitrary, $f$ is continuous on $X$.
[/guided]
[/step]
[step:Combine the two implications]
The first step proves that continuity of $f$ implies openness of every fiber $f^{-1}(\{y\})$. The second step proves that openness of every fiber implies continuity of $f$. Therefore $f:(X,d_X)\to(Y,d_Y)$ is continuous if and only if $f^{-1}(\{y\})$ is open in $X$ for every $y\in Y$.
[/step]