# $E$ compact, real-valued $f : E \to \mathbb{R}$ continuous iff graph is compact - is real valued necessary?

Problem

The graph $G$ of $f$ is defined as the points $(x, f(x))$ for $x \in E$.

Suppose $E \subset \mathbb{R}$ is compact, then $f : E \to \mathbb{R}$ is continuous iff its graph is compact.

Question

My solution doesn't use the fact that $E$ is a subset of $\mathbb{R}$ nor the fact that $f$ is a real function. Are these necessary hypotheses?

My solution

Let $Y$, some metric space, be the codomain of $f$, then $G$ is a subset of $E \times Y$. Define a metric on $E \times Y$ - the choice of metric is irrelevant.

If $x$ is continuous because it's a polynomial, and $f(x)$ is continuous by hypothesis. Then $g := (x, f(x))$ is continuous (Theorem 4.10 in Rudin). Since $E$ is compact, so is $G$ since $g$ is a continuous mapping from $E$ to $G$.

Suppose $G$ is compact. We have $g^{-1} (x, f(x)) = x$; clearly $g^{-1}$ is bijective. The inverse of $g^{-1}$, i.e. $g$ itself, is continuous since $G$ is compact and $g^{-1}$ is bijective. Thus $f(x)$ is also continuous.

Is this right? I don't think we need real-valued or $E \subset \mathbb{R}$. I'm a bit skeptical because usually all given hypotheses are necessary so that the strongest possible statement is proven.

• Can you elaborate why in the second direction of your proof: $g$ is continuous knowing that $G$ is compact and $g$ is bijective? This doesn't seem right. – T. Eskin Mar 24 '15 at 15:58
• @ThomasE. A continuous bijection with compact domain and Hausdorff codomain has a continuous inverse, although this should be made clearer. – Santiago Canez Mar 24 '15 at 16:24
• @SantiagoCanez. You're right. $g^{-1}$ is clearly continuous as it's the restriction of a projection map on the first coordinate, but this detail is essential in order to conclude the continuity of $g$ given the other assumptions. – T. Eskin Mar 24 '15 at 16:30
• Saying that $g := (x,f(x))$ is continuous requires a metric on $E \times Y$ which is compatible with the product topology. So, yes, your proof does use it. Of course, there are different possible metrics with this property, but you should be clear that you are using such a metric. – Santiago Canez Mar 24 '15 at 16:41
• This works for arbitrary topological spaces, with $X\times Y$ equiped with the product topology: (a) $X$ compact and $f$ continuous implies graph compact, (b) $X$ Hausdorff and graph compact implies $f$ continuous. The proof is yours, of course. – Jesus RS Mar 26 '15 at 9:51