Why is $\mathbb{R}$ sometimes an open set and other times a closed set? I'm taking an Advanced Calculus course as an undergraduate student, and in my textbook Understanding Analysis by Stephen Abbott, I have this definition:

$\textbf{Example 3.2.2.}$ (i) Perhaps the simplest example of an open set is $\mathbb{R}$ itself. Given an arbitrary element $a\in\mathbb{R}$, we are free to pick any $\epsilon$-neighborhood we like and it will always be true that $V_{\epsilon}(a)\subseteq\mathbb{R}$.

However, reading the stack exchange here, trying to understand the questions in my homework about open and closed sets, limit points, closures, and compact sets, I see conflicts with this definition. In fact, even here on Wolfram Alpha, they say about closed intervals that

If one of the endpoints is $\pm\infty$, then the interval still contains all of its limit points (although not all of its endpoints), so $[a,\infty)$ and $(-\infty,b]$ are also closed intervals, as is the interval $(-\infty,\infty)$.

So, here I'm seeing that $\mathbb{R}$ is both open and closed. Why is this? I should probably go by my textbook either way, but I'd like to understand why I'm seeing different definitions.
Additionally, with a slightly related example, take the open interval $(0,1)$. Its complement is closed. But with this closed complement, why would $\mathbb{R}$ be open? What makes the whole set of real numbers different than this subset?
 A: $\Bbb R$ is clopen, in itself, meaning open and closed.
It's a common misunderstanding when one first learns about topology to think that a set that is not open, is closed, and vice versa. This is not the case, and given a set $X$, one can define a topology on $X$. But the definition of a topology requires that both $\emptyset$ and $X$ are open. Of course, the complement of an open set is closed, and hence both $\emptyset$ and $X$ are closed.
A: One of the things that seems to disturb newbies the most when they first learn topology is the fact that "open" and "closed" are not opposite concepts.  A set can be both open and closed at the same time ("clopen" if you will), and there are generally sets that are neither open nor closed.  In any topological space, you are guaranteed to have at least two clopen sets: the emptyset and the entire space.
More specifically, a topology $\tau$ on $X$ is a collection subsets of $X$ that has the following three properties:


*

*$\emptyset, X \in \tau$,

*If $\{U_{\alpha}\}_{\alpha\in A}$ is any subset of $\tau$, then $\bigcup_{\alpha\in A} U_{\alpha} \in \tau$ (that is, a topology is closed under arbitrary unions), and

*If $\{V_n\}_{n=1}^{N}$ is a subset of $\tau$ with finitely many elements, then $\bigcap_{n=1}^{N} V_n \in \tau$ (that is, a topology is closed under finite intersections).


The sets in $\tau$ are defined to be the open sets, and the complement of any open set is defined to be a closed set.  Note that both $\emptyset$ and $X$ are in $\tau$, so they must both be open.  On the other hand, the complement of $\emptyset$ is $X$, and the complement of $X$ is $\emptyset$, so both sets are closed, as well.
Finally, if we consider $\mathbb{R}$ with the "usual" topology, note that it must be both open and closed.  Moreover, there are subsets of $\mathbb{R}$ that are neither open nor closed:  consider intervals of the form $(a,b]$, for example.
There is an instructive documentary on this phenomenon, which can be found on Youtube (okay, it isn't really a documentary, but it is still worth watching, as I think that humour can sometimes help to solidify a concept).
