Let $Y$ be compact and the graph of $f$ be closed, prove that $f$ is continuous Let $Y$ be compact and the graph of $f$ be closed, prove that $f : X \rightarrow Y$ is continuous.
This is exercise 6.1.3b from Set Theory and Metric Spaces by Irving Kaplansky. This is a problem about metric spaces, I am not very familiar with topological spaces.
My reasoning goes as follows
We want to show that if we have a sequence $x_n$ in $X$ that converges to $x$, then $f(x_n)$ converges to $f(x)$ in $Y$.
So, let $x_n$ be a convergent sequence in $X$. By applying $f$ to the sequence, we get a new sequence, $f(x_n)$ in $Y$. Now, $Y$ is compact and hence we can find a  subsequence that converges, hence we have a sequence $f(x_{n_k})$ that is convergent. Now, consider this sequence of $x_{n_k}$ in $X$. Since the entire sequence $x_k$ converges, so must $x_{n_k}$ also converge to $x$. Hence, must our sequence $f(x_{n_k})$ converge to $f(x)$. This is where I am stuck. How can I show that the entire sequence of $f(x_k)$ converges to $f(x)$ and not just a subsequence?
 A: Let us denote by $a=\lim_{n\to\infty} x_n$ and $b=\lim_{k\to\infty}f(x_{n_k})$.
The sequence $((x_{n_k},f(x_{n_k}))_{k\ge0}$ converges to $(a,b)$ which must belong to the graph (because of the assumption that the graph is closed), hence $b=f(a)$.
This proves that every convergent subsequence of $(f(x_{n_k}))_{k\ge0}$ converges to $b$. Since $Y$ is compact, this proves [see below] that $(f(x_n))_{n\ge0}$ converges to $b$.

Lemma Let $Y$ be a compact metric space and $(y_n)$ a sequence whose terms belong to $Y$. If every convergent subsequence of $(y_n)$ converges to the same limit $\ell\in Y$, then $(y_n)$ converges to $\ell$.
Proof Suppose the contrary. Then, there exists $\epsilon>0$, such that :
$$\forall N\in\mathbb{N},\,\exists n\ge N;\,d(y_n,\ell)>\epsilon$$
This allows us to construct a subsequence $(y_{n_k})$ such that :
$$\forall k\in\mathbb{N},d(y_{n_k},\ell)>\epsilon$$
Now extract from $(y_{n_k})$ a convergent subsequence : its limit $\ell'$ will verify $d(\ell',\ell)\ge\epsilon$ ... 
A contradiction !
