8 #96 Inclusion–exclusion principle forget
From 12.book. A single bijection that moves the smallest index \(j\) in and out matches tuples with an even number of indices with those with an odd number.
Find the number of elements of a union of finite sets from the numbers of elements of the intersections (inclusion–exclusion principle). First two sets, then the case of \(n\) sets.
8.1 Two sets
\(|A \cup B| + |A \cap B| = |A| + |B|\); written with integers, \(|A \cup B| = |A| + |B| - |A \cap B|\). \(B \setminus A\) is finite, and \(A \cup B\) splits disjointly into \(A\) and \(B \setminus A\), and \(B\) into \(A \cap B\) and \(B \setminus A\).
\(\operatorname{\#} A , \operatorname{\#} B , \operatorname{\#} ( A \cap B ) \in \mathbb{M} \Longrightarrow \operatorname{\#} ( A \cup B ) \in \mathbb{M} , \operatorname{\#} ( A \cup B ) + \operatorname{\#} ( A \cap B ) = \operatorname{\#} A + \operatorname{\#} B , \operatorname{\#} ( A \cup B ) = ( \operatorname{\#} A + \operatorname{\#} B ) - \operatorname{\#} ( A \cap B )\) \(\blacktriangleleft\) \(\mathbb{W}.\) ,AxℤPreparation for inclusion–exclusion: the sets \(A_1, \ldots, A_n\) are given by \(\langle i, x \rangle \in A\) (\(x \in A_i\)). For an element \(x\), putting in or removing the smallest index \(j\) containing it from the index set \(I\) gives a bijection between the pairs, for subsets of indices containing \(x\), \((I, x)\), with an even number of elements and those with an odd number.
8.2 Parity and moving one index in and out
Adding 1 swaps parity.
Removing one decreases the count by one.
Moving index \(j\) in or out: \(I'\) is \(I\) with \(j\) removed if present, and added if not.
Moving one index in or out swaps the parity of the count (Lt3).
The smallest index containing \(x\) (M1) is unique (M2).
8.3 Correspondence between even and odd
To a pair of an index set \(I\) and an element \(x\), \((I, x)\), assign the pair obtained as follows: for \(x\), the smallest index \(j\) containing it is put into or removed from \(I\), giving \((I', x)\) (this correspondence is a function).
From pairs with an even number of indices to those with an odd number (and vice versa): the correspondence of pairs stays within \(T\) and swaps the parity of the count.
Moving in and out is symmetric (moving in or out of \(I'\) the index \(j\) returns \(I\)).
This correspondence is a bijection between pairs with an even number of indices and pairs with an odd number.
Inclusion–exclusion: pairs with an even number of indices and pairs with an odd number are equinumerous (the bijection above). The pairs with 0 indices are equinumerous with the elements of \(U\), so \(u + (\text{pairs with a positive even number}) = (\text{pairs with an odd number})\). Finiteness follows from there being \(2^n\) subsets (the same proof as Freek2 #52).
8.4 Finiteness
The collection of all pairs \((I, x)\), \(T\), is a subset of \(\wp(\{1..n\}) \times U\), a finite set of at most \(2^n \cdot u\) elements.
Tfin …
\(n \in \mathbb{M} , T = \{ p \mid \exists I , x \, p = \langle I , x \rangle , I \subset 1 \mathinner{\ldotp\ldotp} n , x \in U , \forall i \in I . \langle i , x \rangle \in A \} , \operatorname{\#} U \in \mathbb{M} \Longrightarrow \operatorname{\#} T \in \mathbb{M}\) \(\blacktriangleleft\) ax_s ,↑0X ,⋅0X ,\(\mathbb{W}.\) ,Axℤ8.5 Pairs with 0 indices
There are as many pairs \((\emptyset, x)\) with 0 indices as elements of \(U\).
K1 …
\(T = \{ p \mid \exists I , x \, p = \langle I , x \rangle , I \subset 1 \mathinner{\ldotp\ldotp} n , x \in U , \forall i \in I . \langle i , x \rangle \in A \} , P = \{ p \in T \mid \operatorname{\#} ( \triangleleft p ) = 0 \} \Longrightarrow P \stackrel{\#}= U\) \(\blacktriangleleft\) ax_s ,#0 ,◁. ,pr:0 ,⋅𝕄:D ,⋅0X ,\(\mathbb{W}.\) ,Axℤ8.6 Inclusion–exclusion principle (relation of counts)
From the collection of all pairs with an even count, \(E\), removing the pairs with count 0 (as many as \(U\)) gives \(E_+\).
Hz …
\(T = \{ p \mid \exists I , x \, p = \langle I , x \rangle , I \subset 1 \mathinner{\ldotp\ldotp} n , x \in U , \forall i \in I . \langle i , x \rangle \in A \} , E = \{ p \in T \mid \exists k \in \mathbb{M} . k \in 2 \cdot \mathbb{M} , \operatorname{\#} ( \triangleleft p ) = k \} , Y = \{ p \in T \mid \exists k \in \mathbb{M} . k \in 2 \cdot \mathbb{M} , k \neq 0 , \operatorname{\#} ( \triangleleft p ) = k \} , \forall p ( p \in T \Longrightarrow \operatorname{\#} ( \triangleleft p ) \in \mathbb{M} ) \Longrightarrow \forall p ( p \in E \mathop\setminus Y \Longleftrightarrow p \in T , \operatorname{\#} ( \triangleleft p ) = 0 )\) \(\blacktriangleleft\) ⋅0X ,\(\mathbb{W}.\) ,AxℤAuxiliary: the number of indices of a pair in \(T\) is a natural number. \(E, E_+\) are subsets of \(T\). If \(E_+ \subset E\) then \(E = (E \setminus E_+) \cup E_+\) (disjoint).
Hc …
\(n \in \mathbb{M} , T = \{ p \mid \exists I , x \, p = \langle I , x \rangle , I \subset 1 \mathinner{\ldotp\ldotp} n , x \in U , \forall i \in I . \langle i , x \rangle \in A \} , p \in T \Longrightarrow \operatorname{\#} ( \triangleleft p ) \in \mathbb{M}\) \(\blacktriangleleft\) ⋅0X ,\(\mathbb{W}.\) ,AxℤHs …
\(E = \{ p \in T \mid \exists k \in \mathbb{M} . k \in 2 \cdot \mathbb{M} , \operatorname{\#} ( \triangleleft p ) = k \} , Y = \{ p \in T \mid \exists k \in \mathbb{M} . k \in 2 \cdot \mathbb{M} , k \neq 0 , \operatorname{\#} ( \triangleleft p ) = k \} \Longrightarrow Y \subset E\) \(\blacktriangleleft\) \(\mathbb{W}.\)Hd …
\(Y \subset E \Longrightarrow ( E \mathop\setminus Y ) \cup Y = E , ( E \mathop\setminus Y ) \cap Y = \emptyset\) \(\blacktriangleleft\) \(\mathbb{W}.\)8.7 Inclusion–exclusion principle
The \(n\) sets \(A_1, \ldots, A_n\) are given by \(\langle i, x \rangle \in A\) (\(x \in A_i\)), and \(U = A_1 \cup \cdots \cup A_n\) has \(u\) elements. \(T\) is the collection of all pairs \((I, x)\) (\(I \subset \{1, \ldots, n\}\), \(x \in U\), and if \(i \in I\) then \(x \in A_i\); \(I = \emptyset\) is included). \(E\) is the collection of pairs with \(|I|\) even, \(E_+\) with \(|I|\) positive even, and \(O\) with \(|I|\) odd.
Then \(u + |E_+| = |O|\) (there are as many pairs with 0 indices as elements of \(U\)). Writing \(|E_+| = \sum_{k \text{ positive even}} e(k)\) and \(|O| = \sum_{k \text{ odd}} o(k)\), the inclusion–exclusion principle is \(u = |O| - |E_+|\). Both the subtraction-free form and the integer subtraction form are shown.
\(n \in \mathbb{M} , U = \{ x \mid \exists i \in 1 \mathinner{\ldotp\ldotp} n . \langle i , x \rangle \in A \} , T = \{ p \mid \exists I , x \, p = \langle I , x \rangle , I \subset 1 \mathinner{\ldotp\ldotp} n , x \in U , \forall i \in I . \langle i , x \rangle \in A \} , \operatorname{\#} U = u , u \in \mathbb{M} , E = \{ p \in T \mid \exists k \in \mathbb{M} . k \in 2 \cdot \mathbb{M} , \operatorname{\#} ( \triangleleft p ) = k \} , Y = \{ p \in T \mid \exists k \in \mathbb{M} . k \in 2 \cdot \mathbb{M} , k \neq 0 , \operatorname{\#} ( \triangleleft p ) = k \} , O = \{ p \in T \mid \exists k \in \mathbb{M} . k \in 2 \cdot \mathbb{M} + 1 , \operatorname{\#} ( \triangleleft p ) = k \} \Longrightarrow u + \operatorname{\#} Y = \operatorname{\#} O , u = \operatorname{\#} O - \operatorname{\#} Y\) \(\blacktriangleleft\) Tfin ,K1 ,Hz ,Hc ,Hs ,Hd ,BIJ ,L∪# ,L⊂# ,L#= ,ax_s ,↑s𝕄 ,↑0X ,⋅𝕄:D ,⋅0X ,\(\mathbb{W}.\) ,Axℤ