[proofplan]
We prove both directions. For "intervals are connected," suppose an interval $I$ admits a disconnection $I = U \cup V$; choosing $a \in U$, $b \in V$ with $a < b$ and letting $c = \sup(U \cap [a,b])$, we derive a contradiction regardless of whether $c \in U$ or $c \in V$. For "connected subsets are intervals," if $X$ is not an interval then some value $c$ between two points of $X$ is missing, and the sets $X \cap (-\infty, c)$ and $X \cap (c, \infty)$ disconnect $X$.
[/proofplan]
[step:Prove that every interval in $\mathbb{R}$ is connected]
Let $I \subseteq \mathbb{R}$ be an interval. Suppose for contradiction that $I = U \cup V$ with $U, V$ open in $I$, non-empty, and disjoint. Pick $a \in U$ and $b \in V$ with $a < b$ (if $b < a$, swap the labels). Since $I$ is an interval and $a, b \in I$, the entire segment $[a,b] \subseteq I$.
Let $c = \sup(U \cap [a,b])$. Since $a \in U \cap [a,b]$, this set is non-empty, and since it is bounded above by $b$, the supremum exists with $a \leq c \leq b$. In particular $c \in [a,b] \subseteq I = U \cup V$.
**Case $c \in V$**: Since $V$ is open in $I$, there exists $\varepsilon > 0$ with $(c - \varepsilon, c + \varepsilon) \cap I \subseteq V$. Since $V$ is disjoint from $U$, the set $U \cap [a,b]$ does not meet $(c - \varepsilon, c]$, so $U \cap [a,b] \subseteq [a, c - \varepsilon]$. This gives $\sup(U \cap [a,b]) \leq c - \varepsilon < c$, contradicting the definition of $c$.
**Case $c \in U$**: Since $U$ is open in $I$, there exists $\varepsilon > 0$ with $(c - \varepsilon, c + \varepsilon) \cap I \subseteq U$. Since $b \in V$ and $U \cap V = \varnothing$, we have $c < b$. Choose $\varepsilon$ small enough that $c + \varepsilon \leq b$. Then $c + \varepsilon/2 \in (c - \varepsilon, c + \varepsilon) \cap [a,b] \subseteq U \cap [a,b]$, so $\sup(U \cap [a,b]) \geq c + \varepsilon/2 > c$, contradicting the definition of $c$.
Both cases yield contradictions, so $I$ is connected.
[guided]
The proof uses the completeness of $\mathbb{R}$ via the existence of suprema. The idea is to look at the "[boundary](/page/Boundary)" between $U$ and $V$ within the interval $[a,b]$.
We pick $a \in U$, $b \in V$ with $a < b$ and define $c = \sup(U \cap [a,b])$. This point $c$ is the furthest right that elements of $U$ reach within $[a,b]$. Since $I = U \cup V$, the point $c$ must belong to one of them.
If $c \in V$: the openness of $V$ in $I$ gives a neighbourhood $(c - \varepsilon, c + \varepsilon) \cap I$ entirely within $V$. But then $U \cap [a,b]$ cannot reach past $c - \varepsilon$, contradicting $c = \sup(U \cap [a,b])$.
If $c \in U$: the openness of $U$ in $I$ gives a neighbourhood $(c - \varepsilon, c + \varepsilon) \cap I$ entirely within $U$. Since $c < b$ (because $b \in V$ and $c \in U$), this neighbourhood extends to the right of $c$, providing elements of $U \cap [a,b]$ strictly greater than $c$, contradicting $c = \sup(U \cap [a,b])$.
In both cases, the openness of the sets in the supposed disconnection conflicts with the extremal property of $c$. This is the completeness of $\mathbb{R}$ at work: in $\mathbb{Q}$, the analogous supremum might not exist, and indeed $\mathbb{Q}$ is not connected.
[/guided]
[/step]
[step:Prove that every connected subset of $\mathbb{R}$ is an interval]
Let $X \subseteq \mathbb{R}$ be connected. Suppose $X$ is not an interval. Then there exist $a, b \in X$ and $c \in (a,b)$ with $c \notin X$. Define
\begin{align*}
U = X \cap (-\infty, c) \quad \text{and} \quad V = X \cap (c, \infty).
\end{align*}
Since $(-\infty, c)$ and $(c, \infty)$ are open in $\mathbb{R}$, both $U$ and $V$ are open in $X$ (in the [subspace topology](/page/Subspace%20Topology)). They are non-empty: $a < c$ gives $a \in U$, and $b > c$ gives $b \in V$. They are disjoint: $(-\infty, c) \cap (c, \infty) = \varnothing$. Since $c \notin X$, every $x \in X$ satisfies $x < c$ or $x > c$, so $U \cup V = X$. This is a disconnection of $X$, contradicting [connectedness](/page/Connectedness). Therefore $X$ is an interval.
[/step]