# Nowhere dense set

In mathematics, a subset of a topological space is called nowhere dense or rare if its closure has empty interior. In a very loose sense, it is a set whose elements are not tightly clustered (as defined by the topology on the space) anywhere. For example, the integers are nowhere dense among the reals, whereas the interval (0, 1) is not nowhere dense.
A countable union of nowhere dense sets is called a meagre set. Meagre sets play an important role in the formulation of the Baire category theorem, which is used in the proof of several fundamental results of functional analysis.

## Definition

Density nowhere can be characterized in different (but equivalent) ways. The simplest definition is the one from density:
   A subset $S$ of a topological space $X$ is said to be dense in another set $U$ if the intersection $S\cap U$ is a dense subset of $U.$ $S$ is nowhere dense or rare in $X$ if $S$ is not dense in any nonempty open subset $U$ of $X.$
Expanding out the negation of density, it is equivalent that each nonempty open set $U$ contains a nonempty open subset disjoint from $S.$ It suffices to check either condition on a base for the topology on $X.$ In particular, density nowhere in $\mathbb {R}$ is often described as being dense in no open interval.

### Definition by closure

The second definition above is equivalent to requiring that the closure, $\operatorname {cl} _{X}S,$ cannot contain any nonempty open set. This is the same as saying that the interior of the closure of $S$ is empty; that is,
   $\operatorname {int} _{X}\left(\operatorname {cl} _{X}S\right)=\varnothing .$
Alternatively, the complement of the closure $X\setminus \left(\operatorname {cl} _{X}S\right)$ must be a dense subset of $X;$ in other words, the exterior of $S$ is dense in $X.$

## Properties

The notion of nowhere dense set is always relative to a given surrounding space. Suppose $A\subseteq Y\subseteq X,$ where $Y$ has the subspace topology induced from $X.$ The set $A$ may be nowhere dense in $X,$ but not nowhere dense in $Y.$ Notably, a set is always dense in its own subspace topology. So if $A$ is nonempty, it will not be nowhere dense as a subset of itself. However the following results hold:
* If $A$ is nowhere dense in $Y,$ then $A$ is nowhere dense in $X.$
* If $Y$ is open in $X$, then $A$ is nowhere dense in $Y$ if and only if $A$ is nowhere dense in $X.$
* If $Y$ is dense in $X$, then $A$ is nowhere dense in $Y$ if and only if $A$ is nowhere dense in $X.$
A set is nowhere dense if and only if its closure is.
Every subset of a nowhere dense set is nowhere dense, and a finite union of nowhere dense sets is nowhere dense. Thus the nowhere dense sets form an ideal of sets, a suitable notion of negligible set. In general they do not form a 𝜎-ideal, as meager sets, which are the countable unions of nowhere dense sets, need not be nowhere dense. For example, the set $\mathbb {Q}$ is not nowhere dense in $\mathbb {R} .$
The boundary of every open set and of every closed set is closed and nowhere dense. A closed set is nowhere dense if and only if it is equal to its boundary, if and only if it is equal to the boundary of some open set (for example the open set can be taken as the complement of the set). An arbitrary set $A\subseteq X$ is nowhere dense if and only if it is a subset of the boundary of some open set (for example the open set can be taken as the exterior of $A$).

## Examples

* The set $S=\{1/n:n=1,2,...\}$ and its closure $S\cup \{0\}$ are nowhere dense in $\mathbb {R} ,$ since the closure has empty interior.
* The Cantor set is an uncountable nowhere dense set in $\mathbb {R} .$
* $\mathbb {R}$ viewed as the horizontal axis in the Euclidean plane is nowhere dense in $\mathbb {R} ^{2}.$
* $\mathbb {Z}$ is nowhere dense in $\mathbb {R}$ but the rationals $\mathbb {Q}$ are not (they are dense everywhere).
* $\mathbb {Z} \cup [(a,b)\cap \mathbb {Q} ]$ is not nowhere dense in $\mathbb {R}$: it is dense in the open interval $(a,b),$ and in particular the interior of its closure is $(a,b).$
* The empty set is nowhere dense. In a discrete space, the empty set is the only nowhere dense set.
* In a T$_1$ space, any singleton set that is not an isolated point is nowhere dense.
* A vector subspace of a topological vector space is either dense or nowhere dense.

## Nowhere dense sets with positive measure

