Counting the Union of Two Sets
The size of a union is the sum of member counts minus the overlap because shared members appeared twice in that sum.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Work a small overlap
If 12 people attend a morning session and nine attend an afternoon session, with four in both, there are \(12+9-4=17\) distinct attendees. This depends on set equality and membership using stable identities.
Check a limiting case
If every afternoon participant also attended in the morning, the overlap is nine and the distinct total stays twelve. This is a subset constraint supplying an immediate check on the count.[1]
Subtract the overlap once because it was counted twice
A class has eleven students enrolled in a coding lab and eight in a discrete math lab. Three attend both. The sum of nineteen counts each overlapping student twice. Subtracting three gives sixteen distinct students across the two labs. See set union and intersection.
Only coding: 11 - 3 = 8
Only discrete math: 8 - 3 = 5
Both: 3
Union: 8 + 5 + 3 = 16
Use the formula as a consistency check
The overlap cannot exceed the smaller group. The union cannot exceed a known overall class size. Try data with one group contained in the other and data with no overlap to confirm both extremes.