# $f$ is Continuous if and only if its Graph is Closed in $X \times Y$

Let $$f: X \to Y$$; let $$Y$$ be compact Hausdorff. Then $$f$$ is continuous if and only if $$G_f = \{(x,f(x)) \mid x \in X \}$$ is closed.

Here is my shot at a proof:

Suppose that $$f : X \to Y$$ is continuous, and let $$(x,y) \in \overline{G_f}$$ but assume $$y \neq f(x)$$. As $$Y$$ is Hausdorff, there exists $$U,V$$ open in $$Y$$ and disjoint such that $$y \in U$$ and $$f(x) \in V$$. Since $$V$$ is a nbhd of $$f(x)$$ and $$f$$ is continuous, there exists an $$O \subseteq X$$ that is open and contains $$x$$ such that $$f(O) \subseteq V$$. Since $$O \times U$$ is an open nbhd of $$(x,y)$$, there must be some $$(p,q) \in G_f \cap O \times U$$. This means $$p \in O$$ and that $$f(p)=q \in U$$. But $$f(O) \subseteq V$$, so $$U$$ and $$V$$ must intersect--a contradiction. Hence $$y= f(x)$$ and $$G_f$$ must be closed.

Now we show the other direction. Suppose that $$G_f$$ is closed, let $$x \in X$$ be arbitrary, and let $$V$$ be a open nhbd of $$f(x)$$. Then $$Y-V$$ is closed, and therefore the intersection $$C:=G_f \cap [X \times (Y-V)]$$ is closed in $$X \times Y$$. By an earlier problem, we know that $$\pi_1$$ is a closed map and so $$\pi_1(C)$$ is closed in $$X$$, and therefore $$X-\pi_1(C)$$ is open. I will argue that $$x \in X-\pi_1(C)$$ by contradiction. If $$x$$ were in $$\pi_1(C)$$, then there would exist a $$p \in X$$ and a $$q \in Y-V$$ such that $$f(p)=q$$ and $$x= \pi_1(p,f(p))$$ or $$x=p$$. But this would mean $$f(x)=q \in Y-V$$ or $$f(x) \notin V$$, which contradicts the assumption that $$V$$ is a nbhd of $$f(x)$$. Hence $$x \in X - \pi_1(C)$$.

Now we argue that $$a \in f^{-1}(V)$$ if and only if $$a \notin a \notin \pi_1(C)$$. Suppose that $$a \in \pi_1(C)$$. Then $$a = \pi(p,f(p))$$ or $$a=p$$ where $$f(p) \in Y-V$$. This means that $$f(a) \in Y - V$$ and therefore $$a \notin f^{-1}(V)$$. Now suppose that $$a \notin f^{-1}(V)$$. Then $$f(a) \notin V$$ and therefore $$f(a) \in Y-V$$. From this we get $$(a,f(a)) \in G_f \cap [X \times (Y-V)] = C$$ which implies $$a \in \pi_1(C)$$.

From this we can conclude that if $$a \in X-\pi_1(C)$$, then $$f(a) \in V$$, proving that $$f(X-\pi_1(C)) \subseteq V$$ which in turn proves that $$f$$ is continuous.

How does this sound?

• @RobArthan Whoops! Sorry about that--long day. I believe the errors have been fixed now. Oct 24 '17 at 21:59

If you know that $\pi_X: X \times Y \to X$ is a closed map (which you seem to):

Suppose $G_f$ is closed.

Let $C \subseteq Y$ be closed. Then $G_f \cap (X \times C)$ is closed in $X \times Y$ and note that $\pi_X[G_f \cap (X \times C)] = f^{-1}[C]$ so that $f^{-1}[C]$ is closed in $X$, as $\pi_X$ is closed. So $f$ is continuous. (inverse image of closed is closed). This direction only uses compactness of $Y$.

For the other direction we only need the Hausdorffness of $Y$: The diagonal $\Delta_Y = \{(y,y) : y \in Y\} \subseteq Y \times Y$ is closed iff $Y$ is Hausdorff, and $G_f = (f \times 1_Y)^{-1}[\Delta_Y]$, where $1_Y$ is the identity on $Y$ and $f \times 1_Y : X \times Y \to Y \times Y$ defined by $(f \times 1_Y)(x,y) = (f(x), y)$ is continuous whenever $f$ is.

