Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Use Inclusion-Exclusion for Three Sets

With three overlapping sets, one correction is not enough. Add the three sizes, subtract the three pairwise overlaps, and add back the items in all three, which the subtraction removed completely.

Recognize the task

Three properties overlap and the question asks for "at least one", "A or B or C", or "none of them": numbers divisible by 22, 33 or 55; students taking math, physics or chemistry; job assignments that leave no worker idle. Test: you know, or can count, all three pairwise overlaps and the triple overlap.
The three-set formula is introduced in the three sets lesson.

Two ways to do it

Seven-term formulausual
∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|
Singles plus, pairs minus, triple plus (three-set formula).
Fill the Venn regionsregions
center→pairs only→singles only\text{center} \to \text{pairs only} \to \text{singles only}
Write the triple overlap in the middle, subtract it from each pair, then fill the single regions, and add all seven regions.

Steps

StepOn the integers 1 to 60 divisible by 2, 3 or 5
1Add the three single sets. Multiples of 22, 33 and 55.30+20+12=6230 + 20 + 12 = 62
2Subtract the three pairs. Multiples of 66, 1010 and 1515.62−(10+6+4)=4262 - (10 + 6 + 4) = 42
3Add back the triple overlap. Multiples of 3030 were added three times and subtracted three times, so they are missing.42+2=4442 + 2 = 44
4Subtract from the total if the question says none. The items in none of the sets are the total minus the union.none of them: 60−44=1660 - 44 = 16

Worked examples

Example 1 · a three-subject survey

none
5050 students: math 2828, physics 2323, chemistry 1818
single sets
pairs 1212, 99, 77; all three 44
overlaps
69−28+4=4569 - 28 + 4 = 45 take at least one
seven-term formula
50−45=550 - 45 = 5 take none
subtract from the total

Example 2 · divisibility up to 1000

numbers
multiples of 33, 55, 77: 333+200+142=675333 + 200 + 142 = 675
single sets
of 1515, 2121, 3535: 66+47+28=14166 + 47 + 28 = 141; of 105105: 99
pairs and triple
675−141+9=543675 - 141 + 9 = 543

Example 3 · every worker gets a job

surjections
55 jobs to 33 workers: 35=2433^5 = 243 ways
each job picks a worker
some worker idle: 3⋅25−3⋅15+0=933 \cdot 2^5 - 3 \cdot 1^5 + 0 = 93
inclusion-exclusion on idle workers
243−93=150243 - 93 = 150
subtract from the total
The rule for any number of sets is in the general formula lesson.

See it happen

Three overlapping circles cut the plane into seven regions. Adding the three circles counts each pair-only region twice and the center three times. Subtracting the three pairs fixes the pair-only regions but removes the center completely, three minus three. Adding the triple overlap once puts the center back, so every region is counted exactly once. Try it in the three-set Venn diagram tool.

Common mistakes

Forgetting the triple overlap

✗ 30+20+12−10−6−4=4230 + 20 + 12 - 10 - 6 - 4 = 42
✓ add back the 22 multiples of 3030: 4444

Using region counts as overlaps

✗ ∣M∩P∣=8|M \cap P| = 8 (math and physics only)
✓ ∣M∩P∣=12|M \cap P| = 12 includes the 44 who take all three

Subtracting the triple term

✗ 62−20−2=4062 - 20 - 2 = 40
✓ singles plus, pairs minus, triple plus: 62−20+2=4462 - 20 + 2 = 44