I'm trying to find out if my demo is correct, I've already had observations and I want to know if I'm doing well :))
Let f : (X, $d_X$) → (Y, $d_Y$) be a function between the metric spaces (X, $d_X$) and (Y, $d_Y$). Prove that f is continuous if and only if for all x ∈ X and for all ε > 0 there exists δ > 0 such that for all y ∈ X : $d_X$(x,y) < δ ⇒ $d_Y$(f(x),f(y)) < ε.
Proof :
Assumption: for every x ∈ X and for every ε > 0, there exits δ > 0 such that for every y ∈ X, $d_X$(x,y) < δ ⇒ $d_Y$(f(x),f(y)) < ε.
Now let U ⊆ Y be an open set in (Y, $d_Y$). Now if $f^{-1}$(U) = ∅ then it is done. So we assume that $f^{-1}$(U) ≠ ∅. Let x ∈ $f^{-1}$(U), then f(x) ∈ U. Since U is an open set in (Y, $d_Y$) and f(x) ∈ U then there exists a real number ε > 0 such that the open ball $B_Y$(f(x), ε) = {u ∈ Y|$d_Y$(f(x), u) < ε} satisfying $B_Y$(f(x), ε) ⊆ U. So $f^{-1}$($B_{Y}$(f(x), ε)) ⊆ $f^{-1}$(U) ... (1)
Now x ∈ $f^{-1}$(U) ⊆ X, ε > 0, then from our assumption, there exists δ > 0 such that for every t ∈ X, $d_X$(x,t) < δ ⇒ $d_Y$(f(x),f(t)) < ε. Thus ∀t ∈ $B_{X}$(x, δ) ⇒ f(t) ∈ $B_{Y}$(f(x), ε). So ∀t ∈ $B_{X}$(x, δ) ⇒ t ∈ $f^{-1}$($B_{Y}$(f(x), ε)) ⇒ $B_{X}$(x, δ) ⊆ $f^{-1}$($B_{Y}$(f(x), ε)) ... (2) So from (1) and (2), we have, $d_X$(x, δ) ⊆ $f^{-1}$(U). Since x ∈ $f^{-1}$(U) is an arbitrary element, then $f^{-1}$(U) is open in (X, $d_X$). Again U ⊆ Y is also any open set in (Y, $d_Y$), then f is continuous on X.
Now f is continuous on (X, $d_X$). Let x ∈ X and ε > 0 then f(x) ∈ Y. Now we consider and open ball $B_{Y}$(f(x), ε) in (Y, $d_Y$). Clearly $B_{Y}$(f(x), ε) is an open set in (Y, $d_Y$). Since f is continuous, then $f^{-1}$($B_{Y}$(f(x), ε)) is open in (X, $d_X$). Now, f(x) ∈ $B_{Y}$(f(x), ε) ⇒ x ∈ $f^{-1}$($B_{Y}$(f(x), ε)). Since $f^{-1}$($B_{Y}$(f(x), ε)) is open in (X, $d_X$) and x ∈ $f^{-1}$($B_{Y}$(f(x), ε)), then there exists a real number δ > 0 and an open ball $B_{X}$(x, δ), such that, $B_{X}$(x, δ) ⊆ $f^{-1}$($B_{Y}$(f(x), ε)). Clearly t ∈ $B_{X}$(x, δ) ⇒ t ∈ $f^{-1}$($B_{Y}$(f(x), ε)) or, t ∈ $B_{X}$(x, δ) ⇒ f(t) ∈ $B_{Y}$(f(x), ε) or, $d_X$(x,t) < δ ⇒ $d_Y$(f(x),f(t)) < ε. Since the above holds for any x ∈ X, any ε > 0, then we are done.
Your proof is correct. I have just one little comment about the first implication you showed; you've kind of let yourself drown a little bit in notation. Let $U \subseteq Y$ be an open set. Then, for every $y \in U$, there is an $r_y$ such that $B_Y(y,r_y) \subseteq U$. In other words: $$f^{-1}(U) = \bigcup_{y \in U} f^{-1}(B_Y(y,r_y))$$ So, it is enough for you to show that the preimage of any open ball in $Y$ is open (think about why this is true based on what I just wrote). Think about why this will follow rather quickly from the $\epsilon-\delta$ definition.