Math Core

Module 2.7 · Counting and Probability

Venn diagrams and overlapping sets

When two groups overlap, adding their sizes counts the overlap twice. Venn diagrams make the overlap visible, and the inclusion-exclusion formula fixes the double count. Survey problems ("how many students play both?") and "divisible by 33 or 55" problems both live here.

Two sets

Picture two overlapping circles, one for each group. The lens in the middle is the set of things in both groups.

Two overlapping sets A (left) and B (right) inside a rectangle for everyone. The middle lens is A and B. Outside both circles is neither.

If you add ∣A∣|A| and ∣B∣|B|, everyone in the lens is counted twice. Subtract it once.

Inclusion-exclusion for two sets

∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|

and

neither=total−∣A∪B∣.\text{neither} = \text{total} - |A \cup B|.

Here ∣A∪B∣|A \cup B| is the number in AA or BB (or both) and ∣A∩B∣|A \cap B| is the number in both.

Worked example: A survey

In a class of 3030 students, 1818 play soccer, 1515 play basketball and 55 play neither. How many play both?

The number who play at least one sport is 30−5=2530 - 5 = 25. So 25=18+15−both25 = 18 + 15 - \text{both}, which gives both =33−25=8= 33 - 25 = 8.

To draw the Venn diagram, fill in from the middle out: 88 in the lens, 18−8=1018 - 8 = 10 soccer only, 15−8=715 - 8 = 7 basketball only, and 55 outside. Check: 8+10+7+5=308 + 10 + 7 + 5 = 30.

Worked example: Divisible by 2 or 3

How many integers from 11 to 100100 are divisible by 22 or 33?

Divisible by 22: 5050. Divisible by 33: 3333. Divisible by both means divisible by 66: 1616. So 50+33−16=6750 + 33 - 16 = 67.

Three sets

For three overlapping sets, the formula adds the singles, subtracts the pairs, and adds back the triple:

∣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|.

The last term is there because the center region is added 33 times, then subtracted 33 times, so it needs to be added back once.

In practice, it is often easier to fill in a three-circle Venn diagram from the center outward, especially when the question asks about "exactly one" or "only" regions.

Worked example: Three languages

Of 4040 students, 2020 take French, 1818 take Spanish and 1515 take Latin. Also 77 take French and Spanish, 55 take French and Latin, 66 take Spanish and Latin, and 22 take all three. How many take none of these languages? How many take only French?

Union: 20+18+15−7−5−6+2=3720 + 18 + 15 - 7 - 5 - 6 + 2 = 37. So 40−37=340 - 37 = 3 take none.

For only French, work from the center. The center has 22. French and Spanish only: 7−2=57 - 2 = 5. French and Latin only: 5−2=35 - 2 = 3. So only French is 20−5−3−2=1020 - 5 - 3 - 2 = 10.

Common mistake

"Both" numbers usually include people in all three groups. If 77 take French and Spanish, and 22 take all three, then only 55 are in the French-and-Spanish-but-not-Latin region. Subtract the center before filling in pair regions.

Tip

For the smallest possible overlap of two groups, push them apart: the overlap is at least ∣A∣+∣B∣−total|A| + |B| - \text{total} (or 00 if that's negative). The largest possible overlap is the size of the smaller group.

Practice

Practice 1

In a class of 2525 students, 1414 have a dog, 1212 have a cat and 44 have both. How many have neither a dog nor a cat?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

How many integers from 11 to 6060 are divisible by 44 or by 66?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

How many integers from 11 to 100100 are divisible by neither 22 nor 55?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

In a class of 3232 students, 2020 play an instrument, 1515 sing in the choir, and 66 do neither. How many students both play an instrument and sing in the choir?

Practice 5

In a group of 100100 people, 7070 like coffee and 6060 like tea. What is the smallest possible number of people who like both?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

In a class, 2424 students like at least one of pizza and tacos. Twice as many students like pizza as like tacos, and 66 like both. How many like pizza but not tacos?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 7

A survey of 6060 students found that 3030 like math, 2525 like science and 2020 like art. Also 1010 like math and science, 88 like math and art, 77 like science and art, and 33 like all three. How many students like exactly one of the three subjects?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 8

How many integers from 11 to 10001000 are divisible by at least one of 33, 55 and 77?

Real contest practice