主要用来解决集合的计数问题。
最常见的应用题,A活动多少人,B活动多少人,AB两活动多少人之类的。
两三个集合的时候还能画图进行识别,三个以上的集合则看不太出来了。
∣ A 1 ∪ A 2 ∪ A 3 . . . ∪ A m ∣ = ∑ 1 ≤ i ≤ m ∣ A i ∣ − ∑ 1 ≤ i < j ≤ m ∣ A i ∩ A j ∣ + ∑ 1 ≤ i < j < k ≤ m ∣ A i ∩ A j ∩ A k ∣ − . . . + ( − 1 ) m − 1 ∣ A 1 ∩ A 2 ∩ A 3 . . . ∩ A m ∣ = ∑ k = 1 n ( − 1 ) k − 1 ∑ 1 < i 1 < i 2 < . . . < i k ≤ n ∣ A i 1 ∩ A i 2 . . . A i k ∣ \left\vert A_1 \cup A_2 \cup A_3...\cup A_m \right\vert = \sum_{1\le i \le m}\left\vert A_i \right\vert - \\ \sum_{1\le i \lt j \le m} \left\vert A_i \cap A_j\right\vert + \\ \sum_{1 \le i \lt j \lt k \le m} \left\vert A_i \cap A_j \cap A_k\right\vert- ...\\ +(-1)^{m-1}\left\vert A_1 \cap A_2 \cap A_3 ...\cap A_m\right\vert =\\ \sum_{k=1}^{n}(-1)^{k-1} \sum_{1 \lt i_1 \lt i_2 \lt ... \lt i_k \le n} |A_{i_1} \cap A_{i_2}...A_{i_k}| ∣A1∪A2∪A3...∪Am∣=1≤i≤m∑∣Ai∣−1≤i<j≤m∑∣Ai∩Aj∣+1≤i<j<k≤m∑∣Ai∩Aj∩Ak∣−...+(−1)m−1∣A1∩A2∩A3...∩Am∣=k=1∑n(−1)k−11<i1<i2<...<ik≤n∑∣Ai1∩Ai2...Aik∣
引入1
∣
⋃
i
=
1
n
A
i
∣
=
∣
A
1
∪
A
2
.
.
.
A
i
∣
\left \vert \bigcup_{i = 1}^n{A_i} \right\vert = \left\vert A_1\cup A_2...A_i\right\vert
i=1⋃nAi
=∣A1∪A2...Ai∣
引入2 德摩根定理
A
∪
B
‾
=
A
‾
∩
B
‾
A
∩
B
‾
=
A
‾
∪
B
‾
\overline{A \cup B} = \overline A \cap \overline B \\ \overline{A \cap B} =\overline A \cup \overline B
A∪B=A∩BA∩B=A∪B
当 n = 2
时
∣
A
1
∪
A
2
∣
=
∣
A
1
∣
+
∣
A
2
∣
−
∣
A
1
∩
A
2
∣
\left\vert A_1 \cup A_2 \right\vert = \left\vert A_1\right\vert + \left\vert A_2\right\vert - \left\vert A_1 \cap A_2\right\vert
∣A1∪A2∣=∣A1∣+∣A2∣−∣A1∩A2∣
成立。
假设当
n
=
s
(
s
≥
2
,
s
∈
N
∗
)
n = s(s \ge 2, s \in N^*)
n=s(s≥2,s∈N∗)时,结论成立。则当
n
=
s
+
1
n = s+1
n=s+1
∣
⋃
i
=
1
n
A
i
∣
=
∣
⋃
i
=
1
s
+
1
A
i
∣
=
∣
(
⋃
i
=
1
s
A
i
)
∪
A
s
+
1
∣
=
∣
⋃
i
=
1
s
A
i
∣
+
∣
A
s
+
1
∣
−
∣
(
⋃
i
=
1
s
A
i
)
∩
A
s
∣
=
∣
⋃
i
=
1
s
A
i
∣
+
∣
A
s
+
1
∣
−
∣
⋃
i
=
1
s
(
A
i
∩
A
s
+
1
)
∣
=
∑
1
≤
i
1
≤
s
+
1
∣
A
i
∣
+
∑
k
=
2
s
(
−
1
)
k
−
1
∑
1
≤
i
1
<
i
2
<
i
3
.
.
≤
s
∣
A
i
1
∩
A
i
2
∩
A
i
3
.
.
.
∩
A
i
k
∣
+
∑
k
=
2
s
+
1
(
−
1
)
k
−
1
∑
1
≤
i
1
<
i
2
.
.
.
<
i
k
≤
s
+
1
∣
A
i
1
∩
A
i
2
∩
A
i
3
.
.
A
i
k
∣
=
∑
1
≤
i
≤
s
+
1
∣
A
i
∣
+
∑
k
=
2
s
(
−
1
)
k
−
1
∑
1
≤
i
1
<
i
2
<
i
3
.
.
i
k
≤
s
∣
A
i
1
∩
A
i
2
∩
A
i
3
.
.
.
∩
A
i
k
∣
+
∑
k
=
2
s
(
−
1
)
k
−
1
∑
1
≤
i
1
<
i
2
<
i
3
.
.
≤
i
k
≤
s
+
1
∣
A
i
1
∩
A
i
2
∩
A
i
3
.
.
.
∩
A
i
k
∣
+
(
−
1
)
s
∣
A
1
∩
A
2
∩
A
3
∩
.
.
.
A
s
+
1
∣
=
∑
1
≤
i
≤
s
+
1
∣
A
i
∣
+
∑
k
=
2
s
+
1
(
−
1
)
k
−
1
∑
1
≤
i
1
<
i
2
.
.
i
k
≤
s
+
1
∣
A
i
1
∩
A
i
2
∩
.
.
.
A
i
k
∣
+
(
−
1
)
s
∣
A
1
∩
A
2
∩
A
3
∩
.
.
.
A
s
+
1
∣
=
∑
k
=
1
s
+
1
(
−
1
)
k
−
1
∑
1
≤
i
1
<
i
2
<
i
3
.
.
.
<
i
k
≤
s
+
1
∣
A
i
1
∩
A
i
2
.
.
.
∩
A
i
k
∣
\left\vert \bigcup_{i=1}^{n}A_i\right\vert = \left\vert \bigcup_{i=1}^{s+1}A_i \right\vert= \left\vert \big(\bigcup _{i =1}^s A_i\big) \cup A_{s+1}\right\vert \\= \\ \left\vert \bigcup_{i=1}^s A_i\right\vert + \left\vert A_{s+1}\right\vert - \left\vert \big( \bigcup_{i=1}^s A_i\big)\cap A_{s}\right\vert \\ = \\ \left\vert \bigcup_{i=1}^s A_i \right\vert \ + \left\vert A_{s+1}\right\vert -\left\vert \bigcup _{ i=1}^s(A_i \cap A_{s+1}) \right\vert \\=\\ \sum_{1 \le i_1 \le s+1}\left\vert A_i\right\vert + \sum_{k =2}^{s}(-1)^{k-1} \sum_{1 \le i_1 \lt i_2 \lt i_3 .. \le s} \left\vert A_{i_1} \cap A_{i_2} \cap A_{i_3}... \cap A_{i_k}\right\vert + \sum_{k=2}^{s+1}(-1)^{k-1}\sum_{1\le i_1 \lt i_2... \lt i_k \le s+1 }|A_{i_1} \cap A_{i_2} \cap A_{i_3}..A_{i_k}| \\= \\ \sum_{1 \le i \le s+1}| A_{i}| +\sum_{k =2}^{s}(-1)^{k-1} \sum_{1 \le i_1 \lt i_2 \lt i_3 .. i_k\le s} \left\vert A_{i_1} \cap A_{i_2} \cap A_{i_3}... \cap A_{i_k}\right\vert +\sum_{k =2}^{s}(-1)^{k-1} \sum_{1 \le i_1 \lt i_2 \lt i_3 .. \le i_k \le s+1} \left\vert A_{i_1} \cap A_{i_2} \cap A_{i_3}... \cap A_{i_k}\right\vert +(-1)^s |A_1 \cap A_2 \cap A_3 \cap... A_{s+1}| \\= \\ \sum_{1 \le i \le s+1}|A_{i}| + \sum_{k=2}^{s+1}(-1)^{k-1}\sum_{1 \le i_1 \lt i_2 ..i_k \le s+1}|A_{i_1} \cap A_{i_2} \cap... A_{i_k}| \ + (-1)^s |A_1 \cap A_2 \cap A_3 \cap... A_{s+1}| \\ \\= \\ \sum_{k=1}^{s+1}(-1)^{k-1} \sum_{1 \le i_1 \lt i_2 \lt i_3... \lt i_k \le s+1}|A_{i_1} \cap A_{i_2}...\cap A_{i_k}|
i=1⋃nAi
=
i=1⋃s+1Ai
=
(i=1⋃sAi)∪As+1
=
i=1⋃sAi
+∣As+1∣−
(i=1⋃sAi)∩As
=
i=1⋃sAi
+∣As+1∣−
i=1⋃s(Ai∩As+1)
=1≤i1≤s+1∑∣Ai∣+k=2∑s(−1)k−11≤i1<i2<i3..≤s∑∣Ai1∩Ai2∩Ai3...∩Aik∣+k=2∑s+1(−1)k−11≤i1<i2...<ik≤s+1∑∣Ai1∩Ai2∩Ai3..Aik∣=1≤i≤s+1∑∣Ai∣+k=2∑s(−1)k−11≤i1<i2<i3..ik≤s∑∣Ai1∩Ai2∩Ai3...∩Aik∣+k=2∑s(−1)k−11≤i1<i2<i3..≤ik≤s+1∑∣Ai1∩Ai2∩Ai3...∩Aik∣+(−1)s∣A1∩A2∩A3∩...As+1∣=1≤i≤s+1∑∣Ai∣+k=2∑s+1(−1)k−11≤i1<i2..ik≤s+1∑∣Ai1∩Ai2∩...Aik∣ +(−1)s∣A1∩A2∩A3∩...As+1∣=k=1∑s+1(−1)k−11≤i1<i2<i3...<ik≤s+1∑∣Ai1∩Ai2...∩Aik∣
成立得证。
另一种证明则是元素出现个数的时候的证明,参见OI_WIKI。