Discrete Math • Relations and Discrete Structures

Equivalence relations and partitions

How reflexivity, symmetry, and transitivity carve a set into non-overlapping classes that perfectly reassemble the whole.

A connected graph with binary values and set braces for discrete mathematics
Inside this lesson 10 sections 5 questions 9 figures

SECTION 1

Historical Context & Motivation

The idea that mathematical objects can be grouped by shared properties is far older than the formal language of set theory. Ancient Greek mathematicians implicitly partitioned integers into even and odd, while Gauss's 1801 Disquisitiones Arithmeticae built the entire theory of modular arithmetic on the notion that two integers are 'alike' when they leave the same remainder upon division. Yet the abstract framework that unifies all such constructions—equivalence relations and their corresponding partitions—crystallized only in the late nineteenth and early twentieth centuries as set theory matured.

1801 • Gauss's Congruence Classes

Carl Friedrich Gauss publishes Disquisitiones Arithmeticae, formalizing congruence modulo n and demonstrating that integers sharing a remainder form well-defined classes—an early prototype of equivalence classes.

1872 • Dedekind's Ideal Theory

Richard Dedekind introduces ideals in algebraic number theory, implicitly using quotient structures that rely on partitioning a ring into cosets—anticipating the formal equivalence-relation framework.

1895 • Cantor's Set Theory Foundations

Georg Cantor's set-theoretic framework provides the language of sets, subsets, and relations needed to state the three defining axioms of equivalence relations precisely.

1927 • Formal Axiomatization

The properties of reflexivity, symmetry, and transitivity are codified as the standard axioms for equivalence relations in emerging algebra textbooks, notably by B.L. van der Waerden and Emmy Noether's school.

1940s • The Fundamental Theorem

The bijective correspondence between equivalence relations on a set and partitions of that set becomes a standard theorem in abstract algebra and topology, unifying disparate classification schemes across mathematics.

The central question that equivalence relations address is deceptively simple: given a set of objects, how can we rigorously define what it means for two objects to be 'the same in some respect,' and how does such a definition automatically slice the set into non-overlapping groups? Understanding this correspondence is essential not only for algebra and number theory but also for computer science (e.g., type checking and union-find data structures), logic, and combinatorics.

SECTION 2

Core Principles & Definitions

An equivalence relation on a set S is a binary relation ∼ ⊆ S × S that satisfies three axioms, each of which mirrors a basic intuition about what 'sameness' should mean. Together, these axioms guarantee that ∼ behaves like equality in the relevant respect, even though the objects being related may differ in other ways. Meanwhile, a partition of S is a collection of non-empty, pairwise disjoint subsets whose union equals S. The deep insight is that these two notions—an algebraic property of a relation and a set-theoretic decomposition—are two perspectives on exactly the same structure.

1

Reflexivity

For every element a ∈ S, we require a ∼ a. Every element is related to itself—no object can fail to belong to its own class.
2

Symmetry

If a ∼ b, then b ∼ a. The relation is bidirectional: 'sameness' is a mutual relationship, not a one-way comparison.
3

Transitivity

If a ∼ b and b ∼ c, then a ∼ c. Chains of relatedness collapse: if a is like b and b is like c, then a is like c directly.
4

Equivalence Class [a]

The equivalence class of a is the set [a] = {x ∈ S : x ∼ a}. It collects every element that is related to a under ∼.
5

Partition

A partition of S is a family {A_i} of non-empty subsets satisfying: (i) ∪ AiA_i = S, and (ii) AiA_i ∩ AjA_j = ∅ for i ≠ j. Every element belongs to exactly one block.
✦

KEY TAKEAWAY

Think of an equivalence relation as a sorting rule at a mail distribution center. Every package (element) must go into exactly one bin (equivalence class). Reflexivity ensures no package is left on the floor; symmetry means if package A belongs in the same bin as package B, then B belongs with A; transitivity guarantees the sorting is consistent—if A matches B and B matches C, all three share a bin. The resulting arrangement of bins, with every package accounted for and no package in two bins at once, is precisely a partition.

SECTION 3

Visual Explanation

The following diagram illustrates the correspondence between an equivalence relation on a six-element set S = {1, 2, 3, 4, 5, 6} and the partition it induces. On the left, the relation is depicted as a directed graph (with bidirectional arrows representing symmetry and self-loops representing reflexivity). On the right, the same set is shown decomposed into three equivalence classes, visually confirming that the classes are disjoint and exhaustive.

