I have this problem which seems trivial, but I do not know how to get to the answer. I have the set $[0,1]$ with the Euclidean topology, and an arbitrary continuous function $f : I \rightarrow I^2 = I \times I$. I need to prove that if it is surjective then it cannot be injective.
I tried to think to the problem in this way: if $f$ is surjective and also injective, than we would have a homeomorphism between $I$ and $I \times I$.
I wanted to say that one is compact and the other is not to reach a contradiction. However in my opinion they are both compact because product of compacts is compact as well, so I do not see why it would be a problem to have the injective property. Any tips?