prove that a subset of the real line is connected if and only if it is an interval. Do I need to use the Sufficient Condition, too?
Necessary Condition
Suppose $I$ is not an interval of $\mathbb{R}$.
Then $\exists$ $x,y\in I$ and $z\in\mathbb{R}-\mbox{I}$ such that $x<z<y.$
Consider the sets $I∩(-\infty..z)$ and $I∩(z..+\infty).$
Then $I∩(-\infty..z)$ and $I∩(z..\infty)$ are open by definition of the subspace topology on I.
Neither is empty because they contain $x$ and $y$ respectively.
They are disjoint, and their union is $I$, since $z∉I$.
Therefore $I∩(-\infty..z)∣I∩(z..+\infty)$ is a separation of $I$.
It follows by definition that $I$ is disconnected.
$\square$
 A: This question has been asked many times in this forum. Make a search for  "interval connected":

However, frequently the relevant arguments are spread over both question and answer, or only deal with a special type of interval (for example an open interval).
Let us a give a proof for any interval I which is open open / half-open / closed and bounded / unbounded.
Assume that $I$ is not connected. Then there exists a partition $(U_1,U_2)$ of $I$, i.e. a pair of nonempty open subsets $U_1, U_2 \subset I$ such that $U_1 \cup U_2 = I$ and $U_1 \cap U_2 = \emptyset$. We emphasize that these sets are open in the subspace $I$, it is possible that they are not open in $\mathbb R$. Note that the $U_i$ are clopen in $I$, i.e. are closed and open in $I$. Thus they have the form $U_i = I \cap C_i$ with closed $C_i \subset \mathbb R$.
Pick $x_i \in U_i$. W.l.o.g. we may assume $x_1 < x_2$ (otherwise we consider the partition $U'_1 = U_2, U'_2 = U_1$ and $x'_1 = x_2, x'_2 = x_1$). Define
$$y^* = \sup \{ y \in U_1 \mid y < x_2\} .$$
From this definition we get

*

*$x_1 \le y^* \le x_2$. Thus $y^* \in I$ because $x_1, x_2 \in I$.


*$y^*$ is the limit of an increasing sequence $(y_n)$ in $U_1 \subset C_1$. Since $C_1$ is closed in $\mathbb R$, we see that $y^* \in C_1$. Thus $y^* \in I \cap C_1 = U_1$ and therefore $y^* < x_2$ because $x_2 \notin U_1$.


*The half open interval $(y^*,x_2]$ cannot contain points of $U_1$. But $(y^*,x_2] \subset I$ because $y^*, x_2 \in I$, thus $(y^*,x_2] \subset U_2$. Therefore $y^*$ is the limit of a decreasing sequence $(y'_n)$ in $U_2 \subset C_2$. Since $C_2$ is closed in $\mathbb R$, we see that $y^* \in C_2$. Thus $y^* \in I \cap C_2 = U_2$. This is a contradiction because $U_1 \cap U_2 = \emptyset$.