Equivalence Relation as GraphInduced Partition142536Class [1]14Class [2]256Class [3]3
Left: the equivalence relation on S = {1, 2, 3, 4, 5, 6} shown as a graph with self-loops (reflexivity) and bidirectional edges (symmetry). Cyan edges connect 1 and 4; violet edges connect 2, 5, and 6 (note the transitive closure); 3 stands alone. Right: the three equivalence classes [1] = {1, 4}, [2] = {2, 5, 6}, and [3] = {3} form a partition—disjoint, non-empty, and collectively exhausting S.

Observe several critical features in the diagram. First, every node has a self-loop, confirming reflexivity. Second, every edge is bidirectional, reflecting symmetry. Third, within the violet cluster, the edges among 2, 5, and 6 form a complete subgraph (a clique), which is exactly the graphical signature of transitivity. In fact, the connected components of the relation graph (ignoring self-loops) correspond precisely to the blocks of the partition on the right. This is no coincidence; it is a consequence of the fundamental theorem that we will state formally in Section 4.

SECTION 4

Mathematical Framework

We now state the three axioms formally and develop the key theorem that equivalence relations and partitions are two sides of the same coin. Let S be a non-empty set and let ∼ be a binary relation on S, i.e., a subset of S × S.

REFLEXIVITY

∀a∈S:a∼a∀ a ∈ S : a ∼ a

Every element is related to itself. In the relation matrix, this means the main diagonal consists entirely of 1s.

SYMMETRY

∀a,b∈S:a∼b⟹b∼a∀ a, b ∈ S : a ∼ b ⟹ b ∼ a

The relation is its own inverse. In the relation matrix, M is symmetric: M[i][j] = M[j][i].

TRANSITIVITY

∀a,b,c∈S:(a∼b∧b∼c)⟹a∼c∀ a, b, c ∈ S : (a ∼ b ∧ b ∼ c) ⟹ a ∼ c

Relatedness propagates through chains. Combined with symmetry, this guarantees that equivalence classes are internally 'fully connected.'

The Fundamental Theorem

The Fundamental Theorem of Equivalence Relations establishes a bijection between equivalence relations on S and partitions of S. Specifically, if ∼ is an equivalence relation on S, then the set of equivalence classes S/∼ = {[a] : a ∈ S} is a partition of S. Conversely, if 𝒫 = {Ai} is a partition of S, then the relation defined by a ∼ b if and only if a and b belong to the same block Ai is an equivalence relation on S. Moreover, these two constructions are inverses of each other.

EQUIVALENCE CLASS

[a]=x∈S:x∼a[a] = { x ∈ S : x ∼ a }

The class [a] is the block of the partition containing a. A critical lemma: [a] = [b] if and only if a ∼ b, and [a] ∩ [b] = ∅ otherwise.

💡

Proof Sketch: Classes Are Disjoint or Identical

Suppose [a] ∩ [b] ≠ ∅, and let c ∈ [a] ∩ [b]. Then c ∼ a and c ∼ b. By symmetry, a ∼ c, and by transitivity, a ∼ b. Now take any x ∈ [a]; we have x ∼ a and a ∼ b, so x ∼ b by transitivity, giving x ∈ [b]. By symmetric argument, [b] ⊆ [a]. Hence [a] = [b]. This shows any two classes are either identical or disjoint—exactly the partition property.

SECTION 5

Detailed Breakdown: Congruence Modulo n

The most classical example of an equivalence relation is congruence modulo n, defined on the integers ℤ. For a fixed positive integer n, we say a ≡ b (mod n) if and only if n divides (a − b). This relation satisfies all three axioms: reflexivity (n | 0), symmetry (if n | (a − b) then n | (b − a)), and transitivity (if n | (a − b) and n | (b − c), then n | (a − c) by adding). The equivalence classes are the residue classes [0], [1], …, [n − 1], and they form the partition of ℤ into n infinite subsets. Below, we visualize the partition of integers under congruence modulo 3.

