The Foundation of Everything Discrete
A set is an unordered collection of distinct objects, its elements. We write for " is in " and for " is not in ." Sets are the bedrock of discrete mathematics — numbers, relations, functions, and even logic are all defined in terms of sets. Two features matter: a set has no order () and no duplicates (listing an element twice changes nothing).
Key relationships and special sets:
- is a subset of (written ) if every element of is also in .
- The empty set has no elements and is a subset of every set.
- The cardinality is the number of elements in .
The operations combine sets into new sets:
- Union — elements in or (or both).
- Intersection — elements in both and .
- Difference — elements in but not in .
- Complement — everything (in the universe) not in .
These mirror boolean logic exactly: union is OR, intersection is AND, complement is NOT. So De Morgan's laws hold for sets too: and . A crucial counting rule is inclusion-exclusion: — you add the sizes and subtract the overlap counted twice.
Common pitfall: confusing union with intersection, or forgetting the overlap in inclusion-exclusion. Union collects everything in either set; intersection keeps only what is in both. And is not simply — that double-counts the shared elements, so you must subtract .
Two overlapping set circles A and B; the lens overlap flashes in accent as it is subtracted once, illustrating |A ∪ B| = |A| + |B| − |A ∩ B|.