Prove that a set A⊂ℝ is connected iff it is an interval. I know that how to proof that the interval [a,b] is connected.
But how to proof that a set A⊂ℝ is connected iff it is an interval.

$\Rightarrow$
We prove this by contradiction. 
Assume $A$ is not an interval, then we can take three real numbers $a,b,c$ such that $a<c<b$, $a,b \in A$ and $c \notin A$. Let $A_1=A \cap (-\infty,c), A_2=A \cap (c,+\infty)$, then $A=A_1 \cup A_2, A_1 \cap A_2=\varnothing$. Notice that $A_1$ and $A_2$ are both non-empty open subsets of $A$, $A$ is therefore not connected. Contradiction!
$\Leftarrow$
If $A$ is an interval, it must be one of the following forms:
$(a,b),[a,b],[a,b),(a,b]$
where $-\infty \leq a \leq b \leq +\infty$.
We can easily check each case to show that $A$ is connected. The connectivity of $\mathbb{E^1}$ may be used for the proof.