Partition of ℤ by Congruence Modulo 3Integer Number Line−6−5−4−3−2−1012345[0]… −6, −3, 0, 3, 6, 9 …Integers with remainder 0 when divided by 3[1]… −5, −2, 1, 4, 7, 10 …Integers with remainder 1 when divided by 3[2]… −4, −1, 2, 5, 8, 11 …Integers with remainder 2 when divided by 3
The number line is color-coded by residue class: cyan for [0], violet for [1], and amber for [2]. Below the line, each class is displayed as an infinite set. Together the three classes partition ℤ—every integer appears in exactly one class.

This example generalizes broadly. Any time you encounter a mathematical construction that groups objects by a shared feature—triangles by similarity, matrices by rank, integers by divisibility pattern—you are almost certainly looking at an equivalence relation in disguise. The partition perspective is equally useful: it tells you that the number of distinct 'types' under a given classification equals the number of equivalence classes, a quantity often denoted |S/∼| and called the index of the equivalence relation.

Example RelationSet SEquivalence Classes
a ≡ b (mod 4)ℤ[0], [1], [2], [3] (index = 4)
Same absolute value: |a| = |b|ℤ{0}, {−1, 1}, {−2, 2}, … (index = ∞)
Same cardinality: |A| = |B|𝒫(S) (power set)Subsets grouped by size
Similarity of trianglesSet of all trianglesEach class = all triangles with given angle triple

Common examples of equivalence relations and the partitions they induce.

SECTION 6

Worked Example

Let S = {a, b, c, d, e} and define the relation R = {(a,a), (b,b), (c,c), (d,d), (e,e), (a,b), (b,a), (d,e), (e,d)}. Determine whether R is an equivalence relation, and if so, find the equivalence classes and the corresponding partition.

Classifying a Relation on a Five-Element Set

  1. 1

    Step 1 — Check Reflexivity

    We need (x, x) ∈ R for every x ∈ S. Inspecting R: (a,a) ✓, (b,b) ✓, (c,c) ✓, (d,d) ✓, (e,e) ✓. All five diagonal pairs are present.
    Reflexivity: satisfied ✓
  2. 2

    Step 2 — Check Symmetry

    For every (x, y) ∈ R with x ≠ y, we need (y, x) ∈ R. The non-diagonal pairs are (a,b) and (b,a), and (d,e) and (e,d). Each pair has its reverse present in R.
    Symmetry: satisfied ✓
  3. 3

    Step 3 — Check Transitivity

    We examine all chains (x, y) and (y, z) in R. The relevant non-trivial chains are: (a,b) and (b,a) → need (a,a) ✓ (present). (b,a) and (a,b) → need (b,b) ✓. (d,e) and (e,d) → need (d,d) ✓. (e,d) and (d,e) → need (e,e) ✓. No other non-trivial chains exist because the clusters {a,b} and {d,e} are disjoint and c relates only to itself.
    Transitivity: satisfied ✓
  4. 4

    Step 4 — Identify Equivalence Classes

    Since R is an equivalence relation, we compute the classes: [a] = {x ∈ S : (x, a) ∈ R} = {a, b}. [b] = {a, b} (same class). [c] = {c}. [d] = {d, e}. [e] = {d, e}.
    Equivalence classes: {a, b}, {c}, {d, e}
  5. 5

    Step 5 — State the Partition

    The partition is 𝒫 = { {a, b}, {c}, {d, e} }. Verification: the blocks are non-empty, pairwise disjoint, and their union {a,b} ∪ {c} ∪ {d,e} = {a,b,c,d,e} = S.
    Partition: 𝒫 = { {a, b}, {c}, {d, e} }

SECTION 7

Equivalence vs. Other Relations

Equivalence relations occupy a specific niche among binary relations. Students often confuse them with partial orders or with relations that satisfy only two of the three axioms. The following table contrasts equivalence relations with several common relation types to clarify where they differ and what structural consequences follow.

PropertyEquivalence RelationPartial OrderPreorder
Reflexive✓ Required✓ Required✓ Required
Symmetric✓ Required✗ Not in general✗ Not in general
Antisymmetric✗ (only for singletons)✓ Required✗ Not in general
Transitive✓ Required✓ Required✓ Required
Structural resultPartition of the setHasse diagram / latticeDirected acyclic structure (modulo equivalence)

Comparison of equivalence relations with partial orders and preorders.

