Sets
A set is a well-defined collection of distinct objects, considered as a single whole. Sets are the foundational language of modern mathematics: nearly every mathematical object — numbers, functions, relations, spaces — is defined in terms of sets. Developed rigorously by Georg Cantor in the 1870s–1880s, set theory underlies all of contemporary mathematics, computer science, logic, and probability.
A set is a collection of distinct objects, called its elements or members, in which order and repetition are irrelevant — only membership matters. Two sets are equal exactly when they contain the same elements. Sets matter because they provide a single, unified language in which all of mathematics can be expressed: integers, geometric points, and even functions are ultimately built from sets. A surprising fact is that there are different sizes of infinity — the set of real numbers is provably "larger" than the set of natural numbers, even though both are infinite, a discovery that shocked mathematicians and remains a cornerstone of the subject.
The Core Insight
A set is determined entirely by what belongs to it — nothing else. There is no notion of "first element," no concept of an element appearing "twice," and no internal structure beyond membership. This radical simplicity is exactly what makes sets powerful: from the single relation " belongs to " we can build the entire edifice of mathematics.
Formal Statement
Set and Membership
A set is a collection of distinct objects. If an object is a member of a set , we write
If is not a member, we write . A set may be specified by listing (roster notation), as in , or by a defining property (set-builder notation):
Set Equality — The Axiom of Extensionality
Two sets and are equal if and only if they have exactly the same elements:
A consequence: , since repetition and order do not affect membership.
Subset and Power Set
is a subset of , written , if every element of is also an element of :The power set is the set of all subsets of . For a finite set with elements,
Core Operations
For sets and within a universe :
De Morgan's Laws for Sets
For any sets in a universe :
Why It Holds / Derivation
De Morgan's First Law, Equation 10
We show using the Axiom of Extensionality — i.e. by proving both sets have the same elements.
Step 1. Take any . By definition of complement, . Step 2. By definition of union, means it is not the case that ( or ). Step 3. By the logical equivalence , this means and . Step 4. Therefore and , so . This shows . Step 5. Every step above is an if and only if, so reading them in reverse gives . Step 6. Mutual inclusion plus Extensionality (Equation 3) gives equality.Power Set Size, Equation 5
Step 1. Let . A subset is fully determined by deciding, for each element , whether . Step 2. Each of these decisions has exactly 2 outcomes (in or out), and they are made independently. Step 3. By the multiplication principle of counting, the total number of distinct subsets isGeorg Cantor | 1845–1918
Georg Cantor, a German mathematician, single-handedly created set theory in a series of papers beginning in 1874. His most revolutionary contribution was the rigorous treatment of infinite sets and the discovery, via his famous diagonal argument, that infinities come in different sizes — the real numbers cannot be put in one-to-one correspondence with the natural numbers. His ideas were fiercely resisted by contemporaries such as Leopold Kronecker, who called them "humbug." Cantor suffered from depression, partly aggravated by this hostility, yet his work was ultimately embraced; David Hilbert declared, "No one shall expel us from the paradise that Cantor has created."
Building Intuition
Think of a set as a bag with a strict doorman. The doorman only ever answers one question: "Is this thing inside?" — yes or no. He does not care which item arrived first (no order), and he never lets the same item enter twice (no duplicates). Two bags are "the same bag" precisely when the doorman would give identical answers for every possible item.
Venn diagrams make operations concrete: overlapping circles represent two sets, the overlap is , the whole shaded region is , and the region outside both circles (inside the rectangle) is . The empty set is the bag the doorman always says "no" to — and there is only one such bag, which is why we say "the" empty set.
Venn diagram of two sets within a universe $U$, showing union, intersection, and complement regions
Worked Examples
Power Set and Operations
Given: and , with universe . Step 1 — Union (Eq. 6): combine all members:Verifying De Morgan's Law Numerically
Given: , , . Verify Equation 11: . Step 1 — Left side. , soCommon Misconceptions
An element is not the same as the singleton set containing it. The number and the set are different objects: , but . Likewise, (the empty set, containing nothing) differs from (a set containing one element, namely the empty set) — so but . Do not confuse with . "" is true (subset), but "" is false, since the element is not one of the members or .Order and Repetition Do Not Create New Sets
One might think , , and are three different sets. By the Axiom of Extensionality (Equation 3), they are all the same set, because every is a member of one iff it is a member of the others. If you need order to matter, you need an ordered tuple , not a set; if you need repetition to matter, you need a multiset — neither of which is a set.
Naïve Comprehension Fails — Russell's Paradox
It is tempting to believe any property defines a set. Consider , "the set of all sets that are not members of themselves." Ask: is ? If , then by its own definition — contradiction. If , then satisfies the defining property, so — contradiction. No such set can exist. This is Russell's Paradox, and it shows unrestricted set-building is logically inconsistent, motivating the careful axioms of modern set theory.
Connections
Sets are the connective tissue of mathematics. A Function is formally a special set of ordered pairs (a relation with at most one output per input). The number systems — the Natural Numbers, integers, rationals, and Real Numbers — are all constructed as sets. Logic mirrors set operations exactly: "and"/"or"/"not" correspond to intersection/union/complement, which is why De Morgan's Laws appear in both. Probability defines events as subsets of a sample space, so and inherit the set algebra directly. Cardinality generalizes "counting" to compare sizes of infinite sets.
Real-World Applications
- Relational databases (SQL): Queries are literally set operations —
UNION,INTERSECT,EXCEPTcorrespond to , , on tables of rows. - Search engines & information retrieval: A keyword search returns the intersection of document sets; Boolean search ("cats AND NOT dogs") is set algebra.
- Digital logic & circuit design: Bitmasks and boolean gates implement set membership; an -bit integer encodes a subset of an -element universe, mirroring Equation 5.
- Probability & statistics: Risk, insurance, and machine-learning models treat events as sets and use the inclusion–exclusion principle.
- Type systems in programming: Languages like Python, Java, and Rust provide native
setdata structures with , , and difference for deduplication and fast membership tests. - Cryptography & error-correcting codes: Finite fields and codes are built on carefully structured sets and their subsets.
- Genetics & bioinformatics: Gene-set enrichment analysis intersects sets of genes to find shared biological functions.
Historical Development
- c. 350 BCE — Aristotle studies syllogistic logic, an informal precursor to class/membership reasoning.
- 1847 — George Boole publishes The Mathematical Analysis of Logic, algebraizing logical classes (Boolean algebra).
- 1874 — Georg Cantor's paper on countability launches set theory; he proves the algebraic numbers are countable but the reals are not.
- 1881–1883 — John Venn introduces the diagrams that bear his name for visualizing set relations.
- 1891 — Cantor publishes the diagonal argument, cleanly proving .
- 1901 — Bertrand Russell discovers Russell's Paradox, exposing the inconsistency of naïve set theory.
- 1908 — Ernst Zermelo proposes the first axiom system to avoid paradoxes; refined with Abraham Fraenkel into ZFC (1922).
- 1931 — Kurt Gödel's Incompleteness Theorems show no consistent axiom system (including ZFC) can prove all true statements about sets.
- 1963 — Paul Cohen proves the Continuum Hypothesis is independent of ZFC, completing work begun by Gödel (1940).
Subtleties & Limits
The Continuum Hypothesis (CH) asks whether there exists a set whose size is strictly between that of the natural numbers and that of the real numbers . Cantor conjectured "no," but the question turned out to be undecidable: Gödel (1940) showed CH cannot be disproved from the standard ZFC axioms, and Cohen (1963) showed it cannot be proved either. CH is therefore independent of ZFC — both it and its negation can be consistently added. This raises a profound philosophical puzzle: are there genuine mathematical truths beyond what any axiom system can capture, and how do we choose which set-theoretic universe to inhabit? Active research in large cardinals and forcing continues to probe these foundations.