Throughout, membership in an open ball is as in Open Ball in a Metric Space §membership, preimages are as in Sets and Maps: Ordinary Notation §images, and dX and dY are symmetric by Metric Space §symmetric.
Continuity implies that preimages of open sets are open. Assume f is continuous, let V⊆Y be open in (Y,dY), and let x∈f−1(V), so that f(x)∈V. By Open Subset of a Metric Space §open there is a real ε>0 with BdY(f(x),ε)⊆V. By Continuous Map Between Metric Spaces §continuous, f is continuous at x, so, ε being chosen, Continuous Map Between Metric Spaces §continuous-at gives a real δ>0 such that every y∈X with dX(x,y)<δ satisfies dY(f(y),f(x))<ε. Let y∈BdX(x,δ); then y∈X and dX(x,y)<δ, so dY(f(x),f(y))=dY(f(y),f(x))<ε, whence f(y)∈BdY(f(x),ε)⊆V and y∈f−1(V). Thus BdX(x,δ)⊆f−1(V). As x was an arbitrary point of the subset f−1(V) of X, f−1(V) is open in (X,dX) by Open Subset of a Metric Space §open.
Openness of preimages implies continuity. Assume that f−1(V) is open in (X,dX) for every subset V of Y open in (Y,dY). Let x∈X, let ε>0 be real, and put V=BdY(f(x),ε).
By Open Ball in a Metric Space is Open §open, V is open in (Y,dY).
Hence U=f−1(V) is open in (X,dX) by assumption. Since dY(f(x),f(x))=0<ε by Metric Space §zero, f(x)∈V and x∈U. By Open Subset of a Metric Space §open there is a real δ>0 with BdX(x,δ)⊆U. Let y∈X with dX(x,y)<δ. Then y∈BdX(x,δ)⊆U, so f(y)∈V, that is, dY(f(x),f(y))<ε, and dY(f(y),f(x))<ε by symmetry. As ε was arbitrary and δ was chosen after it, f is continuous at x; as x∈X was arbitrary, f is continuous by Continuous Map Between Metric Spaces §continuous.