A crucial distinction is that partial orders use antisymmetry (if a ≤ b and b ≤ a then a = b) in place of symmetry. This makes partial orders suitable for hierarchical structures such as divisibility on the natural numbers or subset inclusion on a power set, whereas equivalence relations model flat, non-hierarchical groupings. Meanwhile, a preorder is reflexive and transitive but neither symmetric nor antisymmetric in general. Interestingly, every preorder naturally induces an equivalence relation—define a ∼ b when both a ≤ b and b ≤ a—and the quotient set under this equivalence becomes a partial order.

✦

KEY TAKEAWAY

If you think of relations as lenses through which you view a set, an equivalence relation is a 'grouping lens' that clusters elements into peer groups of equals. A partial order is a 'ranking lens' that arranges elements into a hierarchy. The choice of lens depends on whether your goal is classification (use equivalence relations) or comparison (use partial orders). Many powerful results in algebra, such as the First Isomorphism Theorem, arise from combining both perspectives.

SECTION 8

Connections to Advanced Theory

Equivalence relations and partitions serve as the launching point for several deep ideas in abstract algebra, topology, and theoretical computer science. The quotient set S/∼ is not merely a collection of subsets; when S carries algebraic structure (group, ring, vector space), the quotient often inherits that structure, yielding quotient groups, quotient rings, and quotient spaces. This construction is formalized through the notion of a congruence relation—an equivalence relation that is also compatible with the algebraic operations.

Concept in This LessonAdvanced GeneralizationWhere It Appears
Equivalence class [a]Coset aH in group theoryQuotient groups G/H, Lagrange's theorem
Partition of a setQuotient topology on X/∼Identification spaces, CW complexes
Index |S/∼|Index of a subgroup [G : H]Lagrange's theorem, orbit-counting
Congruence mod nKernel of a ring homomorphismFirst Isomorphism Theorem for rings
Union-find (disjoint sets)Partition refinement algorithmsKruskal's MST, automata minimization

How the concepts in this lesson generalize to advanced settings.

