open and closed sets Consider the set 
$$S = [0,1/2] \cup [3/4, 7/8] \cup [15/16, 31/32] \cup \cdots$$
and the set 
$$T = (0,1/2) \cup  (3/4, 7/8) \cup (15/16, 31/32) \cup \cdots$$
Is $S$ open, closed or neither? Is $T$ open, closed, or neither?
 A: To be able to answer these questions you need to know what "open" and "closed" mean. And that depends on context.
In the context you are looking at, in which you are dealing with subsets of the real line, without any further information we usually assume that we are dealing with the standard meanings of "open" and "closed". The meanings are:


*

*A set is $\mathcal{O}\subseteq\mathbb{R}$ is open if and only if for every $x\in \mathcal{O}$ there is an $\epsilon\gt 0$ (which may depend on $x$) such that $(x-\epsilon,x+\epsilon)\subseteq \mathcal{O}$ (where $(x-\epsilon,x+\epsilon)$ is the set of all real numbers $y$ such that $x-\epsilon \lt y \lt x+\epsilon$). 

*A set $\mathcal{C}\subseteq\mathbb{R}$ is closed if and only if its complement $\mathbb{R}-\mathcal{C}$ is open; if and only if for every point $x\notin \mathcal{C}$, there exists $\epsilon\gt 0$ (which may depend on $x$) such that $(x-\epsilon,x+\epsilon)\cap \mathcal{C}=\emptyset$. Alternatively, a set $\mathcal{C}\subseteq\mathbb{R}$ is closed if and only if for every converging sequence of real numbers $\{x_n\}_{n=1}^{\infty}$, if each $x_n$ is in $\mathcal{C}$, and $\lim\limits_{n\to\infty}x_n = x$, then $x\in\mathcal{C}$. 
Some consequences of these definitions are: 


*

*Both the sets $\mathbb{R}$ and $\emptyset$ are open and closed.

*Every open interval is an open set. Every closed interval is a closed set.

*If $\mathcal{O}_1$ and $\mathcal{O}_2$ are both open, then their intersection $\mathcal{O}_1\cap\mathcal{O}_2$ is also open (given $x$ in the intersection, find $\epsilon_1\gt 0$ and $\epsilon_2\gt 0$ so that $(x-\epsilon_i,x+\epsilon_i)\subseteq\mathcal{O}_i$, and then let $\epsilon=\min\{\epsilon_1,\epsilon_2\}$ be the witness for the intersection). As a consequence, using De Morgan's laws, if $\mathcal{C}_1$ and $\mathcal{C}_2$ are closed, then $\mathcal{C}_1\cup\mathcal{C}_2$ is closed.

*Using induction, from 3 it follows that any intersection of finitely many open sets is open, and any union of finitely many closed sets is closed.

*If $\mathcal{O}_i$ is any family (of any size, finite or infinite) of open sets, then $\cup\mathcal{O}_i$ is also open (pick $x$ in the union; then it belongs to some $\mathcal{O}_j$, and since $\mathcal{O}_j$ is open and $x\in\mathcal{O}_j$, there exists $\epsilon\gt 0$ such that $(x-\epsilon,x+\epsilon)\subseteq\mathcal{O}_j\subseteq \cup\mathcal{O}_i$). Consequently, if $\mathcal{C}_i$ is any family (of any size, finite or infinite) of closed sets, then $\cap\mathcal{C}_i$ is closed.


So, looking back at your examples, it should be clear that $T$ must be open, since it is a union of open intervals; open intervals are open sets, and an arbitrary union of open sets is always open. What is not clear is whether $S$ is closed or not, and that is because:


*

*In general, an arbitrary intersection of open sets is not necessarily open; it may be open, or it may be closed (e.g., $\mathop{\cap}\limits_{n=1}^{\infty}(-\frac{1}{n},1+\frac{1}{n}) = [0,1]$), or it may be neither open nor closed. 

*In general, an arbitrary union of closed sets is not necessarily closed; it may be closed, but it may also be open, or neither.


