TITLE: $C$ be a closed subset of the Cantor set $\Delta$. Show the existence of a continuous function $f:\Delta\to C$ s.t. $f(x)=x$, $x\in C$
QUESTION [9 upvotes]: Question: Let $C$ be a closed subset of the Cantor set $\Delta$. Prove there is a continuous function $f$ from $\Delta$ onto $C$ s.t. for every $x \in C$ we have $f(x)=x$.
Context: Advanced Undergraduate Analysis. I am familiar with Rudin and Carothers. This was a fact posed by a professor that has been on my mind for awhile now. 
I was considering the Cantor function $\Delta \rightarrow [0,1]$ but I don't know how I could show that it is continuous on $\Delta$. 
Any insight or help would be appreciated.

REPLY [3 votes]: Let the Cantor set be $\{0,1\}^{\mathbb{N}}$. Consider the following metric defining the topology 
$$d((a_n), (b_n)) = \sum_{n\ge 0} \frac{|a_n - b_n|}{3^n}$$
(any number $\lambda >2$ would work instead of $3$). 
Notice that if for three points $b$, $a$, $a'$ we have $d(a,b) = d(a',b)$ then $a=a'$. 
Let $A$ be a closed non-void subset of the Cantor set. Define $p_A(b)$ to be the closest point in $A$ to the point $b$ (this is unique by the above observation).
Then $p_A$ is a retract of the Cantor set onto $A$.