Discrete Mathematics / Further counting, graphs and algorithms
Inclusion–Exclusion
Count a union by adding, subtracting the overlaps, adding back the triple overlaps, and so on.
Contents 2 sections
By the end you can
- Apply inclusion–exclusion to two and three sets
- Count derangements
- Count integers coprime to a number
Helps to know: Sets, Relations and Functions, Counting: Permutations and Combinations
§1The principle
Example 1Integers from 1 to 100 divisible by 2, 3 or 5
- Singles: .
Check yourself
- Q1How many integers from 1 to 30 are divisible by 2 or 3?