In computer science, the union-find (disjoint-set) data structure maintains a partition of a finite set under two operations: find(x) returns the representative of the equivalence class containing x, and union(x, y) merges the classes of x and y. With path compression and union by rank, this structure supports nearly-constant-time operations, making it indispensable in algorithms for minimum spanning trees (Kruskal's algorithm), connected components in graphs, and DFA minimization. Mastering the equivalence-relation/partition duality gives you the conceptual foundation for all of these applications.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain why the relation 'a divides b' (written a | b) on the set of positive integers ℤ⁺ is not an equivalence relation. Which of the three axioms does it violate? Provide a specific counterexample for each violated axiom.
Show answer
Divisibility on ℤ⁺ is reflexive (a | a for all a) and transitive (if a | b and b | c then a | c), but it fails symmetry. For instance, 2 | 6 but 6 ∤ 2. Since symmetry is violated, the relation cannot be an equivalence relation. In fact, divisibility satisfies antisymmetry (if a | b and b | a then a = b) in addition to reflexivity and transitivity, making it a partial order rather than an equivalence relation. This illustrates the fundamental distinction: equivalence relations group peers, while partial orders impose a hierarchy.

Question 2: BASIC CALCULATION

Let S = {1, 2, 3, 4, 5, 6, 7, 8} and define the relation a ∼ b if and only if a ≡ b (mod 3). List all equivalence classes and state the partition. How many classes are there?
Show answer
Computing remainders modulo 3: [0] = {3, 6} (elements with remainder 0), [1] = {1, 4, 7} (remainder 1), [2] = {2, 5, 8} (remainder 2). The partition is { {3, 6}, {1, 4, 7}, {2, 5, 8} }. There are 3 equivalence classes, consistent with the fact that congruence modulo n always produces exactly n classes on any set of integers containing representatives of all residues. One can verify the partition properties: the union {3,6} ∪ {1,4,7} ∪ {2,5,8} = {1,2,3,4,5,6,7,8} = S, and the blocks are pairwise disjoint.

Question 3: INTERMEDIATE

On ℤ × ℤ (ordered pairs of integers), define (a, b) ∼ (c, d) if and only if a + d = b + c. Prove that ∼ is an equivalence relation and describe what each equivalence class looks like geometrically.
Show answer
Reflexivity: (a, b) ∼ (a, b) requires a + b = b + a, which holds by commutativity. Symmetry: if (a, b) ∼ (c, d) then a + d = b + c, so c + b = d + a, which means (c, d) ∼ (a, b). Transitivity: suppose (a, b) ∼ (c, d) and (c, d) ∼ (e, f). Then a + d = b + c and c + f = d + e. Adding: a + d + c + f = b + c + d + e, and canceling c + d yields a + f = b + e, so (a, b) ∼ (e, f). The condition a + d = b + c can be rewritten as a − b = c − d, so [(a, b)] = {(x, y) ∈ ℤ × ℤ : x − y = a − b}. Geometrically, each equivalence class is a line of slope 1 in the integer lattice, and the relation partitions ℤ × ℤ into parallel diagonal lines indexed by the difference x − y. This construction is, in fact, the classical way to construct the integers from the natural numbers: each class represents the integer a − b.

Question 4: APPLIED

A compiler uses a union-find data structure to track type equivalence. Initially, five type variables {T₁, T₂, T₃, T₄, T₅} are each in their own singleton class. The type-checker then processes the constraints T₁ = T₃, T₂ = T₅, and T₃ = T₅ (here = denotes type equality). After processing all three constraints, how many equivalence classes remain? List the classes. Explain why transitivity is essential for the compiler's correctness.
Show answer
Initially the partition is { {T₁}, {T₂}, {T₃}, {T₄}, {T₅} }. After T₁ = T₃: merge {T₁} and {T₃} → { {T₁, T₃}, {T₂}, {T₄}, {T₅} }. After T₂ = T₅: merge {T₂} and {T₅} → { {T₁, T₃}, {T₂, T₅}, {T₄} }. After T₃ = T₅: since T₃ is in {T₁, T₃} and T₅ is in {T₂, T₅}, we merge these two classes → { {T₁, T₂, T₃, T₅}, {T₄} }. Two equivalence classes remain. Transitivity is essential because, even though the programmer never wrote T₁ = T₂ directly, the chain T₁ = T₃ and T₃ = T₅ and T₅ = T₂ forces the compiler to deduce T₁ = T₂. Without transitivity, the compiler could allow T₁ and T₂ to have incompatible types, leading to runtime type errors.

Question 5: CRITICAL THINKING

Prove that the number of equivalence relations on a finite set with n elements equals the Bell number B(n). Specifically, establish the bijection and compute B(4) by enumerating all partitions of {1, 2, 3, 4}.
Show answer
By the Fundamental Theorem, equivalence relations on a set S are in bijection with partitions of S. Therefore, the count of equivalence relations on an n-element set equals the number of partitions of that set, which is precisely the Bell number B(n). To compute B(4), we enumerate all partitions of {1, 2, 3, 4}. With 1 block: {{1,2,3,4}} — 1 partition. With 2 blocks: {{1},{2,3,4}}, {{2},{1,3,4}}, {{3},{1,2,4}}, {{4},{1,2,3}}, {{1,2},{3,4}}, {{1,3},{2,4}}, {{1,4},{2,3}} — 7 partitions. With 3 blocks: choose which element is paired, then which it pairs with: {{1,2},{3},{4}}, {{1,3},{2},{4}}, {{1,4},{2},{3}}, {{2,3},{1},{4}}, {{2,4},{1},{3}}, {{3,4},{1},{2}} — 6 partitions. With 4 blocks: {{1},{2},{3},{4}} — 1 partition. Total: 1 + 7 + 6 + 1 = 15 = B(4). This can also be verified using the Bell triangle recurrence or the Dobinski formula B(n) = (1/e) Σ_{k=0}^{∞} kⁿ/k!.

SUMMARY

Lesson Summary

Summary

An equivalence relation on a set S is a binary relation satisfying three axioms: reflexivity (every element relates to itself), symmetry (if a ∼ b then b ∼ a), and transitivity (if a ∼ b and b ∼ c then a ∼ c). Each equivalence relation gives rise to equivalence classes [a] = {x ∈ S : x ∼ a}, and the collection of all classes forms a partition of S—a family of non-empty, pairwise disjoint subsets whose union is S.

The Fundamental Theorem establishes a bijection between equivalence relations on S and partitions of S, meaning every partition defines exactly one equivalence relation and vice versa. The canonical example is congruence modulo n, which partitions ℤ into n residue classes. This framework extends to quotient structures in algebra (quotient groups, quotient rings), identification spaces in topology, and the union-find data structure in computer science, making it one of the most versatile constructions in all of mathematics.

Varsity Tutors • Discrete Math • Equivalence relations and partitions