Continuous mapping of Cantor Set to $[0,1]$ I read that $[0,1]$ is a continuous image of the Cantor set using the dyadic expansion $f$ of real numbers. $f$ is an onto function, since all $x \in [0,1]$ can be represented by an element in the Cantor set.
But $f$ should not be injective right? since otherwise we will have a homeomorphism between the Cantor set and $[0,1]$, but the Cantor set is disconnected while $[0,1]$ is connected. But I could not picture how the Cantor set cannot have a one-to-one function with $[0,1]$. How does $f$ not become injective (aside from the reason re homeomorphism)?
 A: To be explicit, here is the function I think you are referring to.  Let $K$ denote the Cantor set.  An element $x\in K$ has a base $3$ expansion consisting of $0$s and $2$s.  Define $f(x)$ as the number whose binary expansion is obtained from the base $3$ expansion of $x$ by replacing the $2$s with $1$s.
So, why is this function $f:K\to [0,1]$ not injective?  After all, you can "invert" $f$ by taking a binary expansion, replacing the $1$s with $2$s, and reading it as a ternary expansion.  The answer is that binary expansions are not always unique.  For instance, $1/2$ has both $$0.011111\dots$$ and $$0.100000\dots$$ as binary expansions.  But when you "invert" $f$ on these, you get base $3$ expansions that do not represent the same number: $$0.022222\dots$$ is $1/3$ and $$0.200000\dots$$ is $2/3$.  So we have $f(1/3)=f(2/3)=1/2$, and $f$ is not injective.
More generally, if you view $K$ as the interval $[0,1]$ with infinitely many "holes" cut out of it (the middle third intervals you remove), the function $f$ glues together the endpoints of each hole.  Intuitively, after doing this, there are no holes left, so you get a genuine connected interval which is homeomorphic to $[0,1]$.  (Of course, it is not obvious that this is actually true, and it takes some nontrivial work to prove it.)
A: The Cantor set $K$ and $[0,1]$ are both compact Hausdorff spaces. A  continuous bijection from one compact Hausdorff space to another must be a homeomorphism. So if any  $f:K\to [0,1]$ was continuous, surjective, and injective then $f$ would be a homeomorphism, implying that $f^{-1}:[0,1]\to K$ is continuous and surjective, implying that the disconnected space $K$ is a continuous image of the connected space $[0,1],$ which is impossible.
