Section 3.2 Principle of Inclusion-Exclusion
Objectives
- State the Principle of Inclusion-Exclusion and apply it to problems to compute set cardinalities (for combinations of two to four sets).
- Sketch Venn Diagrams that correspond to a given scenario or problem.
Example 3.2.1. Not Divisible by 3.
How many integers in \(U = \{1,2,\ldots,25\}\) are not divisible by 3?
Solution We first count the number of integers in the set that are divisible by 3: there are
of them.
Note that the notation \(\lfloor n \rfloor\) denotes the floor function, which returns the largest integer that is less than or equal to \(n\text{.}\)
Subtracting, we get \(25 - 8 = 17\) integers in the set \(U\) that are not divisible by 3. (Check that this is the correct number!)
Example 3.2.2. Not Divisible by 3 or 4.
How many numbers in \(U = \{1,2,\ldots,25\}\) are not divisible by 3 or 4?
Following the previous example, there are \(8\) integers in \(U\) that are divisible by 3. Also, there are \(\lfloor \frac{25}{4} \rfloor = 6\) integers in \(U\) divisible by 4.
However, after subtracting \(25 - 8 - 6 = 11\text{,}\) we've actually removed some numbers twice: those numbers that are divisible by both 3 and 4 (i.e. divisible by 12). This means we need to βadd them back inβ again.
There are \(\lfloor \frac{25}{12} \rfloor = 2\) of these numbers, so the correct total is
integers in the set that are neither divisible by 3 nor by 4.
integers in divisible by 3 integers in divisible by 4 integers in divisible by either 3 or 4- Desired set:
integers in divisible by neither 3 nor 4.
Remark 3.2.3.
Do not confuse the operations
Checkpoint 3.2.4. Not Divisible by 7 or 11.
How many integers in \(\{1,2,3,\ldots,2020\}\) are not divisible by 7 or 11?
\(1575\text{.}\)
Checkpoint 3.2.5. Not Divisible by 3, 7, or 11.
How many integers in \(\{1,2,\ldots,2020\}\) are not divisible by 3, 7, or 11?
\(1051\text{.}\)
Theorem 3.2.6. Principle of Inclusion-Exclusion.
Given a universe
Proof.
Suppose that the element \(x\) is in none of the \(A_i\)'s. Then it is counted exactly once in the sum, in the first term \(|U|\text{.}\)
Now suppose that the element \(y\) is in some collection of \(A_i\)'s. Let \(T = \{i : y \in A_i\}\) be the set of indices of sets that contain \(y\text{.}\) (For example, if \(y\) is in \(A_1\text{,}\) \(A_3\text{,}\) and \(A_4\text{,}\) then \(T = \{1,3,4\}\text{.}\)) Then for each subset \(S\) of \(T\text{,}\) there is a corresponding term in the formula above.
Note that the formula contributes a \(+1\) for intersections of even numbers of sets (or for \(|S|\) even); and a \(-1\) for intersections of odd numbers of sets (for \(|S|\) odd). Hence the total contribution for the element \(y\) is
Applying Theorem 2.3.5, we see that this is equal to
which is what we needed to prove.
Checkpoint 3.2.7. PIE for Four Sets.
Given a universe \(U\) and four sets \(A_1, A_2, A_3, A_4\) in \(U\text{,}\) write out the complete formula for \(|(A_1 \cup A_2 \cup A_3 \cup A_4)^c|\text{.}\)
Example 3.2.8. Word Rearragements.
Count the number of arrangements of the letters in the word
EQUATION
such that
- vowels are not in alphabetical order when read left-to-right; and
- consontants are not in alphabetical order when read left-to-right.
Let \(A_1\) be the set of arrangements where vowels are in alphabetical order, and \(A_2\) the set of arrangements where consonants are in alphabetical order. Then the desired number is \(|(A_1 \cup A_2)^c| = |U| - |A_1| - |A_2| + |A_1 \cap A_2|\text{,}\) by Theorem 3.2.6.
We compute each quantity:
- \(|U| = 8!\text{,}\) the number of permutations of the letters.
- \(|A_1| = 3! \cdot \binom{8}{3}\) (permute the consonants first, then insert among vowels using the Balls in Bins Formula)
- \(|A_2| = 5! \cdot \binom{8}{5}\) (permute the vowels first, then insert among consontants)
- \(|A_1 \cap A_2| = \binom{8}{5}\) (vowels and consonants are in a fixed order; just pick 5 slots for vowels to be in and the rest follows)
Hence \(|(A_1 \cup A_2)^c| = |U| - |A_1| - |A_2| + |A_1 \cap A_2| = 8! - 3!\binom{8}{3} - 5!\binom{8}{5} + \binom{8}{5}\text{,}\) or 33320.
Checkpoint 3.2.9. Relatively Prime Numbers.
Use Theorem 3.2.6 to determine how many natural numbers less than 120 are relatively prime with 120.
Consider prime factors of 120.
Exploration 3.2.1. Euler's Totient Function.
Given
(This is known as Euler's totient function.)
(a)
Define
(b)
For any set
(c)
Express
Checkpoint 3.2.10. Compute and .
Use the formula in Exploration 3.2.1 to compute \(\phi(100)\) and \(\phi(135)\text{.}\)
Checkpoint 3.2.11. One Card of Each Suit.
Use Theorem 3.2.6 to determine how many five-card hands can be drawn from a standard deck of cards such that there is at least one card of each suit.
Checkpoint 3.2.12. Nonnegative Integer Solutions.
Use Theorem 3.2.6 to determine how many nonnegative integer solutions there are to \(x_1 + x_2 + x_3 = 10\text{,}\) \(x_1 \leq 3\text{,}\) \(x_2 \leq 4\text{,}\) \(x_3 \leq 8\text{.}\)
Define \(A_1\) to be the set of solutions such that \(x_1 \gt 3\text{,}\) etc.