容斥原理用于计算若干集合的交集以及并集的基数。
$$ \left|\bigcup_{i=1}^n{X_i}\right|=\sum_{k=1}^n{\left(-1\right)^{k+1}\sum_{1\le i_1<\cdots <i_k\le n}^{}{\left| X_{i_1}\cap\cdots\cap X_{i_k}\right|}} $$
下面用归纳法进行证明:
当n为1时命题显然成立,而AυB=Aυ(B/(A∩B)),故|AυB|=|A|+|B/(A∩B)|=|A|+|B|-|A∩B|。命题在n为2的时候依旧成立。
假设当n为m时命题成立,那么当n为m+1时,我们记$ X‘=\bigcap_{i=1}^m{X_i} $:
$$ \left|\bigcup_{i=1}^{m+1}{X_i}\right|=\left| X‘\cup X_{m+1}\right|=\left| X‘\right|+\left| X_{m+1}\right|-\left| X‘\cap X_{m+1}\right| $$ $$ =\sum_{k=1}^m{\left(-1\right)^{\textrm{k}+1}\sum_{i_1<\cdots <\textrm{i}_{\textrm{k}}\le\textrm{m}}^{}{\left|\textrm{X}_{\textrm{i}_1}\cap\cdots\cap\textrm{X}_{\textrm{i}_{\textrm{k}}}\right|}}+\left| X_{m+1}\right|-\left|\bigcup_{i=1}^m{\left(X_i\cap\textrm{X}_{\textrm{m}+1}\right)}\right| $$ $$ =\sum_{k=1}^m{\left(-1\right)^{\textrm{k}+1}\sum_{i_1<\cdots <\textrm{i}_{\textrm{k}}\le\textrm{m}}^{}{\left|\textrm{X}_{\textrm{i}_1}\cap\cdots\cap\textrm{X}_{\textrm{i}_{\textrm{k}}}\right|}}+\left| X_{m+1}\right|+\sum_{k=1}^m{\left(-1\right)^{\textrm{k}}\sum_{i_1<\cdots <\textrm{i}_{\textrm{k}}\le\textrm{m}}^{}{\left|\textrm{X}_{\textrm{i}_1}\cap\cdots\cap\textrm{X}_{\textrm{i}_{\textrm{k}}}\cap\textrm{X}_{\textrm{m}+1}\right|}} $$ $$ =\sum_{k=1}^m{\left(-1\right)^{\textrm{k}+1}\sum_{i_1<\cdots <\textrm{i}_{\textrm{k}}\le\textrm{m}}^{}{\left|\textrm{X}_{\textrm{i}_1}\cap\cdots\cap\textrm{X}_{\textrm{i}_{\textrm{k}}}\right|}}+\sum_{k=1}^{m+1}{\left(-1\right)^{\textrm{k}+1}\sum_{i_1<\cdots <\textrm{i}_{\textrm{k}-1}\le\textrm{m,i}_{\textrm{k}}=\textrm{m}+1}^{}{\left|\textrm{X}_{\textrm{i}_1}\cap\cdots\cap\textrm{X}_{\textrm{i}_{\textrm{k}}}\right|}} $$ $$ =\sum_{k=1}^{m+1}{\left(-1\right)^{\textrm{k}+1}\sum_{i_1<\cdots <\textrm{i}_{\textrm{k}}\le\textrm{m}+1}^{}{\left|\textrm{X}_{\textrm{i}_1}\cap\cdots\cap\textrm{X}_{\textrm{i}_{\textrm{k}}}\right|}} $$
因此得知n为m+1时命题也成立。利用数学归纳法,知道对一切自然数n,命题都成立。