Continuity, Compactness and Graph

PMA, Rudin p.99 Exercise 6

Let $X,Y$ be metric spaces and $E$ be a compact subset of $X$.

Define $f:E\rightarrow Y$ and $G=\{(x,f(x))\in X\times Y:x\in E\}$.

Then prove that $f$ is continuous on $E$ iff $G$ is compact.

I’m not sure hypotheses Rudin made are sufficient to prove this. How do I know what kind of metric is in $X\times Y$? Is there a generally used metric of Cartesian product of two metric spaces, when metric of the product is not mentioned?

Next, say metric in $X\times Y$ is defined. Let $A,B$ be compact sets in $X,Y$ respectively. How do I prove that $A\times B$ is compact? I think this is inevitable in the proof for above theorem, but there was nothing about this in this book.. (I know generalization of this is Tychonoff’s Theorem which needs choice)

Solutions Collecting From Web of "Continuity, Compactness and Graph"

If $(X,d_1)$ and $(Y-d_2)$ are metric spaces, then $d((x,y),(x’y’))=d_1(x,y’)+d_2(y,y’)$ is a metric on $X\times Y$.
Note that this does not give the standard metric on e.g. $\mathbb R^2=\mathbb R \times\mathbb R$. But the topologies defined by both metrics are the same.

If $A,B$ are compact and we are given an open cover of $A\times B$, then for each $a\in A$ we find a finite subcover of $\{a\}\times B$. By using compactness of $B$, show that there is some $r>0$ such that for each $b\in B$, the ball $B_r(a,b)$ around $(a,b)$ with respect to metric $d$ on $X\times Y$ is in one of these finitely many covering sets. Thus thes finitly many open sets cover not just $\{a\}\times B$ but in fact $B_r(a)\times B$ (here the ball is with respect to metric $d_1$ on $X$). With varying $a$, the $B_r(a)$ cver $A$, hence there is a finite subcover, corresponsing to a finite subcover of $A\times B$.

I think Rudin’s exercise asks about a real function of a real variable, $f:E\to\mathbb R$, where $E\subseteq\mathbb R$. Graph of such a function is a subset of the plane $\mathbb R^2$, on which a metric is defined by $$d((x_1,y_1),(x_2,y_2))=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$ (see Example 2.16 in Rudin’s book.)

For general metric spaces you can define many different product metrics, generalizing the result.