In mathematics, a subset of a topological space is called **nowhere dense**^{[1]}^{[2]} or **rare**^{[3]} 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 an open ball is not.

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 result of functional analysis.

Density nowhere can be characterized in different (but equivalent) ways. The simplest definition is the one from density:

A subset of a topological space is said to be

in another set if the intersection is a dense subset of isdenseornowhere densein if is not dense in any nonempty open subset ofrare

Expanding out the negation of density, it is equivalent to require that each nonempty open set contains a nonempty open subset disjoint from ^{[4]} It suffices to check either condition on a base for the topology on In particular, density nowhere in is often described as being dense in no open interval.^{[5]}^{[6]}

The second definition above is equivalent to requiring that the closure, cannot contain any nonempty open set.^{[7]} This is the same as saying that the interior of the closure of is empty; that is,

^{[8]}^{[9]}

Alternatively, the complement of the closure must be a dense subset of ^{[4]}^{[8]} in other words, the exterior of is dense in

The notion of *nowhere dense set* is always relative to a given surrounding space. Suppose where has the subspace topology induced from The set may be nowhere dense in but not nowhere dense in Notably, a set is always dense in its own subspace topology. So if is nonempty, it will not be nowhere dense as a subset of itself. However the following results hold:^{[10]}^{[11]}

- If is nowhere dense in then is nowhere dense in
- If is open in , then is nowhere dense in if and only if is nowhere dense in
- If is dense in , then is nowhere dense in if and only if is nowhere dense in

A set is nowhere dense if and only if its closure is.^{[1]}

Every subset of a nowhere dense set is nowhere dense, and a finite union of nowhere dense sets is nowhere dense.^{[12]} 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 is not nowhere dense in

The boundary of every open set and of every closed set is closed and nowhere dense.^{[13]}^{[2]} A closed set is nowhere dense if and only if it is equal to its boundary,^{[13]} if and only if it is equal to the boundary of some open set^{[2]} (for example the open set can be taken as the complement of the set). An arbitrary set 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 ).

- The set and its closure are nowhere dense in since the closure has empty interior.
- viewed as the horizontal axis in the Euclidean plane is nowhere dense in
- is nowhere dense in but the rationals are not (they are dense everywhere).
- is
nowhere dense in : it is dense in the open interval and in particular the interior of its closure is*not* - The empty set is nowhere dense. In a discrete space, the empty set is the
*only*nowhere dense set.^{[14]} - 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.
^{[15]}

A nowhere dense set is not necessarily negligible in every sense. For example, if is the unit interval 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.

For one example (a variant of the Cantor set), remove from all dyadic fractions, i.e. fractions of the form in lowest terms for positive integers and the intervals around them:
Since for each this removes intervals adding up to at most the nowhere dense set remaining after all such intervals have been removed has measure of at least (in fact just over because of overlaps^{[16]}) and so in a sense represents the majority of the ambient space
This set is nowhere dense, as it is closed and has an empty interior: any interval is not contained in the set since the dyadic fractions in have been removed.

Generalizing this method, one can construct in the unit interval nowhere dense sets of any measure less than 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).^{[17]}

For another simpler example, if is any dense open subset of having finite Lebesgue measure then is necessarily a closed subset of having infinite Lebesgue measure that is also nowhere dense in (because its topological interior is empty). Such a dense open subset of finite Lebesgue measure is commonly constructed when proving that the Lebesgue measure of the rational numbers is This may be done by choosing any bijection (it actually suffices for to merely be a surjection) and for every letting

(here, the Minkowski sum notation was used to simplify the description of the intervals).
The open subset is dense in because this is true of its subset and its Lebesgue measure is no greater than
Taking the union of closed, rather than open, intervals produces the F

that satisfies Because is a subset of the nowhere dense set it is also nowhere dense in
Because is a Baire space, the set

is a dense subset of (which means that like its subset cannot possibly be nowhere dense in ) with Lebesgue measure that is also a nonmeager subset of (that is, is of the second category in ), which makes a comeager subset of whose interior in is also empty; however, is nowhere dense in if and only if its