Lesson 9 +30 XP

Inclusion–Exclusion & the Pigeonhole Principle

1. Principle of Inclusion-Exclusion

For two sets: n(A ∪ B) = n(A) + n(B) − n(A ∩ B).

For three sets:

n(A ∪ B ∪ C) = ∑ n(A) - ∑ n(A ∩ B) + n(A ∩ B ∩ C)

In general, add singles, subtract pairs, add triples, … alternately.

Three-set Venn diagram showing the inclusion-exclusion regionsThree-set Venn diagram showing the inclusion-exclusion regions

Counting multiples

The number of integers in 1..N divisible by d is ⌊N/d⌋.

Solved 1. Integers in 1..50 divisible by 2 or 3: 25 + 16 − 8 = 33. "By 2 or 3 but not both": 33 − 8 = 25.

Solved 2. Integers ≤ 1000 divisible by 7 or 11: ⌊1000/7⌋ + ⌊1000/11⌋ − ⌊1000/77⌋ = 142 + 90 − 12 = 220. Divisible by 7 but not 11: 142 − 12 = 130. By exactly one: 220 − 12 = 208.

Solved 3. Integers in 1..500 divisible by 3, 5 or 7: 166 + 100 + 71 − 33 − 23 − 14 + 4 = 271.

Survey problems

Solved 4. 50 students: 24 like cold drinks, 36 like hot drinks, each likes at least one. Both: 24 + 36 − 50 = 10.

Solved 5 (newspapers). Of 10,000 families: A 40%, B 20%, C 10%, A∩B 5%, B∩C 3%, A∩C 4%, all three 2%.

  • At least one: 40 + 20 + 10 − 5 − 3 − 4 + 2 = 60%; none: 40%
  • Only A: 40 − 5 − 4 + 2 = 33%; only B: 20 − 5 − 3 + 2 = 14%; only C: 10 − 3 − 4 + 2 = 5% → exactly one = 52%
  • Exactly two: (5 − 2) + (3 − 2) + (4 − 2) = 6%; at least two: 6 + 2 = 8%

Solved 6 (consistency check). A report says that of professors 60% play tennis, 50% bridge, 70% jog, 20% tennis & bridge, 30% tennis & jog, 40% bridge & jog, and 20% all three. Check: 100 ≥ 60 + 50 + 70 − 20 − 30 − 40 + x gives x ≤ 10. So at most 10% can do all three-the 20% claim is impossible.

Application: onto functions

Number of onto functions from an m-set to an n-set:

∑k=0n (-1)k C(n, k) (n-k)m
From a 4-set to a 3-set: 3⁴ − 3·2⁴ + 3·1⁴ = 81 − 48 + 3 = 36.

Derangements (no object in its own place): Dₙ = n![1 − 1/1! + 1/2! − … + (−1)ⁿ/n!]; D₄ = 9.

2. The Pigeonhole Principle

If k + 1 or more objects are placed into k boxes, at least one box contains two or more objects.

Generalised: if N objects go into k boxes, some box has at least ⌈N/k⌉ objects.

Pigeonhole principle: 5 pigeons, 4 holesPigeonhole principle: 5 pigeons, 4 holes

ProblemBoxesAnswer
Among 367 people, two share a birthday366 days367 > 366 ✓
Among 27 English words, two start with the same letter26 letters✓
Exam scored 0-100: students needed to guarantee two equal scores101 scores102
Among 100 people, how many share a birth month at least?12 months⌈100/12⌉ = 9
Cards drawn to guarantee 3 of the same suit4 suits2·4 + 1 = 9
Cards to guarantee 3 heartsworst case all 39 non-hearts first39 + 3 = 42
Students so that 4 get the same grade (A-F, 5 grades)53·5 + 1 = 16
People so that 3 are born in the same month122·12 + 1 = 25
Marbles (10 red, 10 white, 10 blue) to get 4 of one colour33·3 + 1 = 10
💡 Tip

To guarantee r objects in one of k boxes you need k(r − 1) + 1 objects-fill every box with r − 1 first, then one more forces r.

Solved (proof style). Among any 5 points inside a square of side 2, two are at distance ≤ √2. Divide the square into 4 unit squares (boxes). 5 points → some unit square holds 2 points; the farthest two points of a unit square are its diagonal, √2 apart. ∎

🎯 END-TERM EXAM PREP

📝 IPU End-Term Exam Corner (5-10 Marks)

  • Q1. State the principle of inclusion-exclusion. How many integers between 1 and 500 are divisible by 3, 5 or 7? (5 Marks) → 271.
  • Q2. In a survey of 10,000 families (newspaper data above) find the percentage reading exactly one paper. (5 Marks) → 52%.
  • Q3. State the generalised pigeonhole principle. How many cards must be drawn to guarantee 3 cards of the same suit? (5 Marks) → 9.
  • Q4. Find the number of onto functions from a 4-element set to a 3-element set. (5 Marks) → 36.