# (X,$\tau$) with $E_1,E_2 \subseteq X$ connected and $E_1 \cap Closure(E_2) \neq \emptyset$ implies $E_1 \cup E_2$ connected

I'm trying to prove the following statement. Consider the topological space (X,$\tau$) with $E_1,E_2 \subseteq X$. Both $E_1$ and $E_2$ are connected, moreover $E_1 \cap Closure(E_2) \neq \emptyset$. Then it follows that $E_1 \cup E_2$ is connected as well.

I'm struggling to find a proof, here there's my approach.

I pick a point $p \in E_1 \cap Closure(E_2)$. Then we have that for all neighborhood U of p: $U \subseteq E_1$, and also for all neighborhood V of p we have $V \cap E_2 \neq \emptyset$. I know that somehow I have to use the fact that they are connected, but I do not know how. Any tips?

Here are two hints that should get you through. You should prove both of them.

Let $E\subseteq X$ be connected, and $A\subseteq X$ be any set such that $E\subseteq A\subseteq \operatorname{cl}(E)$. Then $A$ is connected.

and

Let $E_1,E_2\subseteq X$ be connected such that $E_1\cap E_2 \neq \emptyset$. Then $E_1\cup E_2$ is connected.

Suppose $E:= E_1 \cup E_2 = C \cup D$ where both $C$ and $D$ are closed and open in $E$ and disjoint. $E_2$ is connected and we can write $E_2 = (C \cap E_2) \cup (D \cap E_2)$ so as $E_2$ is connected, this must be the trivial decomposition, and $C \cap E_2 = E_2$, (or equivalently $E_2 \subseteq C$) and $D \cap E_2 = \emptyset$ (or the other way around, but then rename $C$ and $D$). From $E_2 \subseteq C$ we conclude that $\overline{E_2} \subseteq C$ as well.

Now let $p \in E_1 \cap \overline{E_2}$. So $p \in C$ by the above. We have as above $E_1 = (C \cap E_1) \cup (D \cap E_1)$ as a decomposition and we just showed $E_1 \cap C \neq \emptyset$, so $C \cap E_1 = E_1$ by connectedness of $E_1$ and so $E_1 \subseteq C$ and so $C=E$ and the original decomposition for $E$ is trivial as well, QED.

Suppose that $E=E_1\cup E_2$ is not connected, there exist open subsets $U_1,U_2$ of $X$ such that $U_1\cap E$ and $U_2\cap E$ are not empty and $U_1\cap U_2\cap E$ is empty.

We have $E_i=E_i\cap (E\cap U_1)\cup E_i\cap (E\cap U_2), i=1,2$ since $E_1$ is connected we deduce that either $E_1\cap (E\cap U_1)$ is not empty and $E_1\cap (E\cap U_2)$ is empty or $E_1\cap (E\cap U_2)$ is not empty and $E_1\cap (E\cap U_1)$.

Without restricting the generality, suppose that $E_1\cap (E\cap U_1)$ is not empty and $E_1\cap (E\cap U_2)$ is empty,

if $E_2\cap (E\cap U_1)$ is not empty we deduce that $E_2\cap (E\cap U_2)$ is empty since $E_2$ is connected and $E\subset U_1$ contradiction since $E\cap U_2$ is not empty and $E\cap U_1\cap U_2$ is empty.

Suppose that $E_2\cap (E\cap U_1)$ is empty, then $E_2\subset U_2\cap E$, this implies that $E_1\cap E_2\subset E\cap U_1\cap U_2$. Remark that the complementary of $E\cap U_2$ in $E$ is $E\cap U_1$ we deduce that $E_2\cap U_2$ is closed in $E$, $cl(E_2)\cap E$ is the adherence of the closed subset $E_2$ in $E$ which is contained in the closed subset $U_2\cap E$ of $E_2$, we deduce that $cl(E_2)\cap E\subset U_2\cap E_2$ and we have $cl(E_2)\cap E_1\subset E\cap U_1\cap U_2$, contradiction since $cl(E_2)\cap E_1$ is not empty and $E\cap U_1\cap U_2$ is empty.