Prove that the only sets in $R$ which are both open and closed are the empty set and $R$ itself. I am trying to prove the above proposition. I tried to prove it by way of contradiction letting $S$ be such nonempty proper subset of $R$. Then $T=R-S$ would also be a nonempty proper subset of $R$ which is both open and closed. The method I thought of to lead contradiction is to create a sequence like this. 
Take $s_0$ from $S$ and $t_0$ from $T$. Then consider the point $\frac {s_0+t_0}{2}$ and if this point belongs to $S$ call it $s_1$ otherwise $t_1$. Repeat this process then eventually there is a sequence $s_m$ and $t_m$ which both converge to the same limit. But then since both sets are closed the limit point belongs to both sets, which is a contradiction. 
It's clear that such a sequence exists intuitively but I'm having trouble rigorously constructing such a sequence. Since I have no idea which set each of the newly constructed point belongs to, I don't know how to prove by $\epsilon-N$ definition of a sequence that both sequences converge to the same number. Can anybody help me? 
Moreover, how may I be able to generalize this proposition to the $R^n$ setting? 
Thanks.
 A: You've got the idea right - just a little bookkeeping needed : Choose $s_0 \in S$ and $t_0 \in T$, and define $r = (s_0 + t_0)/2$
$$
s_1 = \begin{cases}
s_0 &: r \in T  \\
r &: r\in S
\end{cases}
\quad\text{ and }\quad
t_1 = \begin{cases}
r &: r\in T \\
t_0 &: r\in S
\end{cases}
$$
Now $|s_1 - t_1| = \frac{|s_0-t_0|}{2}$
Now inductively construct the sequence so that
$$
|s_n - t_n| \leq \frac{|s_0-t_0|}{2^n}
$$
Now check that your argument applies (ie. check that $(s_n)$ and $(t_n)$ both converge).
A: Your idea is fine but may require some technical case distinctions. Alternatively you can (assuming $s_0\in S$, $t_0\in T$, and wlog.  $s_0<t_0$) let $a=\inf([s_0,t_0]\cap T)$. As we take the infimum of a nonempty bounded set, $a$ is a real number and in fact $s_0\le a\le t_0$. Investigate the consequences of $a\in S$ or $a\in T$.
A space $X$ with this property to show (i.e. that the only open closed sets are the empty set and the whole space $X$) is called connected.
To extend the result to $\mathbb R^n$ one could show that $X\times Y$ is connected if $X$, $Y$ are both connected.
