Example of non-trivial set that is both closed and open in $\Bbb R$? [duplicate]

I need a very simple example of a set of Real numbers ( if there is any ) that is both closed and open on R .and the boundary of it equal empty set and it is neither empty set nor R.

like , The boundary of a set is empty if and only if the set is both closed and open (that is, a clopen set). on https://en.wikipedia.org/wiki/Boundary_(topology)

to disprove this statement ,Let (X,T ) be a topological space and let A ⊆ X. If Bd(A) = ∅, then A = ∅ or A = X.

marked as duplicate by Michael Greinecker♦Sep 15 '18 at 8:32

Short version: There are no such examples.

Longer version: Given any topological space $X,$ we always have that $X$ and $\emptyset$ are both closed and open. We say that such a space is connected if no other subsets of $X$ are both closed and open. The real line is an example of a connected topological space, so there are no other examples.

Longest version (that I'm going to post): Suppose that $A\subseteq\Bbb R$ is both closed and open, and that $A\neq\emptyset.$ Since $A$ is open and non-empty, then it is a countable (possibly finite, but non-empty) union of disjoint open intervals (some of which may be unbounded, but none of which are empty).

Suppose (by way of contradiction) that $\Bbb R\setminus A$ is also non-empty. Since $A$ is closed, then $\Bbb R\setminus A$ is open, so that $\Bbb R\setminus A$ is also a countable (possibly finite, but non-empty) union of disjoint open intervals (some of which may be unbounded, but none of which are empty).

As $A$ and $\Bbb R\setminus A$ are disjoint, then all of their component open intervals are also disjoint. Thus, since $\Bbb R=A\cup(\Bbb R\setminus A),$ then $\Bbb R$ is also a union of countably-many open intervals--possibly finitely-many, but there at least two such intervals (some of which may be unbounded, but none of which are empty). Since there are at least two, each non-empty, then one of the intervals (say $I$) has a least upper bound (say $y$). Since $y\in\Bbb R,$ then $y$ must lie in one of the component intervals (say $J$). Since $J$ is open and $y\in J,$ then there is some $c>0$ such that $(y-c,y+c)\subseteq J.$ But then there is some $x\in I\cap(y-c,y+c)$ (why?), so $x\in I\cap J,$ so $I=J$ (why?). Thus, $y\in I$ (why?), which is impossible (why?), and so we have reached the desired contradiction.

Since assuming $\Bbb R\setminus A$ to be non-empty yielded a contradiction, then $A=\Bbb R.$

• Comments are not for extended discussion; this conversation has been moved to chat. I was summoned to the scene by a system flag on the number of comments. It seemed to that your exchange had converged, so I took one of the default options and moved the exchange to a chatroom. If you need something undeleted just flag and explain. – Jyrki Lahtonen Jul 8 '17 at 9:38

As you may know, R equipped with the euclidean topology is a connected space. This means that it cannot be expressed as the disjoint union of two nonempty open sets. If there existed an example satisfying what you say, we would find an open set (the one you are looking for) and another open set (its complementary, which is open since your set is closed too) whose intersection would be the empty set and whose union would be the whole $\mathbb{R}$. Then, your example does not exist. The only sets satisfying what you ask for are $\emptyset$ and $\mathbb{R}$.

Let $U$ be a non-empty closed and open subset of $\mathbb{R}$. We go to prove that $U=\mathbb{R}$. Choose $a\in U$. Define $A=\{x\mid[a,x)\subseteq U\}$. Since $a$ is an interior point of $U$, $A$ is non-empty. We assert that $A$ is unbounded. Prove by contradiction. Suppose the contrary that $A$ is bounded, then $\xi=\sup A<\infty$ exists. Choose a sequence $\{x_{n}\}$ in $A$ such that $x_{1}\leq x_{2}\leq\ldots$ and $x_{n}\rightarrow\xi$. Observe that $[a,\xi)=\cup_{n}[a,x_{n})\subseteq U$ and $U$ is closed, so we have $\xi\in U$. Choose $\delta>0$ such that $(\xi-\delta,\xi+\delta)\subseteq U$, then $[a,\xi+\frac{\delta}{2})\subseteq U$ and hence $\xi+\frac{\delta}{2}\in A$. This contradicts to $\xi=\sup A$.

Clearly $A$ is unbounded $\Rightarrow$$[a,\infty)\subseteq U$. We can prove similarly that $(-\infty,a]\subseteq U$. Q.E.D.

• +1. On further consideration, I have elected not to edit my answer. That $I$ and $J$ are disjoint requires justification, though not much, and it really doesn't shorten my answer significantly. If you have more to add or ask, please see the link to the chat room below my answer. I will review it periodically for the next few days to make sure I can address anything you have to say. – Cameron Buie Jul 8 '17 at 13:51

It depends on the metric you are using. If you impose the discrete metric on $\mathbb{R}$ then all subsets are both open and closed. Please look here for more on this.