Is chapter 4 exercise 6 of baby rudin flawed

compactnesscontinuityreal-analysis

Exercise 6, chapter 4 Rudin's "Principles of Mathematical Analysis":

If $f$ is defined on $E$, the graph of $f$ is the set of points $(x, f(x))$, for $x \in E$.
In particular, if $E$ is a set of real numbers, and $f$ is real-valued, the graph of $f$ is a subset of the plane.
Suppose E is compact, and prove that f is continuous on E if and only if its graph is compact.

I think that the question is flawed. Show that the graph is compact as a subset of which metric space? Under what metric? The compactness of a set can depend on a metric as explained here: Does compactness depend on the metric?

For the "only" if direction, I defined a new metric space $X \times Y$ where $Y$ is the codomain of $f$ with metric $d_{X \times Y}=d_X+d_Y$.
I was able to show that in this new metric space, the graph is indeed compact. But,I feel as if this answers a different question.

Moreover, what would I even do for the "if" direction? I start by supposing that the graph is compact, but what does this even mean? There is no defined metric and no given underlying metric space for which the graph is a compact subset.

Best Answer

Rudin writes

If $f$ is defined on $E$, the graph of $f$ is the set of points $(x, f(x))$, for $x \in E$. In particular, if $E$ is a set of real numbers, and $f$ is real-valued, the graph of $f$ is a subset of the plane.
Suppose E is compact, and prove that f is continuous on $E$ if and only if its graph is compact.

This makes clear that Rudin considers a special situation: One has $E \subset \mathbb R$ and $graph(f) \subset \mathbb R^2$. It is now clear that $graph(f)$ is a subset of $\mathbb R^2$ with its standard metric.