Lesson 11 +35 XP

Equivalence Relations, Equivalence Classes & Closures

1. Equivalence Relations

A relation on A is an equivalence relation if it is reflexive, symmetric and transitive.

Examples

  • Equality on any set.
  • Congruence modulo m on Z: a ≡ b (mod m) iff m ∣ (a − b).
  • a R b iff a − b is an integer (on R).
  • On A = {1, 2, 3}: R = {(1,1),(2,2),(3,3),(1,2),(2,1)} ✅. But {(1,1),(2,2),(3,3),(3,2),(1,3)} ❌ (not symmetric).

Proof that congruence mod m is an equivalence relation

  • Reflexive: a − a = 0 = m·0.
  • Symmetric: a − b = mk ⇒ b − a = m(−k).
  • Transitive: a − b = mk, b − c = ml ⇒ a − c = m(k + l). ∎

Result. If R is an equivalence relation, so is R⁻¹. (Indeed R⁻¹ = R, because R is symmetric.)

2. Equivalence Classes

The equivalence class of a is [a] = {x ∈ A : (a, x) ∈ R}. Any element of a class can serve as its representative.

Solved. A = {1, 2, 3, 4, 5}, a R b iff a + b is even.

  • Reflexive: a + a = 2a is even ✓
  • Symmetric: a + b even ⇒ b + a even ✓
  • Transitive: a + b and b + c even ⇒ a, b, c have the same parity ⇒ a + c even ✓
  • Classes: [1] = [3] = [5] = {1, 3, 5}, [2] = [4] = {2, 4}.

Equivalence classes partition the set; mod 3 splits Z into three classesEquivalence classes partition the set; mod 3 splits Z into three classes

Theorem-classes form a partition

For an equivalence relation R on A:

  1. a ∈ [a], so no class is empty;
  2. [a] = [b] iff a R b;
  3. two classes are either equal or disjoint.

Hence the distinct classes partition A. Conversely, every partition of A defines an equivalence relation ("in the same block"). So equivalence relations on A correspond one-to-one with partitions of A.

Congruence mod 3 on Z: [0] = {…, −3, 0, 3, 6, …}, [1] = {…, −2, 1, 4, 7, …}, [2] = {…, −1, 2, 5, 8, …}. These are Z₃, used again in Unit III.

3. Closures of Relations

The P-closure of R is the smallest relation containing R that has property P.

ClosureConstructionDigraph view
Reflexive r(R)R ∪ Δ where Δ = {(a, a) : a ∈ A}add every missing loop
Symmetric s(R)R ∪ R⁻¹add every reverse arrow
Transitive t(R) = R⁺R ∪ R² ∪ R³ ∪ … ∪ Rⁿadd an arrow for every path

Example. A = {1, 2, 3}, R = {(1,2),(2,3)}:

  • r(R) = {(1,1),(2,2),(3,3),(1,2),(2,3)}
  • s(R) = {(1,2),(2,1),(2,3),(3,2)}
  • t(R) = {(1,2),(2,3),(1,3)}

Transitive closure via matrix powers

M(R⁺) = M ∨ M[2] ∨ M[3] ∨ … ∨ M[n]
where M[k] is the k-th Boolean power of the matrix M.

Solved. R = {(a,b),(c,b),(d,a),(c,c)} on {a, b, c, d}. M[2] adds (d,b) (d → a → b); higher powers add nothing new. R⁺ = {(a,b),(c,b),(c,c),(d,a),(d,b)}.

4. Warshall's Algorithm

Matrix powers cost O(n⁴). Warshall's algorithm finds R⁺ in O(n³): at step k, allow vertex k as an intermediate.

At step k: let Cₖ = positions with 1 in column k, Rₖ = positions with 1 in row k. Add every pair in Cₖ × Rₖ.

Warshall's algorithm: the four column × row stepsWarshall's algorithm: the four column × row steps

Solved (PYQ). R = {(2,1),(2,3),(3,1),(3,4),(4,1),(4,3)} on {1, 2, 3, 4}.

StepColumn k (Cₖ)Row k (Rₖ)New pairs added
k = 1{2, 3, 4}φnone
k = 2φ{1, 3}none
k = 3{2, 4}{1, 4}(2,4), (4,4)
k = 4{2, 3, 4}{1, 3, 4}(3,3)

R⁺ = {(2,1),(2,3),(2,4),(3,1),(3,3),(3,4),(4,1),(4,3),(4,4)}

TEXT
for k = 1..n
  for i = 1..n
    for j = 1..n
      W[i][j] = W[i][j] OR (W[i][k] AND W[k][j])
💡 Tip

Always re-read row k and column k from the current matrix (after previous steps), not from the original R.

🎯 END-TERM EXAM PREP

📝 IPU End-Term Exam Corner (5-10 Marks)

  • Q1. Prove that congruence modulo m is an equivalence relation and find its equivalence classes for m = 3. (5 Marks)
  • Q2. Show that equivalence classes of an equivalence relation partition the set. (5 Marks)
  • Q3. Use Warshall's algorithm to find the transitive closure of R = {(2,1),(2,3),(3,1),(3,4),(4,1),(4,3)} on {1, 2, 3, 4}. (10 Marks)
  • Q4. Find the reflexive, symmetric and transitive closures of R = {(1,2),(2,3)} on {1, 2, 3}. (5 Marks)