All concepts

7. Overlapping sets

Two-set formula Total = A + B - Both + Neither, or the 2x2 matrix. Watch divisibility twists.

BothFrench onlySpanish onlyNeitherSpanish yesSpanish noFrench yesFrench noRows and columns each sum to their totals. Both is counted once here, not twice.

Core ideas

- Two-set formula: Total = A + B - Both + Neither; adding A and B double-counts the overlap once.
- When items split on TWO yes/no traits, draw a 2x2 matrix; rows and columns must sum to their totals.
- Divisibility twist: multiples of a or b up to N = floor(N/a) + floor(N/b) - floor(N/lcm(a,b)).
- "Only A" means A minus Both; read set language literally before plugging in.

Worked example 1

In a class of 40 students, 25 take French, 18 take Spanish, and 6 take neither. How many take both?

Show solution

Total = F + S - Both + Neither, so 40 = 25 + 18 - Both + 6. That gives 40 = 49 - Both, so Both = 9. Sanity check: only French = 25 - 9 = 16, only Spanish = 18 - 9 = 9, and 16 + 9 + 9 + 6 = 40.

Worked example 2

How many integers from 1 to 200 are divisible by 4 or by 6?

Show solution

Multiples of 4: floor(200/4) = 50. Multiples of 6: floor(200/6) = 33. The overlap is multiples of lcm(4, 6) = 12, not 24: floor(200/12) = 16. Answer: 50 + 33 - 16 = 67. The classic trap is using 4 * 6 = 24 for the overlap; always use the lcm.

Practice set

Question 1

In a class of 40 students, 25 play soccer, 18 play basketball, and 10 play both sports. How many students play neither sport?






Question 2

How many integers from 1 to 100 inclusive are divisible by neither 4 nor 6?






Question 3

At a school of 200 students, 60 percent study French, 45 percent study Spanish, and 15 percent study neither language. How many students study both French and Spanish?






Question 4

In a club of 150 members, 90 members like jazz and 70 like rock. The number who like both genres is twice the number who like neither. How many members like both jazz and rock?