Prove that the topological space $[0,1]$ is a continuous image of the Cantor space $(G,T')$.
I know that this means to show there exists a function $$(i) f : (G,T') \rightarrow [0,1]$$ such that $f$ is continuous and onto and $$f(G) = [0,1]. $$ The book I'm reading says that: "In view of the fact that $$g : (G,T') \rightarrow (\prod^{\infty}_{i=1}A_i, T_i)$$ given by $$g(\sum^{\infty}_{i=1} \frac{a_n}{3^n}) = <a_1, a_2, ..., a_n, ...>$$ where each $(A_i, T_i)$ is the set $\{0,2\}$ with the discrete topology, is a homeomorphism, it suffices to find a continuous mapping $\phi$ of $\prod^{\infty}_{i=1}(A_i, T_i)$ onto $[0,1]$."
My question is: Why does it suffice to show this instead of what I wanted to show in $(i)$?
Let $H$ be the product space, and I will omit the topologies in the following.
Since you have a continuous, onto map $g : G\to H$, if you find a continuous, onto map $H\to [0,1]$, their composition will be a continuous, onto map $G\to [0,1]$. Which is what you wished to find.