So... what about $S$? It is somewhat difficult at first thought to try to determine if it is closed using the definition of "complement is open"; but it is not too bad to verify that it does not satisfy the condition I labeled as "equivalent": if we have a sequence of points in $S$ that converges in $\mathbb{R}$, will the limit be in $S$? Well, take $x_n = 1 - \frac{1}{2^{2n+1}}$; that is $x_1=\frac{7}{8}$, $x_2 = \frac{31}{32}$, $x_3=\frac{127}{128}$, etc. All of these are in $S$, and the sequence converges to $1$. Is $1$ in $S$? $1$ is in $S$ if and only if it is in at leat one of the intervals in the union... is it? Well, no. So $S$ is not closed.
Is $S$ open, then? Well, if it were open, then since $\frac{1}{2}\in S$, there would have to be some $\epsilon\gt 0$ such that $(\frac{1}{2}-\epsilon,\frac{1}{2}+\epsilon)\subseteq S$. Is there such an $\epsilon$? Well, no; any such interval would contain points smaller than $\frac{1}{2}$, and there are no points smaller than $\frac{1}{2}$ in $S$. So $S$ is not open either.
So, if $S$ is not open, but is not closed either... then it's neither.
As Asaf points out, countably infinite unions of closed sets do show up a lot, so even though they may not be closed, we give them a special name because we often will want to say "this may be neither open nor closed, but is a countable union of closed sets." We call them $\mathcal{F}_{\sigma}$ (pronounced "eff-sigma") sets; $\mathcal{F}$ comes from the French fermé, for "closed"; $\sigma$ is a letter often used in mathematics to denote that a sum or union is taken a countable, but possibly infinite, number of times (from the French somme for sum). Dually, we are often interested in sets that are countable intersections of open sets; these sets may be open, closed, or neither, but we call them $\mathcal{G}_{\delta}$ ("gee-delta"); this time, in a fit of internationalism, it comes from the German, specifically Gebiet (open) and Durchshnitt (intersection). Your set $S$ is an $\mathcal{F}_\sigma$ set.
More generally, one talks about Topological spaces, generalizing these notions. A topological space is an ordered pair $(X,\mathcal{O})$, where $X$ is any set, and $\mathcal{O}$ is a collection of subsets of $X$; basically, we explicitly specify what sets are going to be the "open" sets. We require that the collection $\mathcal{O}$ satisfy some of the same conditions that the open sets in $\mathbb{R}$ satisfy, namely, we require that:


*

*$\emptyset$ and $X$ are both "open" sets (elements of $\mathcal{O}$);

*If $A$ and $B$ are both "open" sets, then $A\cap B$ is an open set (that is, if $A$ and $B$ are both elements of $\mathcal{O}$, then $A\cap B$ is an element of $\mathcal{O}$); and

*If $\{A_i\}_{i\in I}$ is a family, finite or infinite, of "open" sets, then $\mathop{\cup}\limits_{i\in I}A_i$ is also an "open" set (if each $A_i$ is an element of $\mathcal{O}$, then so is their union). 


Then we define a subset of $X$ to be closed if and only if its complement is open, and go from there. Caveat: the description of closed sets via limits of sequences is no longer true; one can define the notion of convergence, but in arbitrary topological spaces the properties are not as nice as they are in the real numbers (there are spaces where the properties are nice; they get special names for that). One needs to consider instead a more general notion (called "nets"). 
So the same set may have many "topologies", and many notions of what an open or closed set may mean. Which is why people are asking you if it is the "standard" topology or not (assuming you've gotten this far in my response, anyway...) That is, is it the notion I described above, or some other version of a topology? 
This is all part of the very interesting and deep field of Topology.
A: For the sake of the answer I am going to assume this is the standard topology of the real numbers, but I'll try to be as general as possible so it will be easier to generalize.
A union of any number of open sets is still open, so $T$ is open.
A union of countably many closed sets does not have to be closed, this sort of set is called $F_\sigma$.
While some $F_\sigma$ are open sets (in fact in a metric space, such as the real numbers with their standard topology, every open set is $F_\sigma$) this one is not. One of the requirements from an open set (in any topology) is that it will have an open neighborhood surrounding each point inside of it.
In the case above that means there will be an interval around each point, which is a property not being satisfied by $S$, as the point $\frac{1}{2}$ is in $S$ but there is no interval around it contained in $S$.
But there is still the case where $S$ could be closed as well, however if we look at the sequence $a_n = \frac{2^{2n-1}-1}{2^{2n-1}}$ (the endpoints of each closed interval within the union) then it is clear that $a_n$ approaches $1$ but since $1 \notin S$ then we have that $S$ is not closed.
A: If we have the standard topology T is the countable union of disjoint open sets and so T is an open set.
The complement of S is $(-\infty, 0) \cup (1/2, 3/4) \cup (7/8, 15/16) \cup \cdots$, etc. if this is open then S is closed. Is it open? Why?
