Sub topic 2
Set Theory and Venn Diagrams: The Two-Set Formula
This chapter assumes you can read set notation, know what union, intersection, and complement mean, and solve simple linear equations.
The two-set formula
For sets A and B inside a universe, the number of elements in at least one of them is:
n(A∪B) = n(A) + n(B) − n(A∩B)
You subtract n(A∩B) because elements in both sets would otherwise be counted twice.
n_a = 60 # students who study Maths
n_b = 50 # students who study Physics
n_both = 25 # students who study both
n_union = n_a + n_b - n_both
print(n_union) # 85Counting "neither" with the complement
Elements outside both sets form the complement of the union. If the universe has N elements:
n(neither) = N − n(A∪B)
Word problems often ask for "neither" directly. Find the union first, then subtract it from the total.
Turning word problems into set statements
Map each phrase to a set expression before calculating.
| Phrase in the problem | Set statement |
|---|---|
| at least one subject | n(A∪B) |
| both subjects | n(A∩B) |
| only Maths | n(A) − n(A∩B) |
| neither subject | N − n(A∪B) |
Three-set Venn diagrams and the eight regions
Three sets A, B, and C split the universe into eight regions: neither, only A, only B, only C, A and B only, B and C only, A and C only, and all three. The three-set formula is:
n(A∪B∪C) = n(A) + n(B) + n(C) − n(A∩B) − n(B∩C) − n(A∩C) + n(A∩B∩C)
Exercise
Exercise
In a group of 100 students, 70 study Maths, 55 study Physics, and 30 study both. How many study neither subject?
Show answer
Union = 70 + 55 − 30 = 95. Neither = 100 − 95 = 5.