compact metric spaces 
Let $(X,d_X)$ and $(Y, d_Y)$ be compact metric spaces.


*

*Show that for a nonempty set $A\subseteq X,$ the function $f : X\to \mathbb{R}, f(x) = \inf \{d_X(x,a) : a\in A\}$ is continuous.

*Show that if a map $f : X\to Y$ is both continuous and bijective, then its inverse $f^{-1} : Y\to X$ is also continuous.

*Let $C$ be the Cantor set with metric from $(\mathbb{R},|\cdot|)$ and $P = \prod_{k=1}^\infty \{0,\frac{1}{2^k}\}$ with metric from $(\ell_1, \lVert \cdot \rVert_1).$ Show that there exists a continuous bijection $f : C\to P.$
For $1),$ let $x\in X$ and let $\epsilon > 0.$ Choose $\delta = \epsilon.$ Then if $y\in X$ is such that $d(x,y) < \epsilon, we $ have \begin{align}d(f(x), f(y)) 
&= \inf\{d(x,a) | a \in A \} - \inf\{d(y,a) | a\in A\}\\
&\leq \inf \{d(x,a) | a\in A\} - (\inf \{d(x,a) - d(x,y) | a \in A\})\\
&= \inf \{d(x,a) | a\in A\} - (\inf \{d(x,a) | a \in A\} - d(x,y)\}\\ 
&= d(x,y) < \epsilon.\end{align}

Is this part correct?

For $2),$ suppose $f:X\to Y$ is continuous and bijective. Let $y\in Y$ and $\epsilon > 0.$ We want to show that there exists $\delta > 0 $ so that if $d_Y(x,y) < \delta$ then $d_X(f^{-1}(x), f^{-1}(y)) < \epsilon$. Let $(y_n)$ be a sequence in $Y$ such that $y_n\to y.$ Then $(f^{-1}(y_n))\subseteq X$ and since $X$ is compact, it has a convergent subsequence, say $(f^{-1}(y_{n_k}))_k.$ Since $f$ is bijective, we can write $y_n = f(x_n)$ for each $n\in\mathbb{N},$ where $x_n \in X.$ Let $x = \lim_{k\to\infty} f^{-1}(y_{n_k}) = \lim_{k\to \infty} x_{n_k}.$ Since $f$ is continuous, $f(x) = \lim_{k\to\infty} f(x_{n_k}).$ But here I'm stuck as I'm not sure how to show $f^{-1}$ is continuous from here.

As for the third part, every element of the Cantor set can be uniquely written in the form $\sum_{k=1}^\infty \frac{a_k}{3^k}, a_k \in \{0,2\}\forall k.$ Then it suffices to show that the function $f : C\to P, f(\sum_{k=1}^\infty \frac{a_k}{3^k}) = \prod_{k=1}^\infty \{\frac{a_k/2}{2^k}\}$ is continuous. I think one could show it's sequentially continous, but I'm not really sure about the details.

 A: I think (1) is correct, but I wouldn't bother with the infima: let $a,b\in A$. Then
$$|d(x,a)-d(y,b)|\leq |d(x,a)-d(a,y)|+|d(a,y)-d(y,b)|\leq d(x,y)+d(a,b)$$
where we used the triangle inequality. Take infimum on both sides as $a\in A$, while $b$ is (for now) fixed, so $|f(x)-d(y,b)|\leq d(x,y)+0=d(x,y)$. Now this is true for all $b\in A$, so take infimum over $b$ and conclude that $|f(x)-f(y)|\leq d(x,y)$, I think this is more neat.
For (2) this is a standard topological fact: If $f:X\to Y$ is a continuous bijection from a compact space to a Hausdorff space, then it is a homeomorphism. Indeed, all we need to do is show that $f^{-1}$ is continuous: if $E\subset X$ is a closed subset, we want to show that the inverse image of $E$ through $f^{-1}$ is closed in $Y$, which is the same as $f(E)$ is closed in $Y$. Now $X$ is compact and $E$ is a closed subset, so $E$ is also compact. Now $f$ is continuous, so $f(E)$ is a compact subset of $Y$. Now $Y$ is Hausdorff, so all compact sets are closed, thus $f(E)$ is closed in $Y$. Sometimes it helps viewing things in a more abstract frame; for example the metrics here are not essentially needed, so the extra information causes extra confusion.
For (3) you have a correct guess: Indeed, every element of the Cantor set $C$ can be written uniquely as $\sum_{k=1}^\infty\frac{a_k}{3^k}$, where $a_k$ is either $0$ or $2$. But it is important to note that the converse is also true: Any sum $\sum_{k=1}^\infty\frac{a_k}{3^k}$ where $a_k\in\{0,2\}$ is an element of the cantor set. Now define $f:C\to P$ as
$$f\big(\sum_{k=1}^\infty\frac{a_k}{3^k}\big)=(\frac{a_k}{2^{k+1}})_{k=1}^\infty$$

