Is this function continuous? Let $Y=\oplus_{i \in N}Y_i$ and $Y_i$ is the metriable space $[0,1]$ for each $i \in N$.  $x_n \in Y$ denotes that $x_n \in Y_n$ and $0\le x_n \le 1$. $d$ is the usual metric on $[0,1]$. We define a function $f$ from $Y^2$ to $[0,1]$ as following: 
$f(x_n,y_m)=d(x_n,y_m)$, if $n=m$; otherwise, $f(x_n,y_m)=\frac{1}{n}+\frac{1}{m}$.
Is this function $f$ continuous? And how to prove it?
 A: The connected components of $Y^2$ are of the form $Y_i \times Y_j$.  All of these components are (closed and) open, so they form an open cover of $Y^2$.  Since the restriction of $f$ to each component in the cover is continuous, $f$ itself is also continuous.
To prove this from first principles, consider what the preimage $U$ of an open subset $V$ of $[0,1]$ under $f$ must look like.  (Specifically, consider the intersection of $U$ with each of the connected components mentioned above.  You'll find that they're all open, meaning that $U$ is a union of open sets, and thus open.)
A: Since Y is metrizable, you can also prove it via convergent sequences. 
For notational convenience I’ll write $Y=\omega\times[0,1]$. A sequence $\left\langle\langle n_k,x_k\rangle:n\in\omega \right\rangle$ in $Y$ converges to $\langle n,x\rangle$ iff $\langle x_k:k\in\omega\rangle\to x$ in $[0,1]$ and $n_k=n$ for all sufficiently large $k$, so a sequence $$\Big\langle\big\langle\langle n_k,x_k\rangle,\langle m_k,y_k\rangle\big\rangle:k\in\omega\Big\rangle$$ converges to $\big\langle\langle n,x\rangle,\langle m,y\rangle\big\rangle$ in $Y^2$ iff $\langle x_k:k\in\omega\rangle\to x$ in $[0,1]$, $\langle y_k:k\in\omega\rangle\to y$ in $[0,1]$, and $n_k=n$ and $m_k=m$ for all sufficiently large $k$. If $n\ne m$, the sequence $$\Big\langle f\big(\langle n_k,x_k\rangle,\langle m_k,y_k\rangle\big):k\in\omega\Big\rangle$$ is eventually constant with value $\frac1n+\frac1m$, and if $n=m$ it’s eventually just the sequence of $|x_k-y_k|$, which certainly converges to $|x-y|$. Thus, $f$ preserves convergent sequences and is therefore continuous.
