组合数学一:容斥原理

这篇随笔不是原创内容。
抄录 Stasys Jukna 所著 Extremal Combinatorics §1.6 The inclusion-exclusion principle。


The principle of inclusion and exclusion (sieve of Eratosthenes) is a powerful tool in the theory of enumeration as well as in number theory. This principle relates the cardinality of the union of certain sets to the cardinalities of intersections of some of them, these latter cardinalities often being easier to handle.

For any two sets \(A\) and \(B\), we have
\begin{equation*}
|A \cup B| = |A| + |B| - |A \cap B|.
\end{equation*}

In general, given \(n\) subsets \(A_1, \dots, A_n\) of set \(X\), we want to calculate the number \(|A_1 \cup \dots \cup A_n|\) of points in their union. As the first approximation of this number, we can take the sum
\begin{equation}
|A_1| + \dots + |A_n|. \label{naive-sum}
\end{equation}

However, in general, this number is too large since if, say \(A_i \cap A_j \ne \emptyset\) then each point of \(A_i \cap A_j\) is counted two times in \eqref{naive-sum}: once in \(|A_i|\) and once in \(|A_j|\). We can try to correct the situation by subtracting from \eqref{naive-sum} the sum
\begin{equation}
\sum_{1 \le i < j \le n} |A_i \cap A_j|. \label{two-sum}
\end{equation}

but then we get a number which is too small since each of the points in \(A_i \cap A_j \cap A_k \ne \emptyset\) is counted three times in \eqref{two-sum}: once in $ |A_i \cap A_j| $, once in $|A_j \cap A_k| $, and once in \(|A_i \cap A_k|\). We can therefore try to correct the situation by adding the sum
\begin{equation*}
\sum_{1 \le i < j < k \le n} | A_i \cap A_j \cap A_k|,
\end{equation*}

but again we will get a too large number, etc. Nevertheless, it turns out that after \(n\) steps well will get the correct result. This result is known as the inclusion-exclusion principle. The following notation will be handy: if $ I $ is a subset of the index set $ \{1, \dots, n\} $, we set
\begin{equation*}
A_I := \bigcap_{i \in I} A_i,
\end{equation*}

with the convention that \(A_{\emptyset} = X\).

Proposition 1 (Inclusion-Exclusion Principle). Let \(A_1, \dots, A_n\) be subsets of \(X\). Then the number of elements of \(X\) which lie in none of the subsets \(A_i\) is

\[\begin{equation} \sum_{I \subseteq \\{1, \dots, n \\}} (-1) ^ {|I|} |A_I|. \label{E:1} \end{equation} \]

Proof. The sum is a linear combination of cardinalities of sets \(A_I\) with coefficients \(+1\) and \(-1\). We can re-write this sum as
\begin{equation*}
\sum_I (-1)^{|I|} | A_I| = \sum_I \sum_{x \in A_I} (-1)^{|I|} = \sum_{x} \sum_{I \colon x \in A_I} (-1)^{|I|}.
\end{equation*}

We calculate, for each point of \(X\), its contribution to the sum, that is, the sum of the coefficients of the sets \(A_I\) which contain it.

First suppose that $ x \in X$ lies in none of the sets $ A_i $. Then the only term in the sum to which \(x\) contributes is that which $ I = \emptyset$; and this contribution is \(1\).

Otherwise, the set $ J := \{ i \colon x \in A_i \} $ is non-empty; and $ x \in A_I $ precisely when $ I \subseteq J $. Thus, the contribution of $ x $ is
\begin{equation*}
\sum_{ I \subseteq J } (-1) ^ { | I | } = \sum_{ 0 \le i \le |J| } \binom{|J|}{i} (-1)^i = (1 - 1)^{ |J| } = 0
\end{equation*}

by the binomial theorem.

Thus, points lying in no set \(A_i\) contribute $ 1 $ to the sum, while points in some $ A_i $ contribute $ 0 $; so the overall sum is the number of points lying in none of the sets, as claimed.

For some applications, the following form of the inclusion-exclusion principle is more convenient.

Proposition 2. Let \(A_1, \dots, A_n\) be a sequence of (not necessarily distinct) sets. Then
\begin{equation}
|A_1 \cup \dots \cup A_n| = \sum_{\emptyset \ne I \subseteq \{1 \dots n\}} (-1)^{ |I| + 1 } |A_I|. \label{E:2}
\end

Proof. The left-hand of \eqref{E:2} is \(|A_\emptyset|\) minus the number of elements of \(X = A_\emptyset\) which lie in none of the subsets \(A_i\). By Proposition 1 this number is
\begin{equation*}
|A_\emptyset| - \sum_{I \subseteq \{ 1, \dots, n\}} (-1)^{|I|} |A_I| = \sum_{\emptyset \ne I \subseteq \{1, \dots, n\}} (-1)^{ |I| + 1 } |A_I|,
\end{equation*}
as desired.

posted @ 2017-10-12 15:16  Pat  阅读(419)  评论(0编辑  收藏  举报