Is the graph $G_f=\{(x,f(x)) \in X \times Y\ : x \in X \}$ a closed subset of $X \times Y$?

I'm thinking about Hausdorff spaces, and how mappings to Hausdorff spaces behave. Suppose I have an arbitrary (continuous) function $f:X \longrightarrow Y$, where $Y$ is a Hausdorff space (I think it is irrelevant for my question whether $X$ is Hausdorff or not, so I just consider it to be a topological space - if this is incorrect, please correct me!).

Can we say that the graph $$G_f=\{(x,f(x)) \in X \times Y\ : x \in X \}$$ is a closed subset of $X \times Y$? It seems quite obvious that it is the case, but I cannot see how to prove it. If anyone can offer a proof I'd be very interested. Regards.

EDIT 1

In response to Hennning Makholm:

I wasn't really aware of any variation in 'definition'; I guess I'm considering closed sets to be those with an open complement (though naturally this definition gives rise to other definitions, such as the subset equalling its closure etc.). For continuity of such a map, I would normally consider continuity to mean that $f^{-1}(V)$ is closed in $X$ whenever $V$ is closed in $Y$, though again definitions involving convergence of sequences and the notion that $f$ is continuous iff $f(\overline{A}) \subset \overline{f(A)}$ for every $A \subset X$ are also known to me.


Solution 1:

Suppose that $\langle x,y\rangle\in (X\times Y)\setminus G_f$. Then $y\ne f(x)$, and $Y$ is Hausdorff, so there are disjoint open $U,V$ in $Y$ such that $y\in U$ and $f(x)\in V$. Since $f$ is continuous, there is an open nbhd $W$ of $x$ such that $f[W]\subseteq V$; clearly $W\times U$ is an open nbhd of $\langle x,y\rangle$ disjoint from $G_f$.

It is necessary to require that $Y$ be Hausdorff. For a simple example, let $X=\{0,1\}$ have the discrete topology, and let $Y=\{0,1\}$ with the Sierpiński topology, whose open sets are $\varnothing,\{0\}$, and $Y$ itself. Let $f:X\to Y$ be the identity function; $f$ is certainly continuous, since $X$ is discrete, but $\langle 0,1\rangle$ is in the closure of $G_f$, since every nbhd of $\langle 0,1\rangle$ contains $\langle 0,0\rangle$.

Added: The space $Y$ in that example is $T_0$ but not $T_1$; here’s an example in which $Y$ is $T_1$. Let $X=\mathbb{N}\cup\{p\}$, where $p\notin\mathbb{N}$, and let $Y=\mathbb{N}\cup\{p,q\}$, where $q\notin\mathbb{N}$ and $p\ne q$. In both $X$ and $Y$ the points of $\mathbb{N}$ are isolated, and in both $X$ and $Y$ a local base at $p$ consists of all sets of the form $\{p\}\cup(\mathbb{N}\setminus F)$ such that $F$ is a finite subset of $\mathbb{N}$. Finally, a local base at $q$ in $Y$ consists of all sets of the form $\{q\}\cup(\mathbb{N}\setminus F)$ such that $F$ is a finite subset of $\mathbb{N}$. The points $p$ and $q$ in $Y$ do not have disjoint open nbhds; they are the only pair of points in $Y$ that cannot be separated by disjoint open sets.

Let $f:X\to Y:x\mapsto x$ be the identity function; it’s easy to see that $f$ is not just continuous, but an embedding. The point $\langle p,q\rangle\in X\times Y$ is not in $G_f$, but you can check that if $U$ is an open nbhd of $\langle p,q\rangle$ in $X\times Y$, then there is an $m\in\mathbb{N}$ such that $\langle n,n\rangle\in U$ whenever $n\ge m$, so $U\cap G_f\ne\varnothing$. Thus, $\langle p,q\rangle$ is in the closure of $G_f$.

Solution 2:

Suppose $(x,y)\in \overline {G_f}$, then there is a net $(x_\alpha,f(x_\alpha))\ (\alpha\in \Lambda)$ so that $(x_\alpha,f(x_\alpha))\to (x,y)$ by the definition of the product topology $x_\alpha$ converges to $x$ and $f(x_\alpha)$ converges to $y$ since $f$ is continuous $f(x_\alpha)$ converges to $f(x)$. Since $Y$ is Hausdorff limits are unique hence $y=f(x)$. Thus, $(x,y)\in G_f$ so $G_f$ is closed.