Foundations, logic and sets
Set theory
A hands-on map of membership, Venn diagrams, operations, laws, foundations, infinity and the paradox that stopped mathematicians from putting absolutely everything into one set.
One idea, three depths
What is set theory?
Sorting treasure into boxes
A set is like a box of special things. One box might hold red blocks and another might hold round blocks. A red, round block can belong in both groups. Set theory asks what is in each box, what the boxes share and what is left outside.
Collections with exact rules
A set is an unordered collection with no repeated elements. We can combine sets with union, keep common elements with intersection, remove one set from another with difference and compare them using subset relationships.
A language for mathematical objects
Set theory formalises membership and builds structures from sets: ordered pairs, relations, functions, number systems, spaces and probability events. Modern foundations use axioms that permit useful constructions while blocking contradictory “collections of everything.”
Interactive set laboratory
Build two sets and watch every relationship change
Separate elements with commas. Repeated elements are removed because a set records membership, not repetition.
A and B overlap, but neither contains the other.
- Union A ∪ B
- {1, 2, 3, 5, 4, 6}
- Intersection A ∩ B
- {3, 5}
- Difference A ∖ B
- {1, 2}
- Difference B ∖ A
- {4, 6}
- Symmetric difference A △ B
- {1, 2, 4, 6}
- Complement Aᶜ
- {4, 6, 7, 8}
- Complement Bᶜ
- {1, 2, 7, 8}
- Cardinality
- |A| = 4; |B| = 4; |A ∪ B| = 6
Show the Cartesian product A × B (16 ordered pairs)
{(1, 3), (1, 4), (1, 5), (1, 6), (2, 3), (2, 4), (2, 5), (2, 6), (3, 3), (3, 4), (3, 5), (3, 6), (5, 3), (5, 4), (5, 5), (5, 6)}
Now you do it
Practice set theory one level at a time
Work each problem by hand first. Use the linked calculator or lab to check examples, then reveal the short worked solution to inspect your reasoning.
Build the idea with concrete examples.
Problem 1
Box A contains cat, dog and owl. Box B contains dog and fox. Which animal is in both boxes?
Show answer and worked solution
Answer: dog
Reasoning: Look for an item that appears in both lists. Only dog is shared, so A∩B={dog}.
Problem 2
Using the same boxes, list every different animal that appears in either box.
Show answer and worked solution
Answer: {cat, dog, owl, fox}
Reasoning: Union collects every element but does not repeat dog. Therefore A∪B={cat,dog,owl,fox}.
Apply notation and calculation rules.
Problem 1
Let A={1,2,3,4} and B={3,4,5}. Find A∪B, A∩B and A∖B.
Show answer and worked solution
Answer: A∪B={1,2,3,4,5}; A∩B={3,4}; A∖B={1,2}
Reasoning: Union keeps every distinct member, intersection keeps the shared members, and A∖B keeps members of A that are absent from B.
Problem 2
How many subsets does S={a,b,c,d} have?
Show answer and worked solution
Answer: 16
Reasoning: Each of four elements has two independent choices: included or excluded. Therefore |℘(S)|=2⁴=16.
Connect definitions and justify each step.
Problem 1
Using an arbitrary element x, prove that A∩B⊆A.
Show answer and worked solution
Answer: Every element of A∩B belongs to A by the definition of intersection
Reasoning: Choose an arbitrary x∈A∩B. By definition of intersection, x∈A and x∈B. In particular x∈A. Since the argument works for every x in the intersection, A∩B⊆A.
Problem 2
Prove (A∪B)ᶜ=Aᶜ∩Bᶜ by following one arbitrary element x.
Show answer and worked solution
Answer: x∉A∪B exactly when x∉A and x∉B
Reasoning: x∈(A∪B)ᶜ iff x∉A∪B, iff x∉A and x∉B, iff x∈Aᶜ and x∈Bᶜ, iff x∈Aᶜ∩Bᶜ. Equal membership conditions prove the sets are equal.
Prove, generalise and test the limits.
Problem 1
Why can no function f:A→℘(A) be surjective?
Show answer and worked solution
Answer: The diagonal set D={a∈A | a∉f(a)} cannot equal f(d) for any d∈A
Reasoning: Assume D=f(d). If d∈D, the definition says d∉f(d)=D. If d∉D, the definition says d∈f(d)=D. Both possibilities contradict themselves, so D is missing from the range of f.
Problem 2
On ℤ define a∼b when a−b is divisible by 3. Describe the equivalence classes.
Show answer and worked solution
Answer: There are three classes: integers congruent to 0, 1 or 2 modulo 3
Reasoning: Every integer has exactly one remainder 0, 1 or 2 after division by 3. Integers share a class precisely when their difference is divisible by 3, producing [0], [1] and [2].
Read the language
Set notation from ∈ to ℘(A)
These symbols compress complete statements. Read each one aloud before manipulating it.
| Symbol | Read as | Meaning and example |
|---|---|---|
x ∈ A | x is an element of A | 3 ∈ {1,3,5} is true. |
x ∉ A | x is not an element of A | 2 ∉ {1,3,5} is true. |
∅ | the empty set | A set containing no elements; |∅|=0. |
A ⊆ B | A is a subset of B | Every element of A also belongs to B; equality is allowed. |
A ⊂ B | A is a proper subset of B | Every element of A belongs to B, and A≠B. |
A ∪ B | A union B | Everything in A, B or both. |
A ∩ B | A intersection B | Only elements shared by both sets. |
A ∖ B | A minus B | Elements in A that are not in B. |
Aᶜ | the complement of A | Everything in the stated universe U that is not in A. |
A △ B | symmetric difference | Elements in exactly one of A and B, but not both. |
|A| | cardinality of A | The number of elements when A is finite. |
℘(A) | power set of A | The set of every subset of A; if |A|=n, then |℘(A)|=2ⁿ. |
A × B | Cartesian product | Every ordered pair (a,b) with a∈A and b∈B. |
{x∈ℤ | x is even} | set-builder notation | All integers x such that x is even. |
The algebra of sets
Laws that let you simplify set expressions
These are not magic recipes. Each law says that both sides have exactly the same members.
A ∪ ∅ = AA ∩ U = AA ∪ U = UA ∩ ∅ = ∅A ∪ A = AA ∩ A = AA ∪ Aᶜ = UA ∩ Aᶜ = ∅A ∪ B = B ∪ AA ∩ B = B ∩ A(A ∪ B) ∪ C = A ∪ (B ∪ C)(A ∩ B) ∩ C = A ∩ (B ∩ C)A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)A ∪ (A ∩ B) = AA ∩ (A ∪ B) = A(A ∪ B)ᶜ = Aᶜ ∩ Bᶜ(A ∩ B)ᶜ = Aᶜ ∪ Bᶜ“Not in either” means outside both. “Not in both” means missing from at least one.
Worked reasoning
Three problems sets solve
How many students chose either club?
Let M be 18 music students, S be 14 sports students and |M∩S|=6. Adding 18+14 counts the six shared students twice.
|M∪S| = |M| + |S| − |M∩S| = 18 + 14 − 6 = 26
Why ordered pairs matter
If A={1,2} and B={a,b}, then A×B={(1,a),(1,b),(2,a),(2,b)}. A function from A to B is a special subset of this product that gives each input exactly one output.
Events live inside a sample space
For a die, Ω={1,2,3,4,5,6}. Let E be even outcomes and H be outcomes greater than 3. Then E∩H={4,6}, so P(E∩H)=2/6=1/3.
The map beneath mathematics
How sets grow into whole fields
Set theory is less a single destination than a construction language. Add structure to sets and familiar mathematics appears.
Objects and membership
Coordinates and data
Connections and comparisons
Rules and transformations
Groups, rings and fields
Shape, continuity and space
Chance, size and integration
Hilbert spaces and observables
The strange edge of the map
Paradoxes and facts worth remembering
The oddities are not decoration. They reveal why mathematics needs precise foundations.
Does the set of all sets that do not contain themselves contain itself?
If it does, its rule says it must not. If it does not, its rule says it must. The contradiction shows that any describable collection cannot automatically be accepted as a set.
Every set has a strictly larger power set
No pairing can match every element of A with every subset of A. Therefore |A|<|℘(A)|—even when A is infinite. This produces an endless hierarchy of larger infinities.
Nothing is inside everything
∅⊆A for every set A. A subset claim fails only if it contains a counterexample, and the empty set has no element that could be one.
∅ differs from {∅}
The first has zero elements. The second has one element—and that element happens to be the empty set. So |∅|=0, while |{∅}|=1.
A proper part can match the whole
The natural numbers and the even natural numbers can be paired by n↦2n. That cannot happen with finite sets, but it is a defining feature of infinite ones.
Not all infinities are the same size
The real numbers cannot be listed in a sequence like the natural numbers. Cantor’s diagonal argument constructs a real number missing from any proposed complete list.
How to prove set statements
Membership is the master test
To prove A ⊆ B
- Choose an arbitrary element x in A.
- Use the definition of A to learn what x satisfies.
- Show those facts imply x belongs to B.
To prove A = B
- Prove A ⊆ B.
- Prove B ⊆ A.
- Conclude the sets have exactly the same elements.
To disprove a claim
- Find one concrete counterexample.
- Verify it belongs where claimed.
- Show it fails the required membership condition.
Where this fits
When should you learn Set theory?
The first encounter is not the final level. Many ideas begin visually, become computational in high school and become formal in college.
- 1Pre-high schoolUsually introduced
- 2High schoolGreater depth
- 3CollegeGreater depth
- 4AdvancedGreater depth
- Sorting and Venn diagrams
- Algebra
- Probability
- Discrete mathematics
- Foundations
- Counting
- Equality
- Reading mathematical symbols
- Logic
- Relations
- Functions
- Probability spaces
- Mathematical structures
Sets organise states, outcomes, domains and the structures used later in linear algebra.
Open the Zero-to-QM pathClear answers
Questions about Set theory
What is set theory in simple terms?
Set theory is the mathematics of collections: what belongs to a collection, how collections overlap and how they can be combined, compared or used to construct other mathematical objects.
What is the difference between ∈ and ⊆?
The symbol ∈ compares an element with a set: x∈A means x belongs to A. The symbol ⊆ compares two sets: A⊆B means every element of A also belongs to B.
Is there a set of all sets?
Not in standard ZFC set theory. Allowing an unrestricted set of all sets produces contradictions such as Russell's paradox. Collections that are too large to be sets are treated as proper classes.
What is Russell's paradox?
Consider the collection of all sets that do not contain themselves. If that collection contains itself, then by its rule it must not; if it does not, then by its rule it must. The contradiction exposed a flaw in unrestricted set formation.
Is the empty set the same as a set containing the empty set?
No. The empty set ∅ has zero elements. The set {∅} has one element, and that element is the empty set.
Are all infinities the same size?
No. The natural numbers are countably infinite, while the real numbers are uncountably infinite. Cantor's theorem also shows that every set has a power set with strictly greater cardinality.
Why is set theory important?
Sets provide a shared construction language for relations, functions, number systems, probability spaces, algebraic structures, topology, analysis and much of modern mathematics.