Inclusion-Exclusion
Overlapping sets, Venn diagrams, PIE counting
What you need to know
- Two groups. (number in or ) (number in ) (number in ) (number in both). Things in both were counted twice, so subtract them once. Example: from to there are multiples of , of , and of both (the multiples of ). So are multiples of or .
- Three groups. Add the three groups, subtract the three overlaps of two groups, then add back the overlap of all three. Writing for "the number in": . Example: from to , the multiples of , , or number .
- Any number of groups. This is the Principle of Inclusion-Exclusion (PIE): add the single groups, subtract the overlaps of two, add the overlaps of three, and so on, switching signs each time.
- Counting "none." The number in none of the groups is the total minus the number in at least one. Example: numbers from to are divisible by none of , , .
- Counting multiples. From to there are multiples of , where means "round down." A number is a multiple of both and exactly when it is a multiple of . Example: from to there are multiples of .
- Filling in a Venn diagram. Start with the innermost region and work outward. Example: in a class of , take math, take science, and take both. Put in the middle, in "math only," in "science only," and outside.
How AMC 10 tests it
- Problems 5–12: survey problems (" take math, take science, take both") asking how many take neither, or how many are in exactly one group.
- Problems 10–18: whole numbers up to divisible by at least one of several numbers, or by none.
- Problems 15–22: PIE hidden inside arrangements ("every color is used," "at least one letter in its original spot").
- Sometimes an "exactly two" region, where the "or" formula is not enough and you must fill in the diagram.
Standard approaches
- Draw the Venn diagram and fill it in from the center out; many problems need no formula.
- For "at least one," find the "or" count. For "none," subtract it from the total.
- For divisibility, each term is .
- For "every box gets used," count all ways, then subtract the ways that miss a box. With different objects and different boxes: . Example: different balls in boxes, none empty: .
- Check that every region is a whole number that is zero or positive. A negative region means you misread something.
Worked example
How many positive integers at most are divisible by or but not by ?
(A) (B) (C) (D) (E)
Solution.
Step 1: divisible by or . There are multiples of and multiples of . Both means a multiple of : . By PIE, .
Step 2: which of these are divisible by ? Divisible by and means a multiple of . Divisible by and means a multiple of . Every multiple of is a multiple of , so count the multiples of : (since ).
Step 3: subtract. .
The answer is .
Pitfalls
- Subtracting the overlaps of two groups but forgetting to add back the overlap of all three.
- Reading " take both" as the "exactly these two" region when it also includes people in the third group, or the other way around.
- Using instead of when and share a factor. From to , numbers are multiples of both and , not .
- Giving the "at least one" count when the question asks for "none," or the other way around.
Traps that recur
- Adding the five box probabilities (5 · 1/25) without subtracting overlaps, or dropping the alternating signs in inclusion–exclusion. (2021 AMC 10B #22)
- Forgetting to add back the single arrangement with both red and blue empty (all candy in white), which gives 1931. (2010 AMC 10B #22)
- Subtracting all 400 multiples of 5 instead of only the multiples of 5 that are also multiples of 3 or 4. (2001 AMC 10 #25)
- Applying |A union B union C| = sum of singles minus pairs plus triple with the wrong meaning of the 9, which counts students in at least two classes, not pairwise overlaps. (2017 AMC 10B #13)
- 1.2005 AMC 10B #13
How many numbers between and are integer multiples of or but not ?
- A)
- B)
- C)
- D)
- E)
- 2.2017 AMC 10B #13
There are students participating in an after-school program offering classes in yoga, bridge, and painting. Each student must take at least one of these three classes, but may take two or all three. There are students taking yoga, taking bridge, and taking painting. There are students taking at least two classes. How many students are taking all three classes?
- A)
- B)
- C)
- D)
- E)
- 3.2013 AMC 10A #17
Daphne is visited periodically by her three best friends: Alice, Beatrix, and Claire. Alice visits every third day, Beatrix visits every fourth day, and Claire visits every fifth day. All three friends visited Daphne yesterday. How many days of the next 365-day period will exactly two friends visit her?
- A)
- B)
- C)
- D)
- E)
- 4.2021 AMC 10B #22
Ang, Ben, and Jasmin each have blocks, colored red, blue, yellow, white, and green; and there are empty boxes. Each of the people randomly and independently of the other two people places one of their blocks into each box. The probability that at least one box receives blocks all of the same color is , where and are relatively prime positive integers. What is
- A)
- B)
- C)
- D)
- E)
- 5.2010 AMC 10B #22
Seven distinct pieces of candy are to be distributed among three bags. The red bag and the blue bag must each receive at least one piece of candy; the white bag may remain empty. How many arrangements are possible?
- A)
- B)
- C)
- D)
- E)
- 6.2001 AMC 10 #25
How many positive integers not exceeding are multiples of or but not ?
- A)
- B)
- C)
- D)
- E)
Answers
| # | Answer | The idea it turns on |
|---|---|---|
| 1 | C | Multiples of 12 appear in both the list of multiples of 3 and the list of multiples of 4. To remove them completely, subtract their count twice. |
| 2 | C | Sort students by how many classes they take. 20 students in all, 9 take two or more, so 11 take one; the class lists add to 32 sign-ups. |
| 3 | B | Two friends meet on multiples of 12, 15 or 20. All three meet on multiples of 60, and those days must be taken out of each pair's count. |
| 4 | D | Ang's order can be taken as fixed. A box is all one color when Ben and Jasmin both match Ang there. Count with add, subtract, add: 2556 of 14400. |
| 5 | C | Each candy picks one of 3 bags: 3^7 ways. Subtract the ways with red empty and with blue empty, then add back the one way with both empty. |
| 6 | B | Count multiples of 3 or 4 first. Then remove only those that are also multiples of 5, which are the multiples of 15 or 20. |
Problems © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. The topic note, tags and key insights are original to this site.