Counting finite sets

Stirling's formula open_in_new

We write $a_n\sim b_n$ to mean that $a_n/b_n\to 1$.

Theorem (Stirling's formula for log n!) open_in_new

In the limit $n\to\infty$, $$ \log n! \sim n\log n. $$

Proof

Theorem (Stirling's formula for n!) open_in_new

In the limit $n\to\infty$, $$ n! \sim \sqrt{2\pi} n^{n+1/2} e^{-n}.$$

Proof (non-examinable)

Sums and products open_in_new

Definition (finite set, cardinality) open_in_new

A non-empty set $\Omega$ is finite if there exists $n\in\N$ and a bijection $$ \set{1,2,\ldots,n}\to \Omega. $$ We call $n$ the cardinality or size and write $|\Omega| = n$.

For finite sets $\Omega_1, \Omega_2, \ldots, \Omega_k$,

  • $|\Omega_1\times\Omega_2\times\ldots\times\Omega_k| = |\Omega_1| \times |\Omega_2| \times \ldots \times |\Omega_k|$;

  • if $\Omega_1, \Omega_2, \ldots, \Omega_k$ are disjoint, then $|\Omega_1\union\Omega_2\union\ldots\union\Omega_k| = |\Omega_1| + |\Omega_2| + \ldots + |\Omega_k|$.

Counting permutations open_in_new

The number of bijections $\Omega_1 \to \Omega_2$ for $|\Omega_1| = |\Omega_2| = n$ is $n!$.

Counting subsets open_in_new

Let $n\in\N$ and $k=0,1,2,\ldots,n$. The number of subsets of $\set{1,2,\ldots, n}$ of size $k$ is $$ \pmatrix{n\\k} = \frac{n!}{k!(n-k)!}. $$

Derivation of number of permutations and subsets

Counting increasing and non-decreasing functions open_in_new

Consider functions $\set{1,2,\ldots,k} \to \set{1,2,\ldots,n}$ where $k\leq n$.

  • For (strictly) increasing functions i.e. $f(i+1) > f(i)$, there are $\pmat{n\\k}$ of them. (Derivation)

  • For non-decreasing functions i.e. $f(i+1) >= f(i)$, there are $\pmat{n+k-1\\k}$ of them. (Derivation)

Counting ordered partition open_in_new

An ordered partition of $m$ of size $n$ is a sequence of non-negative integers $(m_1,m_2,\ldots, m_n)$ such that $m_1+m_2+\ldots+m_n = m$. There are $\pmat{m+n-1\\m}$ such partitions. (Derivation)

Given $n\in\N$ and $n_1,n_2,\ldots,n_k\in\N$ where $n_1+n_2+\ldots+n_k=n$, an ordered partition of $\set{1,2,\ldots,n}$ is a sequence of subsets $(S_1, S_2, \ldots, S_k)$ such that $|S_i| = n_i$ for all $i$ and $S_1\union S_2\union\ldots\union S_k = \set{1,2,\ldots,n}$. The number of such partitions is $$ \pmat{n \\ n_1,n_2,\ldots,n_k} = \frac{n!}{n_1!n_2!\ldots n_k!} $$ by a similar argument to this.

Counting surjections open_in_new

The number of surjections $\set{1,2,\ldots,m}\to\set{1,2,\ldots,n}$ is $$ \sum_{k=0}^n (-1)^k \pmat{n\\k} (n-k)^m. $$

Derivation

Counting derangements open_in_new

The probability of a randomly chosen permutations of $\set{1,2,\ldots,n}$ having no fixed points (derangement) is $$ \sum_{k=0}^n \frac{(-1)^k}{k!}. $$

Derivation