Intervals are connected and the only connected sets in $\mathbb{R}$

Solution 1:

$\newcommand{\cl}{\operatorname{cl}}$HINTS: Suppose that $A\subseteq\Bbb R$ is not an interval; then there are points $a,b\in A$ and $x\in\Bbb R\setminus A$ such that $a<x<b$. Use the sets $A\cap(\leftarrow,x)$ and $A\cap(x,\to)$ to show that $A$ is not connected.

The other direction is a bit harder. Suppose that $A$ is not connected. Then there is an open set $U$ in $\Bbb R$ such that $A\cap U\ne\varnothing\ne A\setminus U$ and $A\cap U= A\cap\cl U$; why? Fix $a\in A\cap U$ and $b\in A\setminus U$ and show that $[a,b]\nsubseteq A$, so that $A$ cannot be an interval.