Set Theory
Set theory is the language mathematics uses to talk about collections — and it turns out that almost everything else in mathematics can be built from this one idea. When you say "the even numbers," "the solutions to an equation," or "the students who passed," you are describing a set. What makes set theory extraordinary is that this simple notion, pushed to its logical limit by Georg Cantor in the 1870s, forced mathematicians to confront the infinite head-on and discover something shocking: some infinities are genuinely bigger than others.
This page teaches you the working vocabulary of sets — membership, subsets, unions, intersections, complements — and then takes you all the way to Cantor's proof that the real numbers cannot be counted. By the end you will not just know the symbols; you will understand why they matter and how they let us reason precisely about both the finite and the infinite.
Learning Objectives
- Define a set, membership, and the difference between a set and its elements.
- Determine subsets, equality of sets, and construct power sets.
- Perform and interpret unions, intersections, complements, and set differences.
- Read and draw Venn diagrams to model relationships between sets.
- Compute the cardinality of finite sets, including with the inclusion–exclusion principle.
- Distinguish countable from uncountable infinity and follow Cantor's diagonal argument.
Quick Answer
A set is a well-defined collection of distinct objects called elements; we write to say belongs to set . Set is a subset of (written ) if every element of is also in . The union collects everything in either set, the intersection keeps only what they share, and the complement contains everything (in the universal set) not in . The cardinality is the number of elements in . For infinite sets, Cantor showed that some — like the integers and rationals — are countable (can be listed), while others — like the real numbers — are uncountable and strictly larger.
Where It Came From
For most of history, mathematicians treated infinity as a process rather than a thing. You could add 1 forever, but "the completed infinite" was considered off-limits — Aristotle called it merely "potential," and Gauss himself protested against using infinity "as something completed." The practical need that broke this taboo came from an unexpected direction: analysis.
In the 1860s and 1870s, Georg Cantor (1845–1918) was studying trigonometric series — questions about when a function's Fourier representation is unique. To pin down the answer, he needed to describe precisely the sets of points where a series could misbehave. This forced him to compare sizes of infinite collections of points, and he needed a rigorous tool to do it. His answer, published beginning in 1874, was to define the size of a set by whether its elements could be paired off one-to-one with another set — a bijection. Two sets have the same size exactly when such a pairing exists.
This innocent-looking definition detonated. Cantor proved that the rational numbers, despite being densely packed, could be paired with the counting numbers — they are the "same size" as . But the real numbers could not be, no matter how cleverly you tried. There were, provably, different magnitudes of infinity. The reaction was ferocious: Leopold Kronecker attacked Cantor's work as dangerous nonsense and blocked his career; Cantor suffered recurring depression. Yet within a generation his ideas became bedrock. David Hilbert declared, "No one shall expel us from the paradise that Cantor has created." Set theory, later given a rigorous axiomatic foundation by Zermelo and Fraenkel, is now the standard foundation on which the rest of mathematics is built.
Sets, Elements, and How We Describe Them
A set is any collection of distinct objects, considered as a single whole. The objects are its elements or members. We use capital letters for sets and write membership with :
Two features are essential. First, order does not matter: and are the same set. Second, repetition does not matter: is just — a set records only whether an element is present, not how many times.
There are two common ways to specify a set. Roster notation lists the elements: . Set-builder notation states a rule:
Read the bar as "such that." A few sets appear so often they get their own names: the empty set (no elements at all), the natural numbers , the integers , the rationals , and the reals .
Worked example. Let . We compute each element: , , , . So and . Note but .
Subsets, Equality, and Power Sets
Set is a subset of , written , when every element of is also an element of . If additionally (so has something lacks), we call a proper subset and write . Two sets are equal precisely when each is a subset of the other: means and . This "prove it both ways" strategy is how set equalities are actually established in higher mathematics.
A subtle but important fact: the empty set is a subset of every set, and every set is a subset of itself. Why is always true? Because the statement "every element of is in " cannot be violated — there is no element to serve as a counterexample.
The power set is the set of all subsets of . If has elements, then has exactly elements, because building a subset means making an independent yes/no choice for each of the elements.
Worked example. Let , so and we expect subsets:
Counting confirms 8 subsets. Notice both and itself appear — a common thing to forget.
Operations: Union, Intersection, Complement, Difference
Most of set theory's power comes from combining sets. Fix a universal set containing everything under discussion.
- Union — everything in at least one set (the "or" is inclusive).
- Intersection — only the shared elements.
- Complement — everything outside .
- Difference — in but not .
Two sets with no elements in common () are called disjoint.
Worked example. Let , , and .
A cornerstone identity, De Morgan's laws, connects complements to the other operations:
Check the first with our numbers: , while . They match.
Venn Diagrams and Cardinality
A Venn diagram draws each set as a circle inside a rectangle (the universal set); overlaps show intersections. They turn abstract logic into geometry and are the fastest way to reason about two or three sets. Picture two overlapping circles and : the lens where they cross is , the region covered by either circle is , and everything in the rectangle outside both circles is .
For finite sets, cardinality is just the element count. But when sets overlap, you cannot simply add sizes — you would count the overlap twice. The inclusion–exclusion principle fixes this:
Worked example. In a class of 30 students, 18 study French, 15 study Spanish, and 7 study both. How many study at least one language, and how many study neither?
At least one: .
Neither: these are the students outside , so students. If we had naively added , we would have exceeded the class size — a clear signal that the 7 double-counted students must be subtracted.
Countable versus Uncountable Infinity
Here is where set theory becomes revolutionary. How do you compare the sizes of infinite sets when you can never finish counting? Cantor's answer: two sets have the same size if their elements can be matched in a perfect one-to-one pairing (a bijection), with none left over on either side.
A set is countably infinite if it can be paired with the natural numbers — that is, if you can arrange its elements in an infinite list. Surprisingly many sets pass this test. The integers do: list them , hitting each exactly once. Even the rationals do, by walking through a grid of fractions diagonally and skipping duplicates. The size of any such set is the smallest infinite cardinal, written ("aleph-null").
The stunning result is that the real numbers are not countable. Cantor proved it with his diagonal argument. Suppose, for contradiction, that we could list all real numbers between 0 and 1 as , each written as an infinite decimal:
Now build a new number by a simple rule: make differ from the first digit of , differ from the second digit of , from the third digit of , and so on down the diagonal (say, if the digit is 5 make it 6, otherwise make it 5). By construction differs from every number on the list in at least one decimal place, so is a real number between 0 and 1 that is not on the list. This contradicts the assumption that the list was complete. No list can contain all the reals — is uncountable, strictly larger than .
This means there is a genuine hierarchy of infinities. Cantor even proved a general theorem: for any set , its power set is strictly larger than . Apply it repeatedly and you get an endless tower of ever-larger infinite sizes.
Real-World Applications
- Databases and SQL. Query operations are literally set operations:
UNION,INTERSECT, andEXCEPT(difference) combine result sets, and aJOINfilters by an intersection condition. - Search and filtering. Every faceted search ("red AND size-10 AND in-stock") evaluates intersections and unions of product sets; Boolean web search does the same.
- Probability. Events are subsets of a sample space. The addition rule is inclusion–exclusion in disguise.
- Digital circuits and logic. Boolean algebra — the basis of computer hardware — is set algebra: AND is intersection, OR is union, NOT is complement, and De Morgan's laws are used constantly to simplify gates.
- Computability theory. Cantor's countable/uncountable distinction underlies the proof that some problems are undecidable: there are uncountably many possible functions but only countably many programs, so most functions cannot be computed.
Common Mistakes
Mistake 1: Confusing with . Students write when they mean . Why it's wrong: relates an element to a set, while relates a set to a set. The element is in the set, so ; the set is a subset, so . Correction: ask "is this thing an element, or a whole collection?" before choosing the symbol.
Mistake 2: Forgetting to subtract the overlap. When counting , students add and overcount shared members. Why it's wrong: elements in both sets get tallied twice. Correction: always apply , and sanity-check that your total never exceeds the universal set.
Mistake 3: Assuming all infinities are equal. Many believe "infinity is infinity," so and must be the same size. Why it's wrong: Cantor's diagonal argument proves no bijection exists between them. Correction: infinite size is defined by bijection; some infinite sets (integers, rationals) share the size , but the reals are strictly larger.
Comparison and Connections
The operations are easy to confuse because their symbols look similar. This table pins down the distinctions:
| Concept | Symbol | Meaning | Result type |
|---|---|---|---|
| Membership | is an element of | true/false | |
| Subset | every element of is in | true/false | |
| Union | in or | a set | |
| Intersection | in and | a set | |
| Complement | in but not | a set | |
| Difference | in but not | a set |
Set theory connects outward everywhere. Logic mirrors it exactly: "and/or/not" correspond to intersection/union/complement, which is why De Morgan's laws appear in both. Probability builds events as sets. Functions and relations are defined as special sets of ordered pairs. And the countable/uncountable divide is the seed of both cardinal arithmetic and the theory of computability.
Practice Questions
Recall
List all subsets of . How many should there be?
Answer: There are subsets: , , , .
Understanding
Let and . Find , , and .
Answer: ; ; .
Application
In a survey of 50 people, 30 like tea, 25 like coffee, and 10 like both. How many like neither?
Guidance: Those liking at least one drink: . Neither: people.
Analysis
Explain why the set of rational numbers is countable but the set of real numbers is not. What single argument distinguishes them?
Guidance: Rationals can be arranged in a systematic list (walk a grid of numerators/denominators diagonally, skipping repeats), giving a bijection with . For the reals, Cantor's diagonal argument constructs a number differing from every entry of any proposed list, proving no such list is complete — hence is uncountable and strictly larger.
FAQ
Is the empty set really a subset of every set? Yes. The definition "every element of is in " holds vacuously — there is no element of that could fail the condition, so the statement is true for every .
What's the difference between and ? is the empty set — it has no elements, so . But is a set containing one thing (the empty set), so . They are not equal.
Why does order and repetition not matter in a set? A set records only membership — whether something belongs. If you need order or repeated entries, you want a different object: an ordered tuple (like ) or a multiset. Sets deliberately strip those features away.
How can the rationals be "the same size" as the integers when there are infinitely many fractions between any two integers? Density and size are different questions. Size, for Cantor, means "can they be paired one-to-one?" — and yes, the rationals can be listed in a sequence, so they pair perfectly with the integers despite being densely packed.
Did mathematicians accept Cantor's ideas right away? No. Kronecker and others attacked them fiercely as meaningless, and Cantor faced real professional and personal hardship. Acceptance came within a generation, and Hilbert later called Cantor's work a "paradise" mathematics would never leave.
Is there an infinity between (the integers) and the size of the reals? This is the famous Continuum Hypothesis. Gödel and Cohen proved it can be neither proved nor disproved from the standard ZFC axioms — it is genuinely independent of them.
Quick Revision
- Set: collection of distinct elements; means membership; order and repeats don't matter.
- Subset: if every element of is in ; is a subset of everything.
- Power set: all subsets of ; a set of elements has subsets.
- Operations: (or), (and), (not), (in not ).
- De Morgan: and .
- Inclusion–exclusion: .
- Countable: can be listed / paired with (integers, rationals; size ).
- Uncountable: cannot be listed (reals); proven by Cantor's diagonal argument.
Related Topics
Prerequisites
Related Topics
- Logic and Boolean algebra (and/or/not mirror intersection/union/complement)
- Probability — events as subsets of a sample space (see Statistics and Probability)
Next Topics
- Relations and functions (defined as sets of ordered pairs)
- Combinatorics and counting (builds on cardinality and inclusion–exclusion)