Set Theory Tutorial
Learn Set Theory step by step: 38 lessons in 9 chapters with examples, quizzes, diagrams and practice.
Start learning →
of lessons completed
Getting Started
- What Is a Set? Learn what a set is, how to write sets with braces and set-builder notation, and how to test membership, with runnable Python examples.
- Equality and Subsets Understand when two sets are equal, what a subset and a proper subset are, and how to prove set equality by showing two inclusions.
- Power Sets and Counting Subsets Learn the power set P(A), why a set with n elements has 2^n subsets, and how binary strings list every subset, with runnable Python code.
- Special Sets and Intervals Meet the standard number sets N, Z, Q, R and C, the universal set, and interval notation for sets of real numbers, with examples and quizzes.
Sets and Operations
- Union and Intersection Learn the union and intersection of sets, disjoint sets, the properties of both operations, and how to compute them by hand and in Python.
- Complement and Difference Learn set difference A \ B, the complement of a set inside a universal set, and how they relate to union and intersection, with worked examples and Python.
- Symmetric Difference and Venn Diagrams Learn the symmetric difference of sets, its algebra (it behaves like XOR), and how to read and draw Venn diagrams for two and three sets.
- Laws of Set Algebra and De Morgan Collect the laws of set algebra, prove De Morgan's laws, and learn to simplify set expressions, checking identities with a membership-table program.
- Inclusion-Exclusion Learn the inclusion-exclusion principle for two, three and n sets, apply it to counting problems and derangements, and verify it with code.
Relations and Functions
- Ordered Pairs and Cartesian Products Learn ordered pairs, how a pair can be built from sets alone, the Cartesian product A × B, its size, and how to compute it in Python.
- Relations Learn what a relation is as a set of ordered pairs, with domain, range, inverse and composition, shown as tables, arrow diagrams and Python code.
- Properties of Relations Learn the four key properties of relations: reflexive, symmetric, antisymmetric and transitive. Test them with examples, proofs and Python checkers.
- Functions as Special Relations See a function as a relation where each input has exactly one output, with domain, codomain, range, images, preimages and composition in Python.
- Injective, Surjective and Bijective Functions Learn one-to-one, onto and bijective functions, how to prove or disprove each, how inverse functions work, and why bijections count infinite sets.
Equivalence and Order
- Equivalence Relations Learn equivalence relations (reflexive, symmetric, transitive), equivalence classes, congruence modulo n, and how to test them in Python.
- Partitions and Quotient Sets Learn partitions of a set, the correspondence between partitions and equivalence relations, quotient sets A/~, and Bell numbers, with code.
- Partial Orders and Hasse Diagrams Learn partial and total orders, posets, comparable elements and Hasse diagrams, with examples from divisibility and subsets, plus Python code.
- Extremal Elements, Bounds and Lattices Learn minimal and maximal elements, least and greatest elements, upper bounds, supremum and infimum, and lattices, with divisibility and subset examples.
Cardinality
- Cardinality and Bijections Learn what it means for two sets to have the same size using bijections, with injective and surjective checkers you can run in Python.
- Counting Finite Sets Count elements of unions, products and power sets with inclusion-exclusion and the 2^n rule, and verify each formula with runnable Python.
- Comparing Sizes and the Schröder–Bernstein Theorem Compare cardinalities with injections, learn why |A| ≤ |B| and |B| ≤ |A| imply |A| = |B|, and build the bijection step by step in Python.
- Cardinal Arithmetic Define addition, multiplication and exponentiation of cardinals using disjoint unions, products and function sets, and test them with Python.
Countable and Uncountable Sets
- Countable Sets and Hilbert's Hotel Learn what countably infinite means, show that the integers are countable with an explicit bijection, and explore Hilbert's hotel in Python.
- The Rationals Are Countable Prove that N×N and the rational numbers are countable using the Cantor pairing function and the Calkin–Wilf sequence, with working Python code.
- Cantor's Diagonal Argument Follow Cantor's diagonal proof that the real numbers between 0 and 1 cannot be listed, and watch the diagonal construction work in Python.
- Power Sets and Cantor's Theorem Prove that |A| < |P(A)| for every set A with the diagonal set D, check it by brute force on small sets, and see why there is no largest infinity.
- The Continuum and the Real Numbers Show that every interval has the same cardinality as the whole real line using tan and linear maps, and meet the cardinal of the continuum 2^ℵ₀.
Ordinals and Well-Ordering
- Well-Ordered Sets Learn what a well-ordering is, why the naturals are well-ordered but the integers and reals are not, and test least elements in Python.
- Ordinal Numbers Build the ordinals 0, 1, 2, ω, ω+1 as sets, see successor and limit ordinals, and test the von Neumann definition with Python frozensets.
- Transfinite Induction Learn strong induction, well-founded induction and transfinite induction on ordinals, with runnable examples including Goodstein sequences.
- Ordinal Arithmetic Add and multiply ordinals, see why 1 + ω = ω but ω + 1 ≠ ω, and compute with Cantor normal form for ordinals below ω^ω in Python.
Axioms and Paradoxes
- Russell's Paradox Understand Russell's paradox, why unrestricted set formation breaks set theory, and how separation avoids it, with runnable simulations in Python.
- The ZFC Axioms A guided tour of the axioms of Zermelo–Fraenkel set theory with choice: what each says, why it is needed, and a tiny Python model of hereditarily finite sets.
- The Axiom of Choice Learn what the axiom of choice says, when you need it, and how it relates to Zorn's lemma and the well-ordering theorem, with code for explicit choices.
- Alephs and the Continuum Hypothesis Meet the aleph numbers, state the continuum hypothesis, and learn why Gödel and Cohen showed it cannot be proved or refuted from ZFC, with a cardinal calculator.
Projects and Practice
- Practice: Cardinality and Countability Twelve worked exercises on bijections, countable and uncountable sets, power sets and cardinal arithmetic, each with a Python check of the answer.
- Project: A Diagonal Explorer Build a small toolkit that enumerates sequences, constructs diagonal escapes, and visualizes a Cantor-style table with a plot, step by step in Python.
- Project: The Hereditarily Finite Universe Build every hereditarily finite set up to rank 4, count them, number them with the Ackermann coding, and check von Neumann ordinals, step by step.