• Wow! Very nice! Thank you Oct 24 '17 at 23:21

I think you are right. But, if you know the theory of "net", it will be more simple to prove this result. The proof is nothing but an analogue of the case that both $X$ and $Y$ are metric spaces.

Suppose that the graph is closed. Let $x_\alpha \to x$ in $X$, where $\{x_\alpha\}$ is any convergent net (not necessarily a sequence). Suppose by way of contradiction that $f(x_\alpha)\not\to f(x)$. Then there exists a neighborhood $V$ of $f(x)$ and a subnet of $\{f(x_\alpha)\}$ (which by relabeling we also denote by $\{f(x_\alpha)\}$ ) satisfying $f(x_\alpha)\not\in V$ for all $\alpha$. The compactness of Y guarantees that$\{f(x_\alpha)\}$ has a convergent subnet, which we again denote by $\{f(x_\alpha)\}$, so we may assume $f(x_\alpha)\to y$ for some $y$ in $Y$. Thus $(x_\alpha, f(x_\alpha))$ is a net in $X\times Y$ converging to $(x,y)$. The closedness of graph implies that $f(x)=y$, which contradict the condition that $f(x_\alpha)\not\in V$ for all $\alpha$.

On the other hand, suppose that $f$ is continuous and $Y$ is Hausdorff. and $(x_\alpha,f(x_\alpha))$ is a net converging to $(x,y)$. Since $f$ is continuous, we have that $f(x)=f(\lim x_\alpha)=\lim f(x_\alpha)$. On the other hand, $f(x_\alpha)\to y$. Because $Y$ is Hausdorff, $f(x)=y$.

The compactness is critical: Let $f:[0,\infty)\to [0,\infty)$ given by $f(0)=0$ and $f(x)=\frac{1}{x}$ for any $x\neq 0$. Then the graph of $f$ is closed but it is not continuous.

In response to @HennoBrandsma: Please correct me if I'm wrong, but $$\pi_X$$ is not closed. Let $$X=[0,1]$$ and $$f: (0,1] \to \mathbb{R}$$ be such that $$f(x) = 1/x$$. Then, the graph of $$f$$, $$G(f)$$ is closed in $$[0,1] \times \mathbb{R}$$ (it is the intersection of a closed set and $$[0,1] \times \mathbb{R}$$) but $$\pi_X[G(f)] = (0,1]$$ is not closed in $$[0,1]$$.

• Please note that $Y$ is compact, and the projection map, from $X\times Y$ onto $X$ is closed for $Y$ compact. But great insight. Nov 7 '20 at 22:00

Lemma 1: The $$G_f$$ is closed then for each $$x\times y$$ that $$y \neq f(x)$$ there is a open basis in the product topology $$X \times Y$$ (in order) in the form $$U_x \times V_y$$. We have $$U_x$$ and $$V_y$$ are opens in $$X$$ and $$Y$$ that: $$x \in U_x , \; y \in V_y, \; f(U_x) \cap V_y = \emptyset$$

I want to prove that if $$G_f$$ closed and $$Y$$ compact, then $$f$$ is continuous. I think the Hausdorff is needed for the reverse side!

Assume $$V$$ a closed subspace of $$Y$$. We want to say that $$f^{-1}(V)$$ is closed in X. If we have $$x \in X-f^{-1}(V)$$, we want to find a open in X which contains this $$x$$ and does not intersect with $$f^{-1}(V)$$. If $$U$$ open in X that $$f(U) \cap V = \emptyset$$ then $$U \cap f^{-1}(V) = \emptyset$$.

We know that $$f(x)$$ is not in $$V$$. Thus, for each $$y \in V$$ as lemma 1 suggests, we have $$U_y$$ and $$V_y$$ open in $$X$$ and $$Y$$ (in order) that: $$x \in U_y , \; y \in V_y, \; f(U_y) \cap V_y = \emptyset$$ As $$V$$ closed subspace of the compact space $$Y$$, and $$\{V_y\}$$ makes a open covering of $$V$$ then: $$\exists y_1, y_2, \dots y_n \;\text{that}\; V= V_{y_1} \cup V_{y_2}\cup \dots \cup V_{y_n}$$ Now we can assume $$U= U_{y_1} \cap \dots \cap U_{y_n}$$ then we have $$U$$ open in $$X$$, and $$f(U) \cap V= \emptyset$$