*

*$f$ is well-defined: since $a_k$ is either $0$ or $2$, we have that $a_k/2^{k+1}$ is either $0$ or $1/2^k$, so each $a_k/2^{k+1}$ does indeed belong to $\{0,\frac{1}{2^k}\}$, so $f$ does indeed take values in $\prod_{k=1}^\infty\{0,\frac{1}{2^k}\}$.


*$f$ is one to one: this is obvious.


*$f$ is surjective: indeed, let $x=(x_k)_{k=1}^\infty\in P$, so each $x_k$ is either $0$ or $1/2^k$. Set $a_k=2^{k+1}\cdot x_k$. Then $a_k$ is either $0$ or $2$, so if $t=\sum_{k=1}^\infty\frac{a_k}{3^k}\in C$ then $f(t)=x$.


*$f$ is continuous: Let $\varepsilon>0$ and fix a point $x\in C$, say $x=\sum_{k=1}^\infty\frac{a_k}{3^k}$, where $a_k\in\{0,2\}$.
Let $y\in C$ be another element, say $y=\sum_{k=1}^\infty\frac{b_k}{3^k}$ where $b_k\in\{0,2\}$. Note that
$$d_P(f(x),f(y))=\|\{\frac{a_k}{2^{k+1}}\}_{k=1}^\infty-\{\frac{b_k}{2^{k+1}}\}_{k=1}^\infty\|_{\ell^1}=\|\{\frac{a_k-b_k}{2^{k+1}}\}_{k=1}^\infty\|_{\ell^1}=\sum_{k=1}^\infty\frac{|a_k-b_k|}{2^{k+1}} $$

Claim: Let $m\geq1$ be an integer. Then if $|x-y|<\frac{1}{3^m}$, then $a_k=b_k$ for all $k=1,\dots,m$.

Proof of the claim: I will only describe the idea here. Note that the construction of the Cantor set is done in steps: in each step we divide the segments in 3 pieces and throw out the middle part. In the expression $x=\sum_{k=0}^\infty\frac{a_k}{3^k}$ with $a_k=0$ or $2$, we have the following interpretation: in the first step of the construction, we divide $[0,1]$ in three segments and we only keep $[0,1/3]$ and $[2/3,1]$. If $a_1=0$, then $x$ lies in $[0,1/3]$. If $a_1=2$, then $x$ lies in $[2/3,1]$. So if $|x-y|<1/3$ where $y\in C,y=\sum_{k=1}^\infty\frac{b_k}{3^k}$ with $b_k=0$ or $2$, then $b_1=a_1$: otherwise we would have $x\in[0,1/3]$ and $y\in[2/3,1]$ or $x\in [2/3,1]$ and $y\in[0,1/3]$, which contradicts the fact that $|x-y|<1/3$.
Let's assume that $a_1=0$, so $x\in[0,1/3]$. Now again, in the second step of the construction, we cut each of $[0,1/3]$ and $[2/3,1]$ in three pieces each and throw out the middle third of each. Let's look at $a_2$. If $a_2=0$, then $x$ lies in the left segment of $[0,1/3]$ that is left after the second step, i.e. $x\in[0,1/3^2]$. If $a_2=2$, then $x$ lies in the right segment of $[0,1/3]$ that is left after the second step, i.e. $x\in[2/3^2,1/3]$. Now if $|x-y|<1/3^2$ then we also have $|x-y|<1/3$, so $y$ lies in $[0,1/3]$ as we explained for the first step, i.e. $b_1=0$. Now if $b_2\neq a_2$, we have that $x,y$ are in different thirds of $[0,1/3]$ after the application of the second step of the construction, so $|x-y|\geq 1/3^2$, a contradiction. I believe that you get the idea.
Now let $m$ be so large that $\sum_{k={m+1}}^\infty\frac{1}{2^k}<\varepsilon$. Taking $\delta=\frac{1}{3^m}$; from the claim we have that if $y\in C$ satisfies $|x-y|<\delta$, then $a_k=b_k$ for all $k=1,\dots,m$, so
$$d_P(f(x),f(y))=\sum_{k=m+1}^\infty\frac{|a_k-b_k|}{2^{k+1}}\leq\sum_{k=m+1}^\infty\frac{2}{2^{k+1}}<\varepsilon$$
and continuity follows. Observe that $\delta$ is independent of $x$, so $f$ is uniformly continuous.
Is this good news? No, this is expected, since $f$ is continuous on a compact space, thus it must be uniformly continuous. Also, by (2) this gives us a homeomorphism of the cantor set and $P$.
