TITLE: How do you prove the set $G = \{(x, f(x)) \mid x \in \mathbb R\}$ is closed?
QUESTION [7 upvotes]: Let $f : \mathbb R \to \mathbb R$ continuous. Prove that graph $G = \{(x, f(x)) \mid x \in \mathbb R\}$ is closed.
I'm a little confused on how to prove $G$ is closed. I get the general strategy is to show that every arbitrary convergent sequence in $G$ converges to a point in $G$.
Here is what I tried so far:

Let $x_k$ be a sequence which converges to $x$.
Since $f$ is continuous, this implies that $f(x_k)$ converges to $f(x)$.
At this point, can you say every $(x_k, f(x_k))$ converges to a $(x, f(x))$, so $G$ is closed?

REPLY [6 votes]: Almost, but when learning topology, better try to understand what is purely topological and what proper to metric spaces. Here, what you want to prove is not proper at all to metric spaces, nor to the fact that $\mathbf{R}$'s addition $(x,y)\mapsto x+y$ is continuous, but is proper to continuous maps with Hausdorff target. I will give a proof emphasizing this.
So let's show that $G$ is closed in $\mathbf{R}\times \mathbf{R}$ and to do it, let' show that its complement is open, so let $(x,y)\in \mathbf{R}\times \mathbf{R} \backslash G$. Since $(x,y)\not\in G$, we have $y\not=f(x)$. As $\mathbf{R}$ is Hausdorff (being a metric space, yes) there are disjoint open sets $U$ and $V$ in $\mathbf{R}$ such that $y\in U$ and $f(x)\in V$. Finally, $f$ is continuous, so there is an open neighbourhood $W$ of $x$ such that $f(W])\subseteq V$. By definition of the product topology, $W\times U$ is an open neighbourhood of $(x,y)$ in $\mathbf{R}\times\mathbf{R}$ and this neighbourhood is disjoint from $G$. Let $(z,f(z))$ be any point of $G$. If $z\not\in W$, then clearly $(z,f(z))\not\in W\times U$. If $z\in W$, then $f(z)\in V$, so $f(z)\not\in U$, and therefore $(z,f(z))\not\in W\times U$. So $(z,f(z))\notin W\times U$, and it follows that $(W\times U)\cap G=\varnothing$. Our open neighbourhood $W\times U$ lies in the complement of $G$. When have just show that every point of the complement of $G$ is in the interior of the complement of $G$, and this means that this complement is open.
Remark 1. Replacing the source $\mathbf{R}$ by any topological space $X$ and the target $\mathbf{R}$ by any Hausdorff topological space $Y$, the same proof as above shows that any continuous map $f : X \to Y$ from a topological space to an Hausdorff topological space has a closed graph.
Remark 2. There are counter-examples to the closedness of the graph is $Y$ is not Hausdorff. ;-)
Remark 3. If you want to give a proof using that $f$ continuous implies that the inverse image of a closed set in $Y$ is closed in $X$, do like this : as $Y$ is Hausdorff, $\Delta = \{(y,y)\;|\;y\in Y\}$ is closed in $Y\times Y$ (same style of proof as the proof I gave above) and now $G = (f\times \textrm{Id})^{-1}(\Delta)$ is closed, as $\Delta$ is and as $f\times \textrm{Id} : X\times Y\to Y\times Y$ defined by $(x,y)\mapsto (f(x),y)$ is continuous.

REPLY [2 votes]: Define at first $F:\mathbb R^2 \rightarrow \mathbb R$,$F(x,y)=f(x)-y$.
Next note that $F$ is continuous (because $f$ and "+" are continuous)
Then the graph is exactly the inverse image of $\{0\}\in \mathbb R$, hence
the graph is closed as an inverse image of a closed set under a continuous function.