To show that the Cantor's set, $K$, is uncountable we consider the following function \begin{equation} f\colon K\to [0,1] \end{equation} if $f$ is surjective, then the cardinality of $[0,1]$ can not be higher than that of $K$, however $K\subset[0,1]$, then they have the same cardinality.
Now, $x\in K$ if and only if $x=\sum_{k=1}^\infty\frac{a_k}{3^k}$, where $a_k\in\{0,2\}$.
Now, let $x\in K$, then \begin{equation} x=\sum_{k=1}^\infty\frac{a_k}{3^k} \end{equation} if we replace every number $2$ with the number $1$ and consider the new number in basis $2$, we get a new number of $[0,1]$. At this point my book states that $f$ is surjective. Why?
Thanks!
Because every element $x$ of $[0,1]$ can be expressed in binary:$$x=\sum_{n=1}^\infty\frac{b_n}{2^n}.$$Therefore,$$x=f\left(\sum_{n=1}^\infty\frac{2b_n}{3^n}\right).$$