# Open and closed subset of $\mathbb{R}$

How to show that the only subsets of $\mathbb{R}$ which are simultaneously closed as well as open are $\emptyset$ and $\mathbb{R}$ itself. Can someone tell me how to go to the proof of it? I have tried a bit about it but no luck. My attempt : Suppose $A$ is such a set. If its empty we are done. Otherwise $x\in A$. Then we need to show for any $x\in \mathbb{R}$ we have $x\in A$. Then, I have no idea. Do I need some powerful theorem or something? Or can it be done with the minimal knowledge of Topology and Set theory? Can someone help me? Thanks.

• Consider $U = \{ y > x : [x,y] \subset A\}$ and $L = \{ y < x : [y,x] \subset A\}$. Look at $\sup U$ and $\inf L$. – Daniel Fischer Sep 2 '14 at 18:22
• Use that a set is said to be closed if its complimentary is open – Shobhit Sep 2 '14 at 18:22

Suppose that $A$ is a non-empty subset of $\mathbb R$, $A\neq\mathbb R$, and $A$ is both open and closed. Since $A\neq\mathbb R$, $A^c$ is not empty, and $A^c$ is also both open and closed. Pick $x\in A$ and $y\in A^c$. Clearly, $x\neq y$, so suppose, without loss of generality that $x<y$.

Let $a\equiv\sup\{c\,|\,c\in A,\,c<y\}$. It is not difficult to see that that this quantity is well-defined: see the note below—in particular, the set $\{c\,|\,c\in A,\,c<y\}$ is not empty, as it contains $x$; and $y$ is an upper bound on this set. In addition, $x\leq a\leq y$. Since $A$ and $A^c$ partition $\mathbb R$, $a$ must be contained in exactly one of them.

Case 1: $a\in A$. Note that $a\neq y$, since $y\in A^c$. Therefore, $a<y$. Since $A$ is open, there exists some $\varepsilon>0$ such that $a+\varepsilon\in A$ and $a+\varepsilon<y$. But this means that $a$ is not an upper bound on the set $\{c\,|\,c\in A,\,c<y\}$, a contradiction.

Case 2: $a\notin A$. Note that $a\neq x$, since $x\in A$. Therefore, $a>x$. Since $A^c$ is open, there exists some $\varepsilon>0$ such that $a-\varepsilon>x$ and the interval $(a-\varepsilon,a]$ is fully contained in $A^c$. Therefore, $a-\varepsilon$ is also an upper bound on the set $\{c\,|\,c\in A,c<y\}$. But this means that $a$ is not the least upper bound ($\equiv$supremum) on the set $\{c\,|\,c\in A,\,c<y\}$, another contradiction.

The only non-elementary fact used in this proof is that every non-empty subset of $\mathbb R$ that has an upper bound also has a (unique) least upper bound (supremum). In fact, this is an axiomatic property of $\mathbb R$, which can be shown to be equivalent to the property that every real Cauchy sequence converges (that is, $\mathbb R$ is complete as a metric space and Banach as a vector space).

A topological space in which the only sets both open and closed are the empty set and the whole space itself is called connected. What this proof shows is that $\mathbb R$ is connected.

Assume $A$ is such a set. If it is either empty or the whole of $\mathbb{R}$, we're good. Assume it is not, and let $B:=\mathbb{R}\setminus A$. So $B$ too is open and closed. By assumption there are $a\in A$ and $b\in B$, and without loss of generality, $a<b$.

Set $U=\{x\in\ B|x>a\}$. Then $U$ is not empty, and is bounded from below, thus it has a greatest lower bound $r$, which leads us to our final question: Is $r$ in $A$ or in $B$...?

Note: The fact that every bounded subset of $\mathbb{R}$ has a greatest lower bound is crucial for this proof. In $\mathbb{Q}$ for example, there are subsets which are both open and closed (can you find an example for such a subset?).