A nowhere dense set is not necessarily negligible in every sense. For example, if $X$ is the unit interval $[0,1],$ not only is it possible to have a dense set of Lebesgue measure zero (such as the set of rationals), but it is also possible to have a nowhere dense set with positive measure. One such example is the Smith–Volterra–Cantor set.
For another example (a variant of the Cantor set), remove from $[0,1]$ all dyadic fractions, i.e. fractions of the form $a/2^{n}$ in lowest terms for positive integers $a,n\in \mathbb {N} ,$ and the intervals around them: $\left(a/2^{n}-1/2^{2n+1},a/2^{n}+1/2^{2n+1}\right).$ Since for each $n$ this removes intervals adding up to at most $1/2^{n+1},$ the nowhere dense set remaining after all such intervals have been removed has measure of at least $1/2$ (in fact just over $0.535\ldots$ because of overlaps) and so in a sense represents the majority of the ambient space $[0,1].$ This set is nowhere dense, as it is closed and has an empty interior: any interval $(a,b)$ is not contained in the set since the dyadic fractions in $(a,b)$ have been removed.
Generalizing this method, one can construct in the unit interval nowhere dense sets of any measure less than $1,$ although the measure cannot be exactly 1 (because otherwise the complement of its closure would be a nonempty open set with measure zero, which is impossible).
For another simpler example, if $U$ is any dense open subset of $\mathbb {R}$ having finite Lebesgue measure then $\mathbb {R} \setminus U$ is necessarily a closed subset of $\mathbb {R}$ having infinite Lebesgue measure that is also nowhere dense in $\mathbb {R}$ (because its topological interior is empty). Such a dense open subset $U$ of finite Lebesgue measure is commonly constructed when proving that the Lebesgue measure of the rational numbers $\mathbb {Q}$ is $0.$ This may be done by choosing any bijection $f:\mathbb {N} \to \mathbb {Q}$ (it actually suffices for $f:\mathbb {N} \to \mathbb {Q}$ to merely be a surjection) and for every $r>0,$ letting $U_{r}~:=~\bigcup _{n\in \mathbb {N} }\left(f(n)-r/2^{n},f(n)+r/2^{n}\right)~=~\bigcup _{n\in \mathbb {N} }f(n)+\left(-r/2^{n},r/2^{n}\right)$ (here, the Minkowski sum notation $f(n)+\left(-r/2^{n},r/2^{n}\right):=\left(f(n)-r/2^{n},f(n)+r/2^{n}\right)$ was used to simplify the description of the intervals). The open subset $U_{r}$ is dense in $\mathbb {R}$ because this is true of its subset $\mathbb {Q}$ and its Lebesgue measure is no greater than $\sum _{n\in \mathbb {N} }2r/2^{n}=2r.$ Taking the union of closed, rather than open, intervals produces the F$_𝜎$-subset $S_{r}~:=~\bigcup _{n\in \mathbb {N} }f(n)+\left[-r/2^{n},r/2^{n}\right]$ that satisfies $S_{r/2}\subseteq U_{r}\subseteq S_{r}\subseteq U_{2r}.$ Because $\mathbb {R} \setminus S_{r}$ is a subset of the nowhere dense set $\mathbb {R} \setminus U_{r},$ it is also nowhere dense in $\mathbb {R} .$ Because $\mathbb {R}$ is a Baire space, the set $D:=\bigcap _{m=1}^{\infty }U_{1/m}=\bigcap _{m=1}^{\infty }S_{1/m}$ is a dense subset of $\mathbb {R}$ (which means that like its subset $\mathbb {Q} ,$ $D$ cannot possibly be nowhere dense in $\mathbb {R}$) with $0$ Lebesgue measure that is also a nonmeager subset of $\mathbb {R}$ (that is, $D$ is of the second category in $\mathbb {R}$), which makes $\mathbb {R} \setminus D$ a comeager subset of $\mathbb {R}$ whose interior in $\mathbb {R}$ is also empty; however, $\mathbb {R} \setminus D$ is nowhere dense in $\mathbb {R}$ if and only if its closure in $\mathbb {R}$ has empty interior. The subset $\mathbb {Q}$ in this example can be replaced by any countable dense subset of $\mathbb {R}$ and furthermore, even the set $\mathbb {R}$ can be replaced by $\mathbb {R} ^{n}$ for any integer $n>0.$