# If a nonempty set of real numbers is open and closed, is it $\mathbb{R}$? Why/Why not?

In other words, are $\emptyset$ and $\mathbb{R}$ the only open and closed sets in $\mathbb{R}$? Why/Why not?

I tried by assuming a set is equal to its interior points and contains its limit points.

A bounded set will not do since stuff like $[1,4]$ and $\{5\}$ will not work, though that is not really proof. Help please?

Anyway, it must then be unbounded.

If $a$ is a real number then $(a,\infty)$, $(-\infty,a)$, $[a,\infty)$ and $(-\infty,a]$ don't seem to cut it so it must be $\mathbb{R}$.

• A closed set contains all of its border. An open set contains none of its border. What do you conclude about the border of a set that is both open and closed? – celtschk Apr 13 '14 at 14:49
• There was a hint that somehow vanished that suggested to think about connectedness. – Andrés E. Caicedo Apr 13 '14 at 14:53
• The border obviously cannot contain elements outside of $\mathbb R$ because we are talking about the topology of $\mathbb R$. – celtschk Apr 13 '14 at 14:57
• More exactly, its border is the empty set (the border as set of all border points is always defined, but the clopen set has no border points, and thus the border is empty). – celtschk Apr 13 '14 at 15:13
• Well, showing that is showing that $\mathbb R$ is connected. – celtschk Apr 13 '14 at 15:47

Suppose $X \subset \mathbb{R}$ is nonempty, open and closed. Let $x_0 \in X$. Finally suppose that $X \neq \mathbb{R}$; then there is some $y \not\in X$; WLOG we can assume that $y > x_0$.

Then the set $Z = \{ x \in \mathbb{R} : x > x_0, x \not\in X \}$ is bounded below (by $x_0$) and nonempty ($y \in Z$). Therefore $\inf Z = z$ exists.

• Suppose $z \in X$. Then since $X$ is open, it contains an open neighborhood $(z - \epsilon, z + \epsilon)$. This contradicts the definition of $z = \inf Z$, because there would be a sequence $z_n > z$, $|z - z_n| < \frac{1}{n}$, $z_n \in Z \Rightarrow z_n \not \in X$. This is not possible, because $[z, z + \epsilon) \subset X$.

• Suppose $z \not \in X$. Then since $X$ is closed, its complement is open, therefore there is an open neighborhood $(z - \epsilon, z + \epsilon)$ contained in $\mathbb{R} \setminus X$. Then $z - \frac{\epsilon}{2}$ contradicts the $\inf$ definition of $z$.

It follows that $X = \mathbb{R}$.

• why would $z-\frac{\epsilon}{2}$ immediately yield a contradiction? – user162089 Jun 7 '17 at 11:43
• @user162089 Because $z - \epsilon/2$ is in $\mathbb{R} \setminus X$. Furthermore so is all of $[z-\epsilon/2, z]$, thus $x_0 \not \in [z-\epsilon/2,z]$. However by definition $z$ is the inf of $\mathbb{R} \setminus X \cap (x_0,+\infty]$, therefore $z \le z - \epsilon/2$, a contradiction. – Najib Idrissi Jun 7 '17 at 11:47
• How do you obtain $z\leq z-\epsilon/2$ from $z$ being the infimum of the set $Z$? I can't see why the jump holds. – user162089 Jun 7 '17 at 12:01

You're trying to prove that $\mathbb{R}$ is connected. You can do as follow : if a set $\mathbf{A}$ is both open and closed, then you can check that $\mathbb{1}_\mathbf{A}$ (the characteristic function of $\mathbf{A}$) is continuous, because $\mathbb{1}_\mathbf{A}^{-1}(O)$ where O is open is either $A$, its complement, the empty set or $R$ depending on $1$ and/or $0$ being in $O$, and all these set are open.

But $\mathbb{1}_\mathbf{A}$ only takes values $1$ or $0$, so it's easy to see that if it's continuous, then it's constant (if it is not, by the Intermediate Value Theorem, then it should also take all values between $0$ and $1$). Hence it's either always $1$ or $0$. And so $\mathbf{A}$ is either $\mathbb{R}$ or the empty set.

• Quite an elegant approach ! – Robin Apr 21 '14 at 18:11
• All you have proven is that a space $X$ is connected iff all functions $X \to \{0,1\}$ are constant. What you haven't proven (you just said "it's easy") is that all functions $\mathbb{R} \to \{0,1\}$ are constant. – Najib Idrissi Jul 12 '16 at 9:56
• No, I claimed that all continuous functions $\mathbb{R} \to \{ 0, 1 \}$ are constant (of course it is false in general, e.g. $\mathbb{1}_\mathbb{Q}$ is not). I just added a short justification, but it's just a trivial application of the (well-known !) Intermediate Value Theorem. – yago Jul 13 '16 at 11:10
• Nice approach! If $\Bbb R$ were disconnected then there would exist a continuous $f:\Bbb R\to \Bbb R$ that does not have the IVP. – DanielWainfleet Aug 17 '18 at 9:24

