# A continuous function and a closed graph

Suppose I would like to show that for 2 metric spaces $A,B$, a function $f:A\to B$ and the graph of $f$, $G=\{(a,f(a))\in A\times B|a\in A\}$ that

$f$ is continuous IFF $G$ is closed (with an additional condition for the $(\Leftarrow)$ direction -- $B$ is compact)

My thoughts are

$(\Rightarrow) a_k\to a \implies f(a_k)\to f(a)$, therefore $(a_k,f(a_k))\to (a,b)\implies (a,b)\in A\times B$.

My doubts are that do I need to say something about the product metric? As far as I know there isn't a unique definition for it. Also this "proof" seems to be too simple -- I think it might be lacking in something.

$(\Leftarrow)$ Suppose $a_k\to a$, Then since $G$ is compact, given a sequence $(a_k, f(a_k))$, we can find a subsequence $(a_{k_n}, f(a_{k_n}))$ that converges (I am not sure what this law is, I hope I haven't confused the context and that it is really applicable here.) Since the limit is in $G$, therefore $f(a_{k_n})\to f(a)$ for $a_{k_n}\to a$. Therefore $f$ is continuous.

Again, I think there might be holes in my argument, or perhaps even wrong assumptions.

Please teach me to fix it. Thanks!

-
Hint: Metric spaces are Hausdorff so the limit $(a,b)$ is unique, so $b=f(a)$ as wanted. – Asaf Karagila May 6 '12 at 21:59
Did you mean to assume at the top that $G$ is compact? Compactness of $B$ doesn't imply this. – Brian M. Scott May 6 '12 at 22:05
You still have at least one thing left to do, because proving a subsequence of the $f(a_k)$ converges to $f(x)$ does not say anything about the original sequence's convergence. – rschwieb May 6 '12 at 22:10
@BrianM.Scott: Actually I was really given that $B$ is compact, not $G$. Does that mean my argument is wrong? – Allen May 6 '12 at 22:31
@AsafKaragila: THanks, that refers to the $(\Rightarrow)$ argument right? I didn't realize that metric spaces are Hausdorff at all! – Allen May 6 '12 at 22:34

For the $(\Rightarrow)$ direction, start, as you did, with an arbitrary point $a\in A$ and a sequence $\langle a_k:k\in\Bbb N\rangle$ converging to $a$. Because $B$ is compact, $\langle f(a_k):k\in\Bbb N\rangle$ has a convergent subsequence; say $\langle f(a_{n_k}):k\in\Bbb N\rangle\to b$. Now you want to show that $b=f(a)$ and that the sequence $\langle f(a_k):k\in\Bbb N\rangle$ converges to $b$. We've already used compactness of $B$, so this must be where the assumption that $G$ is closed comes in. Can you take it from here? If not, just ask, and I'll expand this a bit further.

Added: Let $p=\langle a,b\rangle$. You can easily show that that $$\Big\langle\langle a_{n_k},f(a_{n_k})\rangle:k\in\Bbb N\Big\rangle\to p\;.$$ Since the sequence lies in the closed set $G$, we must have $p\in G$, and hence $f(a)=b$. But we're still not quite done, because so far we know only that the subsequence $\langle f(a_{n_k}):k\in\Bbb N\rangle$ converges to $b$, and we need to conclude that $\langle f(a_k):k\in\Bbb N\rangle\to b$. It clearly can't converge to anything else, but it conceivably might not converge. To prove that it does, just show that every subsequence converges to $b$. This does still require a little work.

-
Thank you for writing the answer! I think since $G$ is closed, any convergent sequence in $G$ must have limit in $G$. So $(a_k,f(a_{k}))$ must converge to $(a,f(a))\in G$. Then by the uniqueness of the limit it follows that $f(a)=b$. Is this right? – Allen May 6 '12 at 22:53
@Allen: Almost, but you need to do a little more work. Let me respond by editing my answer rather than by trying to fit it into a comment. – Brian M. Scott May 6 '12 at 22:56
Thanks, but at the risk of being really stupid: I am not sure how to prove that every subsequence converges. But the intuitive feeling is that it should follow from $a_k\to a$ and $G$ closed... – Allen May 6 '12 at 23:39
Take a subsequence of $\langle f(a_k):k\in\Bbb N\rangle$. Use the compactness of $B$ to get a convergent subsequence of the subsequence, say converging to $b'$. Use the same argument that we used before to show that $b'=f(a)$ and hence $b'=b$. (Let me know if you want me to incorporate that into my answer.) – Brian M. Scott May 6 '12 at 23:42

I remember doing a similar problem where working by contradiction was easier.

Suppose $a_i$ converges to $a$ but $f(a_i)$ does not converge to $f(a)$. Then there exists an $\epsilon>0$ such that for all $N\in \mathbb{N}$, there exists an $i_N>N$ such that $a_{i_N}\notin B(f(a),\epsilon)$.

If $B$ is compact, then there is a subsequence $b_i$ of the $a_{i_N}$ such that $f(b_i)$ converges. Then the sequence $(b_i,f(b_i))$ must converge (since each of its coordinates converge) and since the graph is closed it converges to a point $(b,f(b))$. But then it follows that $b=a$, and so $f(b_i)$ converges to $f(b)=f(a)$, however this is an absurdity because every element of any subsequence of $f(a_{i_N})$ is more than $\epsilon$ from $f(a)$.

Hence, $f$ preserves convergent sequences, and is continuous.

-
THank you, rschwieb! – Allen May 7 '12 at 7:36