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 start considering $f(E) = A \cup B$, where $A$ and $B$ are nonempty separated subsets. Then we put $G = E \cap f^{-1}(A)$ and $H = E \cap f^{-1}(B)$. Then comes the part I'm stuck in: he affirms $G$ and $H$ are non-empty.
After a quick search on SE I came across this answer. The answer starts by saying $A \subseteq f(E)$. Taking $y\in A$, we have $A\ne \emptyset$, $f(E)\neq \emptyset$ and $E\ne \emptyset$ and hence, $\exists x\in E, f(x)=y$. This yields: $x\in f^{-1}(A)$. Hence, $x\in E \cap f^{-1}(A)$. But the question I'm asking from there is: what prevents $f^{-1}(A)$ from being disjoint with $E$ ?
Since I got stuck with the above-mentioned answer, I started reading another answer. The answer says: "since $f(E)=A\cup B$ then for every $y\in A\cup B$, $\exists x\in E, f(x)=y$. Then there are two cases: either $y\in A$, either $y \in B$." The answer proceeds by saying: "since $A\ne \emptyset$ we conclude $\exists x\in E , f(x) = y \in A$". I tried to prove this last assertion by proving the contrapositive which is: $\forall x\in E, f(x)\notin A \implies A= \emptyset$. I am sure this assertion is true when $E$ is the domain of $f$. However, here $E$ is not the domain of $f$ so I'm not sure it's true.
If any of you could get me unstuck on these two ways of resolution or in a possibly third way of resolution on how $G$ and $H$ are non-empty.
Consider a surjection $\phi : M \to N$ between sets $M, N$ and $N_0 \subset N$. Then $\phi^{-1}(N_0) \ne \emptyset$ if and only if $N_0 \ne \emptyset$. This is an immediate consequence of the definition of the inverse image $\phi^{-1}(N_0) = \{m \in M \mid \phi(m) \in N_0 \}$.
Now let $\bar f : E \to f(E)$ be the restriction of $f$. By construction it is a surjection. We can therefore apply the above fact to see that $\bar f^{-1}(A) \ne \emptyset$ and $\bar f^{-1}(B) \ne \emptyset$. But clearly $\bar f^{-1}(A) = f^{-1}(A) \cap E$ and $\bar f^{-1}(B) = f^{-1}(B) \cap E$.