Proof of "the continuous image of a connected set is connected" None of the existing questions is exactly answering my question so I'm posting a new question, but feel free to refer me to some already answered question! 
In Rudin Theorem 4.22, we know that 

If $f$ is a continuous mapping of a metric space $X$ into a metric space $Y$, and $E$ is a connected subset of $X$, then $f(E)$ is connected. 

In the proof, we started with consider $f(E) = A \cup B$, where $A$ and $B$ are nonempty separated subsets. Then put $G = E \cap f^{-1}(A)$ and $H = E \cap f^{-1}(B)$. Then Rudin is claiming that $E = G \cup H$. I'm a little suspicious about this. What if $f$ is non-surjective, then $f^{-1}(A) \cup f^{-1}(B)$  is only a proper subset of $E$? Is there a property of $f$ being continuous that forces $f$ to be 1-1? 
 A: $f^{-1}(A) \cup f^{-1}(B)$ may be larger than $E$, but it must contain $E$: if $x \in E$, $f(x) \in f(E) = A \cup B$. Then either $f(x) \in A$ or $f(x) \in B$. In the first case, $x \in f^{-1}(A)$, and in the second $x \in f^{-1}(B)$. (The fact that $f^{-1}(A) \cup f^{-1}(B)$ may be larger than $E$ is the reason for intersecting with $E$ when defining $G$ and $H$.)
A: For all $x\in X$ we have $$
\begin{align}
x\in G\cup H &\iff [(x\in E \cap f^{-1}A)\lor (x\in E\cap f^{-1}B] \\
& \iff [x\in E \land (f(x)\in A\lor f(x)\in B)] \\
& \iff [x\in E\land f(x)\in f(E)] \\
& \iff x\in E.
\end{align}
$$
A: If $e \in E$, then $f(e) \in f(E) = A \cup B$.
So, $f(e) \in A$ or $f(e) \in B$.
So, $e \in f^{-1}(A)$ or $e \in f^{-1}(B)$.
So, $e \in f^{-1}(A) \cup f^{-1}(B)$.
So, $E \subset f^{-1}(A) \cup f^{-1}(B)$.  
So, $E = E \cap (f^{-1}(A) \cup f^{-1}(B)) = (E \cap f^{-1}(A)) \cup (E \cap f^{-1}(B)) = G \cup H$.  
$A \cap B = \emptyset$.
So, $f^{-1}(A) \cap f^{-1}(B) = \emptyset$.
So, $\emptyset = E \cap \emptyset = E \cap (f^{-1}(A) \cap f^{-1}(B)) = (E \cap f^{-1}(A)) \cap (E \cap f^{-1}(B)) = G \cap H$
A: Suppose $E$ is connected subset of $X$. We need to prove that $f(E)$ is connected. Assume the contrary. $f(E)=C\cup D$ forms a separation of $f(E)$. Since $f$ is surjective therefore both  $f^{-1}(C)$  and $f^{-1}(D)$ are non-empty subsets of $E$. due to continuity  $f^{-1}(C)$ and $f^{-1}(D)$ are open in $X$.  $f^{-1}(C) \cap f^{-1}(D)=f^{-1}(C\cap D)=f^{-1}(\phi)=\phi$.  Contradicting the fact that $E$ is connected.
