What is a Set?
A set is an unordered collection of distinct elements. Order doesn't matter; duplicates don't exist.
Definition
A set groups distinct objects (elements) with no inherent ordering. Two sets are equal if and only if they contain exactly the same elements.
Membership
Use ∈ to denote that an element belongs to a set, and ∉ for non-membership.
5 ∉ {1,2,3} ✓
Cardinality
The cardinality |A| is the number of elements in a set. Infinite sets (like ℕ) have infinite cardinality. The empty set has cardinality 0.
|∅| = 0
Subsets
A is a subset of B (A ⊆ B) if every element of A is also in B. A is a proper subset (A ⊂ B) if A ⊆ B and A ≠ B.
{1,2} ⊂ {1,2,3} ✓
Set-Builder Form
Describe a set by a rule rather than listing elements. Read the vertical bar as "such that."
= {1, 2, 3, ...}
Power Set
The power set P(A) is the set of ALL subsets of A, including ∅ and A itself. If |A| = n, then |P(A)| = 2ⁿ.
{∅, {1}, {2}, {1,2}}
Key Properties at a Glance
∀x(x∈A ↔ x∈B)
Set Operations
The fundamental ways to combine and transform sets. Each has a precise definition and a visual intuition via Venn diagrams.
Union
All elements that are in A, or in B, or in both. The combined collection with no duplicates.
Intersection
Only the elements that appear in both A and B. The overlap region.
Difference
Elements in A that are not in B. Also written A − B. Asymmetric — order matters.
Complement
All elements in the universal set U that are not in A. Requires a defined universe.
Aᶜ = {3,4,5}
Symmetric Difference
Elements in A or B but not both. Equivalent to (A∪B) \ (A∩B). The XOR of sets.
Cartesian Product
All ordered pairs (a,b) where a∈A and b∈B. Forms the basis of relations and functions.
{(1,a),(1,b),(2,a),(2,b)}
Formal Definitions
{x | x∈A ∨ x∈B}
{x | x∈A ∧ x∈B}
{x | x∈A ∧ x∉B}
(A∪B) \ (A∩B)
Interactive Explorer
Edit the sets below and click an operation to see the result visualized.
Laws & Identities
These algebraic laws hold for all sets A, B, C within a universal set U.
| Union is commutative | A ∪ B = B ∪ A |
| Intersection is commutative | A ∩ B = B ∩ A |
| Union is associative | (A ∪ B) ∪ C = A ∪ (B ∪ C) |
| Intersection is associative | (A ∩ B) ∩ C = A ∩ (B ∩ C) |
| ∩ distributes over ∪ | A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) |
| ∪ distributes over ∩ | A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) |
| Complement of union | (A ∪ B)ᶜ = Aᶜ ∩ Bᶜ |
| Complement of intersection | (A ∩ B)ᶜ = Aᶜ ∪ Bᶜ |
| Union with empty set | A ∪ ∅ = A |
| Intersection with universe | A ∩ U = A |
| Union with universe | A ∪ U = U |
| Intersection with empty set | A ∩ ∅ = ∅ |
| Complement union (excluded middle) | A ∪ Aᶜ = U |
| Complement intersection | A ∩ Aᶜ = ∅ |
| Double complement | (Aᶜ)ᶜ = A |
| Complement of universe | Uᶜ = ∅ |
| Complement of empty set | ∅ᶜ = U |
| Union idempotent | A ∪ A = A |
| Intersection idempotent | A ∩ A = A |
| Union absorption | A ∪ (A ∩ B) = A |
| Intersection absorption | A ∩ (A ∪ B) = A |
Special Sets
Canonical sets that appear throughout mathematics and computer science.
Number Set Hierarchy
Natural ⊂ Integer ⊂ Rational ⊂ Real ⊂ Complex
Quick Quiz
Test your understanding. 8 questions covering definitions, operations, and laws.
Cheat Sheet
A compact reference for all notation and key identities.