This article needs additional citations for verification. (February 2010) (Learn how and when to remove this template message)
In topology and related areas of mathematics, a subset A of a topological space X is called dense (in X) if every point x in X either belongs to A or is a limit point of A; that is, the closure of A is constituting the whole set X. Informally, for every point in X, the point is either in A or arbitrarily "close" to a member of A — for instance, the rational numbers are a dense subset of the real numbers because every real number either is a rational number or has a rational number arbitrarily close to it (see Diophantine approximation).
Formally, a subset A of a topological space X is dense in X if for any point x in X, any neighborhood of x contains at least one point from A (i.e., A has non-empty intersection with every non-empty open subset of X). Equivalently, A is dense in X if and only if the only closed subset of X containing A is X itself. This can also be expressed by saying that the closure of A is X, or that the interior of the complement of A is empty.
The density of a topological space X is the least cardinality of a dense subset of X.
Density in metric spaces
An alternative definition of dense set in the case of metric spaces is the following. When the topology of X is given by a metric, the closure of A in X is the union of A and the set of all limits of sequences of elements in A (its limit points),
Then A is dense in X if
The real numbers with the usual topology have the rational numbers as a countable dense subset which shows that the cardinality of a dense subset of a topological space may be strictly smaller than the cardinality of the space itself. The irrational numbers are another dense subset which shows that a topological space may have several disjoint dense subsets (in particular, two dense subsets may be each other's complements), and they need not even be of the same cardinality. Perhaps even more surprisingly, both the rationals and the irrationals have empty interiors, showing that dense sets need not contain any nonempty open set.
By the Weierstrass approximation theorem, any given complex-valued continuous function defined on a closed interval [a,b] can be uniformly approximated as closely as desired by a polynomial function. In other words, the polynomial functions are dense in the space C[a,b] of continuous complex-valued functions on the interval [a,b], equipped with the supremum norm.
Every topological space is a dense subset of itself. For a set X equipped with the discrete topology the whole space is the only dense set. Every non-empty subset of a set X equipped with the trivial topology is dense, and every topology for which every non-empty subset is dense must be trivial.
Denseness is transitive: Given three subsets A, B and C of a topological space X with A ⊆ B ⊆ C ⊆ X such that A is dense in B and B is dense in C (in the respective subspace topology) then A is also dense in C.
A topological space with a connected dense subset is necessarily connected itself.
Continuous functions into Hausdorff spaces are determined by their values on dense subsets: if two continuous functions f, g : X → Y into a Hausdorff space Y agree on a dense subset of X then they agree on all of X.
For metric spaces there are universal spaces, into which all spaces of given density can be embedded: a metric space of density α is isometric to a subspace of C([0,1]α, R), the space of real continuous functions on the product of α copies of the unit interval. 
A point x of a subset A of a topological space X is called a limit point of A (in X) if every neighbourhood of x also contains a point of A other than x itself, and an isolated point of A otherwise. A subset without isolated points is said to be dense-in-itself.
A subset A of a topological space X is called nowhere dense (in X) if there is no neighborhood in X on which A is dense. Equivalently, a subset of a topological space is nowhere dense if and only if the interior of its closure is empty. The interior of the complement of a nowhere dense set is always dense. The complement of a closed nowhere dense set is a dense open set. Given a topological space X, a subset A of X that can be expressed as the union of countably many nowhere dense subsets of X is called meagre. The rational numbers, while dense in the real numbers, are meagre as a subset of the reals.
A topological space with a countable dense subset is called separable. A topological space is a Baire space if and only if the intersection of countably many dense open sets is always dense. A topological space is called resolvable if it is the union of two disjoint dense subsets. More generally, a topological space is called κ-resolvable if it contains κ pairwise disjoint dense sets.
A linear operator between topological vector spaces X and Y is said to be densely defined if its domain is a dense subset of X and if its range is contained within Y. See also continuous linear extension.
- Nicolas Bourbaki (1989) . General Topology, Chapters 1–4. Elements of Mathematics. Springer-Verlag. ISBN 3-540-64241-2.
- Steen, Lynn Arthur; Seebach, J. Arthur Jr. (1995) , Counterexamples in Topology (Dover reprint of 1978 ed.), Berlin, New York: Springer-Verlag, ISBN 978-0-486-68735-3, MR 0507446