(of a set in a topological space:)

A set is dense iff its closure is the entire space.

In a metric space, this reduces to the following: for every (positive) ε and every point x in the space, there exists a point y in the set such that d(x,y) < ε.

For instance, the set of rationals is dense inside the set of real numbers. Another example: A theorem of Weierstrass is that the set of polynomials is dense inside C([0,1]) (the set of continuous functions on [0,1], with the "L-infinity" topology of uniform convergence.

(of an order type or a total order:)

An ordered set (A,<) is dense iff there is an element of A between any two elements of A: ∀x,y∈A: (x<y) → ∃z∈A: x<z&z<y.

Note that only a single set participates in this definition of set -- not 2, like in the topological definition above!

The concept may also be extended further to a partially ordered set (a poset) by using the same formula.

For instance, the set of rational numbers with their regular ordering is dense: for any x,y, we can take (x+y)/2 (or even (2x+3y)/5), which lies between them.