Because $\mathbb R$ is connected. Asume $U$ is a nonempty proper open and closed subset of $\mathbb R$, that is $V:=\mathbb R\setminus U$ is also nonempty and open. Let $u\in U$, $v\in V$. Wlog. $u<v$. Let $a=\sup([u,v]\cap U)$. As $[u,v]\cap U$ is a nonempty bounded closed set, $a\in([u,v]\cap U)$. Hence $u\le a<v$ (as $v\notin U$) and $U$ contains some $\epsilon$ neighbourhood of $a$. But then $\min\{a+\frac12\epsilon, v\}\in U\cap[u,v]$, contradiction to $a$ being the supremum.

Let $S$ be a nonempty subset of $\mathbb{R}$ that is both open and closed. Let's say that $S$ contains the element $s$. We want to show that no element of $\mathbb{R} - S$ can be bigger than or less than $s$, immediately implying that it is empty.

Suppose that there are elements of $\mathbb{R} - S$ bigger than $s$. We can construct the set $X$ of all such elements, and consider its infimum. Use the fact that $S$ is open and closed to derive a contradiction. A similar argument works to show there are no elements of $\mathbb{R} - S$ smaller than $s$.

Note: This argument crucially uses the structure of $\mathbb{R}$ in asserting the existence of infimums and supremums.

A space $X$ is connected if the only subsets of $X$ with empty boundary are $X$ and the empty set. Alternatively, $X$ is connected if the only subsets of $X$ which are both open and closed are $X$ and the empty set. Therefore, your first question asks if there exists any subset of $\mathbb R$ that is connected. Indeed, yes, there is. An interval is connected. Your second question seems to ask if $\mathbb R$ is connected. Yes, it is. For a proof, see here.

Here's yet another proof, which works by constructing a border point if $A$ is clopen nonempty proper subset of $\mathbb{R}$:

Be $A\subset\mathbb R$ both open and closed, but neither empty nor $\mathbb R$. Then there exist points $a\in A$ and $b\in\mathbb R\setminus A$.

Now construct two sequences $(a_n)$ and $(b_n)$ as follows:

$a_0=a$, $b_0=b$. For any $n$, be $c_n=(a_n+b_n)/2$. If $c_n\in A$, then $a_{n+1}=c_n$, $b_{n+1}=b_n$, else $a_{n+1}=a_n$, $b_{n+1}=c_n$.

Quite obviously for all $n$, $a_n\in A$ and $b_n\notin A$. Also $\lim_{n\to\infty}\left|a_n-b_n\right| = \lim_{n\to\infty}2^{-n}\left|a-b\right| = 0$. Therefore there exists exactly one point $x$ so that $\min(a_n,b_n)\le x\le\max(a_n,b_n)$ for all $n$ (nested intervals).

Since $\lim_{n\to\infty}a_n=x$ and $\lim_{n\to\infty} b_n=x$, we have in every open neighbourhood of $x$ both points in $A$ (namely $a_n$ for sufficiently large $n$) and in the complement of $A$ (namely $b_n$ for sufficiently large $n$). Thus $x$ is a border point of $A$, in contradiction that $A$ is both open and closed, and thus cannot have any border points.

I don't know why the other proofs seem overcomplicated to me... maybe mine's wrong. But here it is anyways.

Proof. Suppose $$F$$ is open and not equal to $$\mathbb{R}$$. Then there exists some number in $$\mathbb{R}$$ that's not in $$F$$. Since $$F$$ is closed we are guaranteed that $$F$$ has closest point ($$F$$ contains all it's points and limit points) to that number at distance equal to $$c$$. But that's not true because $$F$$ is open (it can't have an exact distance to any non members). Contradiction. $$F$$ must be $$\mathbb{R}$$.

If $A$ is open, $A$ is $\emptyset$ or a disjoint union of a countable collection of open intervals. If $A$ is the latter, then $A$ is closed if and only $A=\mathbb R$ because otherwise, $A$ would have nonempty border, violating the folklore that Set is Clopen iff Boundary is Empty.

Note: This is more in line with my thinking that $A$ has something to do with intervals, but unfortunately the first sentence of this post was not proven (or stated) in one of my elementary real analysis textbooks, namely the one by Trench. Luckily, it is an exercise in the other textbook, namely the one by Lay and is a proposition in my advanced real analysis textbook by Royden and Fitzpatrick.

For an open set

$$\overline{A} \setminus A = \text{bd}(A)$$

For a closed set

$$\text{bd}(A) \subseteq A$$

Therefore, for a clopen set,

$$\overline{A} \cap A^C = \overline{A} \setminus A \subseteq A$$

The last statement is false if $A$ is a proper subset of $\mathbb R$.

In re my other answer, this is aligned with Trench, Lay and Royden and Fitzpatrick but doesn't use ideas of intervals except possibly something about $A' = \overline{A}$, so I changed my answer from $A'$ to $\overline{A}$ (see previous revision).