Half the integers are even. We all know that, but *what does that mean?* We say that "half the numbers in (0,1) are less than 1/2", because m((0,1/2))=1/2=1/2*m((0,1)), where m(I) is the length or, more generally, the Lebesgue measure of I. But there is no uniform distribution on the integers! So we cannot hope to find some measure μ for which μ(*even numbers*)=1/2*μ(*integers*).

Density is an alternative attempt to formalise the statement at the top. For any (large) n, we *can* say how many integers 1,...,n are even: either n/2 or (n-1)/2. So either 1/2 or 1/2-1/(2n) out of 1,...,n are even. And the limit of this expression for large n is 1/2. We say that the density of the even numbers in the natural numbers is 1/2.

#### Definition

Let **A**={a_{1},...} be a countable set. Typically **A**=**N**={1,2,...}. But note that the particular enumeration chosen influences the concept of density very strongly! Let X⊆**A** be some subset. The *density* of X in **A** is

lim_{n→∞} |X∩{a_{1},...,a_{n}}| / n

(if the

limit exists; otherwise, we say

*X has no density*).

Replacing "lim" with "lim sup" or "lim inf", we get "upper density" and "lower density", respectively; note that these *always* exist, and are between 0 and 1.

#### Easy facts

- X has density iff its lower and upper densities are equal.
- The density of X is ≥ 0 and ≤ 1.
- If X is finite, its density is 0. If we add or remove finitely many elements of X, its density is unchanged.
- Density is
*finitely additive*: if X and Y are disjoint sets which both have density, then X∪Y has density, which is the sum of the densities of X and Y.
- Unlike measure, density is not sigma additive.
- By re-ordering
**A**, we can get any density in [0,1] for any infinite subset X.

#### Examples

- The set of even integers has density 1/2.
- The sets of squares, primes, perfect numbers (and others) have density 0.
- Not every set has density. For instance,
X = {1,3,4,9,10,11,12,13,14,15,16,...} = {1} ∪ {2^{1}+1,...,2^{2}} ∪ ... ∪ {2^{2k-1}+1,...,2^{2k}} ∪ ...

has no density (its lower density is 1/2, as seen by taking n=2^{2k-1}, while its upper density is 3/4, as seen by taking n=2^{2k}).

One can view density as a special case of Césaro means, or even summability, of the characteristic function of X.