How to prove a set is nowhere dense? Im trying to solve a problem from chapter 8, Real Analysis, Carothers, 1ed, talking about compactness of metric space, :

I've finished the first problem actually.
For the second problem. I've proved the range of $f$ is closed with claim as following:
$f$ is continuous and $[0,1]$ is compact => range of f is compact in $[0,1]\times[0,1]$.
Since $[0,1]\times[0,1]$ is compact,
then we get range of $f$ is closed. 
And then I got some problems:


*

*The metric is unknown, which means that it is insufficient to say $[0,1]$ is compact and so does $[0,1]\times[0,1]$. How to solve it?

*How to do next? I cannot use the hint left below.
 A: You don’t really need a metric on $[0,1]\times[0,1]$; it’s more convenient to use the product topology directly. It has a base consisting of all sets of the form $I\times J$, where $I$ and $J$ have one of the following forms:

*

*$(a,b)$ for $0\le a<b\le 1$;

*$[0,b)$ for $0<b\le 1$; or

*$(a,1]$ for $0\le a<1$.

Now let $K$ be the range of $f$; you already know that $K$ is closed, since it’s a compact subset of the Hausdorff space $[0,1]\times[0,1]$. Thus, it is nowhere dense if and only if its interior is empty. Suppose, on the contrary, that it contains a non-empty open set. Then it contains a basic open set of the form $I\times J$ described above, and since it’s closed, it contains the closure of that basic open set; this is a rectangle $[a,b]\times[c,d]$ for some $a,b,c,d$ such that $0\le a<b\le 1$ and $0\le c<d\le 1$.
To use the hint, show that $R=[a,b]\times[c,d]$ must be the image of some subinterval $I$ of $[0,1]$. Further HINT: If not, there are $u,v,w\in[0,1]$ such that $u<v<w$, $f(u),f(w)\in R$, and $f(v)\notin R$; now consider the sets $$R\cap f\big[[0,v]\big]\qquad\text{and}\qquad R\cap f\big[[v,1]\big]\;.$$
Then let $g=f\upharpoonright I$, the restriction of $f$ to the subinterval $I$; $g$ is continuous and maps $I$ onto the rectangle $[a,b]\times[c,d]$, but this is impossible for the same reason that $f$ cannot map $[0,1]$ onto $[0,1]\times[0,1]$.
A: If the range of $f$ has nonempty interior, then it contains a nonempty closed disk $D$. Choose points $x_0,x_1,x_2\in[0,1]\cap f^{-1}(D), x_0\lt x_1\lt x_2$. Let $y_1=f(x_1)\in D$. Let $A=D\cap f([0,x_1]),B=D\cap f([x_1,1])$. Then $A,B$ are closed sets, $A\cup B=D$, $A\cap B=\{y_1\}$. The sets $A\setminus\{y_1\},B\setminus\{y_1\}$ are disjoint, nonempty (containing the points $f(x_0),f(x_2)$ respectively), and relatively closed in $D\setminus\{y_1\}$, contradicting the fact that $D\setminus\{y_1\}$ is connected.
