Prove that if $X_{n}\cap X_{n+1}\neq\emptyset$, $X=\bigcup X_{n}$ is connected Let $X_{1},\dots X_{m}$ a finite collection of subsets of a metric space $M$ such that $X_{n}\cap X_{n+1}\neq \emptyset$ for all $n$. Show that $X=\cup X_{n}$ is connected.
How can I prove that?
I tried to do the contrapositive: If $X=\cup X_{n}$ is not connected, exists $1\leq n < m$ such that $X_{n}\cap X_{n+1}=\emptyset$, but I didn't work.  Can someone give me any some tips?
 A: As stated in the comments, each $X_n$ must be connected. For example, if $M=X_1$ is the discrete space of two points, then $X=X_1$ is not connected. 
Suppose that $X$ is not connected. Then there exist disjoint nonempty open subsets $U$ and $V$ of $X$ which cover $X$. Since each $X_n$ is connected, we have, for each $n$, 
$$\mbox{($X_n\subseteq U$ and $X_n\cap V=\emptyset$) or ($X_n\subseteq V$ and $X_n\cap U=\emptyset$)}.$$
Furthermore, since $U$ and $V$ are both nonempty, we have $m>1$. Now use the assumption $$\mbox{$X_n\cap X_{n+1}\ne\emptyset$ for all $n$}$$
to contradict our choice of $U$ and $V$. 
A: As mentioned, the result is false unless each space $X_n$ is connected so let's assume so. 
Here is an alternative approach: a metric space $(Y,d)$ is connected if and only if any continuous function $Y \to \{0,1\}$ is constant. If you had a non-constant function, preimages of $0$ and $1$ would disconnect $Y$. Reciprocally, if $Y$ can be disconnected, sending one open set to $0$ and the other one to $1$ gives a continuous function. 
Let $z_n \in X_n \cap X_{n+1}$ for each $n$. To show that $\bigcup_n X_n$ is connected, let $\varphi: \bigcup_n X_n \to \{0,1\}$ continuous and let's see that $\varphi$ is constant. Since each $X_n$ is connected, the restriction $\varphi_n = \varphi|_{X_n} : X_n \to \{0,1\}$ ought to be constant, i.e. $\varphi_n \equiv c_n \in \{0,1\}$. Now, it suffices to see that $c_n \equiv c_1$ for all $n$. We proceed by induction: the base case is trivial. As for the inductive step, 
$$
c_{n+1} = \varphi_{n+1}(z_n) = \varphi_n(z_n) = c_n \stackrel{I.H.}{=} c_1,
$$
and so we are done.
