Let $(X,d)$ be a compact metric space. Let $f:X\to X$ be a function such that graph(f)=$(G(f))=\{(x,f(x):x\in X\}$ is closed.
Prove that $f$ is continuous.
TRY:
To show that $f$ is continuous enough to show that if $x_n\to x$ then $f(x_n)\to f(x)$.
Let $x_n\to x$ ;; since $X$ is compact so $f(x_n)$ has a convergent subsequence say $f(x_{n_k})\to y$. Consider the corresponding terms in the sequence $x_n$ then $(x_{n_k },f(x_{n_k}))\to (x,y).$
Now $(x_{n_k },f(x_{n_k}))\in G(f)$ which is closed hence $(x,y)\in G(f))$ which in turn implies that $y=f(x)$
So $f(x_{n_k})\to f(x)$.
But I need to show that $f(x_n)\to f(x)$
How can I show that??Please help me out.