Survey of Mathematics

0.4 Equivalence relations and partitions

When we say two things are "the same for our purposes", we are using an equivalence relation. It always sorts the set into non-overlapping groups (a partition), and each group can then be treated as a single new object.

Beyond the courseCS 240 (relations, if covered; congruence)Hammack, Book of Proof, ch. 11Velleman, How to Prove It, ch. 4.5

In school you were told that 12\tfrac12 and 24\tfrac24 are “the same number”, and that 22 and 77 are “the same” when you only care about remainders on dividing by 55. Each time, two different-looking objects are treated as one. This chapter says exactly when that is legitimate. A rule for “sameness” must satisfy three conditions, and when it does, the objects fall into non-overlapping groups, and the groups can be used as new objects. The groups are how fractions, clock arithmetic and (later) quotient spaces and quotient groups are built.

Before you start

0.3: sets, ordered pairs, functions, and bijections. 0.1 and 0.2 for negation and direct proof. Three quick checks.

Quick checkHow many ordered pairs are in {1,2}×{a,b,c}\{1, 2\} \times \{a, b, c\}?
Quick checkTo DISPROVE 'for all aa and bb: if aa is related to bb then bb is related to aa', what must you give?
Quick checkIs f:Z→Zf: \mathbb Z \to \mathbb Z, f(n)=n+1f(n) = n + 1 a bijection?

The picture

Sort all the integers by their remainder on division by 33. Every integer lands in exactly one row, and no row is empty.

GroupMembers
Remainder 00…,−6,−3,0,3,6,9,…\dots, -6, -3, 0, 3, 6, 9, \dots
Remainder 11…,−5,−2,1,4,7,10,…\dots, -5, -2, 1, 4, 7, 10, \dots
Remainder 22…,−4,−1,2,5,8,11,…\dots, -4, -1, 2, 5, 8, 11, \dots

Two integers are in the same row exactly when they differ by a multiple of 33. That “differ by a multiple of 33” rule is a notion of sameness, and the three rows are the groups it creates. The same picture works for the plane. Call two vectors “the same” when they have equal length, and the groups are circles centred at the origin: every vector lies on exactly one circle, and circles never overlap.

Where this came from· Gauss and the symbol for 'same up to a multiple'

In 1801, in his Disquisitiones Arithmeticae, Carl Friedrich Gauss introduced the notation a≡b(modm)a \equiv b \pmod m for ”mm divides a−ba - b”. His problem was to study the remainders of integers on division by a fixed number, and he needed a short way to say that two integers leave the same remainder. He wrote ≡\equiv rather than == because of the analogy between this relation and equality: it can be added, multiplied and substituted like equality. Over the following century mathematicians saw that many other “sameness” rules behave like this one, and the abstract notion of equivalence relation, with its three conditions, is the common core.

The idea, in words

Why· Why we group things at all

Often a question does not care about every detail of an object. A clock shows 14:0014{:}00 and 22 pm as the same time. A fraction 24\tfrac24 and 12\tfrac12 name the same quantity. A probability question might only care which of the outcomes of two dice have the same sum. Whenever that happens, we want to replace the many objects with one object per group, and compute with groups instead.

That only works if the sameness rule is well behaved. If aa is “the same as” bb, then bb must be the same as aa (otherwise whose view is it?). Everything is the same as itself. And if aa is the same as bb and bb the same as cc, then aa is the same as cc, or the groups would chain and merge. These three conditions are precisely the rules for a group of mutually “same” things to exist.

Definitions and theorems

Definition B

Relation

A relation on a set AA is a subset R⊆A×AR \subseteq A \times A. We write a∼ba \sim b (or a R ba\,R\,b) when (a,b)∈R(a, b) \in R, and say ”aa is related to bb”. For example, on Z\mathbb Z the relation "<<" is the set of all pairs (a,b)(a, b) with aa less than bb.

In one lineA relation on a set AA is a rule that says, for each ordered pair (a,b)(a, b), whether aa is related to bb; formally, a subset of A×AA \times A.

Why it exists'Less than', 'divides', 'is parallel to' and 'has the same remainder as' are all relations; one definition covers them all.

Order matters: a∼ba \sim b and b∼ab \sim a are different claims. Three properties a relation may have are the whole subject. For a relation ∼\sim on AA:

  • Reflexive: ∀a∈A: a∼a\forall a \in A:\ a \sim a. (Everything is related to itself.)
  • Symmetric: ∀a,b∈A: a∼b⇒b∼a\forall a, b \in A:\ a \sim b \Rightarrow b \sim a. (Relatedness goes both ways.)
  • Transitive: ∀a,b,c∈A: (a∼b∧b∼c)⇒a∼c\forall a, b, c \in A:\ (a \sim b \land b \sim c) \Rightarrow a \sim c. (Relatedness chains.)

By the negation rules of 0.1, a relation fails to be reflexive when some aa has a≁aa \not\sim a; fails to be symmetric when some a,ba, b have a∼ba \sim b but b≁ab \not\sim a; and fails to be transitive when some a,b,ca, b, c have a∼ba \sim b and b∼cb \sim c but a≁ca \not\sim c. Each failure is shown by a single counterexample.

Definition B

Equivalence relation

A relation ∼\sim on AA is an equivalence relation if it is reflexive, symmetric and transitive.

In one lineA relation that is reflexive, symmetric and transitive: a valid rule for 'the same for our purposes'.

Why it existsThese three properties are exactly what is needed for things to fall into non-overlapping groups of mutually equivalent objects.

Worked example Hammack 11.2
Which of these relations on Z\mathbb Z are equivalence relations? (i) a∼ba \sim b iff a−ba - b is even. (ii) a∼ba \sim b iff ∣a−b∣≤1\lvert a - b \rvert \le 1. (iii) a∼ba \sim b iff a≤ba \le b.

Solution.

  1. (i) Reflexive. a−a=0=2⋅0a - a = 0 = 2 \cdot 0 is even. Every integer differs from itself by 00.
  2. (i) Symmetric. If a−b=2ka - b = 2k, then b−a=2(−k)b - a = 2(-k) is even. The negative of an even number is even.
  3. (i) Transitive. If a−b=2ka - b = 2k and b−c=2lb - c = 2l, then a−c=(a−b)+(b−c)=2(k+l)a - c = (a - b) + (b - c) = 2(k + l) is even. The telescoping trick: add the two differences. This is a proof for arbitrary a,b,ca, b, c, not for chosen numbers.
  4. (ii) Not transitive. 0∼10 \sim 1 and 1∼21 \sim 2, but ∣0−2∣=2>1\lvert 0 - 2 \rvert = 2 > 1, so 0≁20 \not\sim 2. One counterexample to transitivity is enough. (It is reflexive and symmetric, so only transitivity fails.)
  5. (iii) Not symmetric. 1≤21 \le 2 but 2≰12 \not\le 1. A counterexample to symmetry. It is reflexive and transitive but that is not enough.

Answer. Only (i) is an equivalence relation. The failures in (ii) and (iii) are different, and each needs only one counterexample.

Quick checkOn R\mathbb R, define x∼yx \sim y iff xy≥0xy \ge 0. Which property fails?
Quick checkOn A={1,2,3}A = \{1, 2, 3\} let R={(1,1),(2,2),(1,2),(2,1)}R = \{(1,1), (2,2), (1,2), (2,1)\}. Which property fails?

The same remainder, the same length

Worked example Hammack 11.2
Show that a∼nba \sim_n b iff n∣(a−b)n \mid (a - b) is an equivalence relation on Z\mathbb Z, for a fixed positive integer nn. Then describe the classes for n=5n = 5.

Here n∣mn \mid m (”nn divides mm”) means m=nkm = nk for some integer kk. Chapter 0.5 studies divisibility properly and gives this relation its usual name, congruence mod nn.

Solution.

  1. Reflexive. a−a=0=n⋅0a - a = 0 = n \cdot 0, so n∣(a−a)n \mid (a - a). Zero is a multiple of everything.
  2. Symmetric. If a−b=nka - b = nk then b−a=n(−k)b - a = n(-k). The negative of a multiple of nn is a multiple of nn.
  3. Transitive. If a−b=nka - b = nk and b−c=nlb - c = nl, then a−c=n(k+l)a - c = n(k + l). Add the two equations.
  4. Describe the classes for n=5n = 5. The integers 2,7,12,−3,−8,…2, 7, 12, -3, -8, \dots all differ from 22 by multiples of 55, so they form one group: all numbers of the form 2+5k2 + 5k. There are five such groups, one for each possible remainder 0,1,2,3,40, 1, 2, 3, 4. Two integers are related exactly when they leave the same remainder (0.5 proves this using the division algorithm).

Answer. ∼n\sim_n is an equivalence relation. For n=5n = 5 it sorts Z\mathbb Z into five groups, for example {…,−8,−3,2,7,12,… }\{\dots, -8, -3, 2, 7, 12, \dots\}.

Many sameness rules in mathematics have the shape “the same value of some function”. That shape is always an equivalence relation, and we will see that every equivalence relation has it.

Proposition B

Same value is an equivalence relation

Let f:A→Bf: A \to B be a function. Define a∼fba \sim_f b to mean f(a)=f(b)f(a) = f(b). Then ∼f\sim_f is an equivalence relation on AA.

In one lineFor any function f:A→Bf: A \to B, the relation a∼ba \sim b iff f(a)=f(b)f(a) = f(b) is an equivalence relation on AA.

Why it is trueIt inherits reflexivity, symmetry and transitivity from equality of values in BB.

Proofstandard
The idea: Each property of ~ is the same property of equality, applied to the values f(a), f(b), f(c).
Reflexive: f(a)=f(a)f(a) = f(a), so a∼faa \sim_f a.
Equality is reflexive: any value equals itself.
Symmetric: if f(a)=f(b)f(a) = f(b) then f(b)=f(a)f(b) = f(a), so b∼fab \sim_f a.
Equality is symmetric.
Transitive: if f(a)=f(b)f(a) = f(b) and f(b)=f(c)f(b) = f(c), then f(a)=f(c)f(a) = f(c), so a∼fca \sim_f c.
Equality is transitive.

Examples: on vectors in the plane, f(v)=∥v∥f(v) = \lVert v \rVert gives “same length”, with the circles as groups. On lines in the plane, f(ℓ)=f(\ell) = the direction of ℓ\ell (its angle with the xx-axis, at least 00 and less than π\pi) gives “parallel”, where a line counts as parallel to itself. On Z\mathbb Z, f(a)=f(a) = the remainder of aa on division by nn gives ∼n\sim_n.

Equivalence classes

Definition B

Equivalence class

Let ∼\sim be an equivalence relation on AA. The equivalence class of a∈Aa \in A is [a]={x∈A:x∼a}[a] = \{x \in A : x \sim a\}. An element of a class is called a representative of it. The set of all classes is the quotient set A/∼A / {\sim}.

In one lineThe equivalence class [a][a] of aa is the set of everything related to aa.

Why it existsIt is the 'group' that aa belongs to, and it is the object we compute with when we treat related things as one.

For ∼5\sim_5 on Z\mathbb Z: [2]={…,−8,−3,2,7,12,… }[2] = \{\dots, -8, -3, 2, 7, 12, \dots\} and [7]=[2][7] = [2]: the same class has many names, any of its members. The main fact is that the classes behave as the picture suggests, with no overlaps.

Quick checkFor ∼5\sim_5 on Z\mathbb Z (differ by a multiple of 55), which statement is false?
Lemma B

Equal classes

Let ∼\sim be an equivalence relation on AA and a,b∈Aa, b \in A. The following are equivalent:

  1. a∼ba \sim b;
  2. [a]=[b][a] = [b];
  3. [a]∩[b]≠∅[a] \cap [b] \ne \varnothing.

In one lineFor an equivalence relation, a∼ba \sim b exactly when [a]=[b][a] = [b], exactly when [a][a] and [b][b] share at least one element.

Why it is trueRelatedness lets you move between members of a group without leaving it, so groups that touch are the same group.

ProofHammack Thm 11.1
The idea: Prove 1 implies 2 implies 3 implies 1 in a circle. Each step moves along relations using symmetry and transitivity.
(1 implies 2.) Assume a∼ba \sim b. Let x∈[a]x \in [a], so x∼ax \sim a.
Show [a]⊆[b][a] \subseteq [b] by double inclusion (0.3). Let x∈[a]x \in [a]. By the definition of class, x∼ax \sim a.
Then x∼bx \sim b, so x∈[b]x \in [b]. Hence [a]⊆[b][a] \subseteq [b].
Transitivity applied to x∼ax \sim a and a∼ba \sim b.
Since b∼ab \sim a by symmetry, the same argument gives [b]⊆[a][b] \subseteq [a]. So [a]=[b][a] = [b].
Symmetry turns the assumption a∼ba \sim b into b∼ab \sim a. Now repeat the argument with the roles swapped.
(2 implies 3.) The element aa lies in [a][a] and in [b][b], so [a]∩[b]≠∅[a] \cap [b] \ne \varnothing.
Reflexivity: a∼aa \sim a, so a∈[a]a \in [a]. If [a]=[b][a] = [b], then a∈[b]a \in [b] as well.
Assume the classes share an element zz.
(3 implies 1.) Pick z∈[a]∩[b]z \in [a] \cap [b]. By the definition of class, z∼az \sim a and z∼bz \sim b.
Then a∼ba \sim b.
Symmetry gives a∼za \sim z. Transitivity applied to a∼za \sim z and z∼bz \sim b gives a∼ba \sim b.
Definition B

Partition

A partition of a set AA is a collection of subsets of AA, called blocks, such that:

  1. every block is non-empty;
  2. any two different blocks are disjoint (have no element in common);
  3. every element of AA lies in some block.

Equivalently, every element of AA lies in exactly one block.

In one lineA way of cutting a set into non-empty, non-overlapping pieces (called blocks) that together cover the whole set.

Why it existsIt is the 'sorted into rows' picture, and it is the same information as an equivalence relation.

Quick checkWhich is a partition of {1,2,3}\{1, 2, 3\}?

Now the main theorem. Equivalence relations and partitions are the same thing seen in two ways.

Theorem B Hammack Thm 11.1

Equivalence classes partition the set

If ∼\sim is an equivalence relation on AA, then the set of equivalence classes is a partition of AA.

In one lineThe equivalence classes of an equivalence relation on AA form a partition of AA.

Why it is trueEvery element is in its own class, and two classes that touch are equal.

ProofHammack Thm 11.1
The idea: Check the three conditions of a partition. The first two come from reflexivity and the last is the lemma 'touching classes are equal'.
Every class is non-empty, because a∈[a]a \in [a].
Reflexivity: a∼aa \sim a for every aa, so a∈[a]a \in [a].
Every element of AA lies in some class.
The same fact: each element aa belongs to at least one class, namely its own.
Two classes are either equal or disjoint.
Suppose two classes [a][a] and [b][b] are not disjoint, so [a]∩[b]≠∅[a] \cap [b] \ne \varnothing. The lemma 'equal classes', direction 3 implies 2, then gives [a]=[b][a] = [b].
So any two different classes are disjoint, and the three conditions of a partition hold.
'Two different classes are disjoint' is the contrapositive of the previous line.
Proof workshopRebuild: two equivalence classes are equal or disjoint

Tap the lines in the order a proof would write them. Each line can only use what is already above it.

    The converse also holds: a partition always comes from an equivalence relation.

    Theorem B Hammack Thm 11.2

    Partitions give equivalence relations

    Let P\mathcal P be a partition of AA. Define a∼ba \sim b to mean that aa and bb lie in a common block of P\mathcal P. Then ∼\sim is an equivalence relation on AA, and its equivalence classes are exactly the blocks of P\mathcal P.

    In one lineGiven a partition of AA, 'lying in the same block' is an equivalence relation whose classes are exactly the blocks.

    Why it is trueA partition puts each element in exactly one block, and that is what makes 'same block' reflexive, symmetric and transitive.

    ProofHammack Thm 11.2
    The idea: Reflexivity needs a block for each element, which is the covering condition. Transitivity is where disjointness is used: the middle element b lies in only one block.
    Reflexive: for a∈Aa \in A, aa and aa lie in the same block.
    Every element lies in some block (condition 3 of a partition), and it lies in that block together with itself.
    Symmetric: if a,ba, b lie in a block BB, then b,ab, a lie in BB.
    'Lie in a common block' does not depend on the order of aa and bb.
    Transitive: if a∼ba \sim b and b∼cb \sim c, the two blocks involved both contain bb, so they are the same block BB.
    Say a,b∈B1a, b \in B_1 and b,c∈B2b, c \in B_2. Then b∈B1∩B2b \in B_1 \cap B_2. Blocks are either equal or disjoint (condition 2), and these are not disjoint, so B1=B2B_1 = B_2.
    Hence aa and cc lie in a common block, and a∼ca \sim c.
    Both aa and cc lie in that single block BB.
    The class [a][a] is exactly the block containing aa, so the classes are the blocks.
    Let BB be the block containing aa (exactly one exists). Then x∼ax \sim a iff xx lies in a block with aa, and that block must be BB since aa is in only one block.

    Together these two theorems say that equivalence relations on AA and partitions of AA correspond exactly: from a relation take its classes, from a partition take ‘same block’, and each undoes the other. (Starting from ∼\sim, the new relation says aa and bb are in the same class, which by the lemma holds iff a∼ba \sim b. Starting from a partition, the classes of the new relation are the original blocks.)

    Worked example
    List the classes of 'same remainder on division by 4' on {1,2,…,10}\{1, 2, \dots, 10\} and count the ordered pairs in the relation.

    Solution.

    1. Find each element’s remainder. The remainders of 1,2,…,101, 2, \dots, 10 on division by 44 are 1,2,3,0,1,2,3,0,1,21, 2, 3, 0, 1, 2, 3, 0, 1, 2. Two numbers are related exactly when their remainders match, so the remainder is the label of the class.
    2. Group by remainder. Remainder 11: {1,5,9}\{1, 5, 9\}. Remainder 22: {2,6,10}\{2, 6, 10\}. Remainder 33: {3,7}\{3, 7\}. Remainder 00: {4,8}\{4, 8\}. These four groups are non-empty, disjoint, and cover {1,…,10}\{1, \dots, 10\}, so they form a partition, as the theorem promises.
    3. Count the pairs inside each class. A class of size kk contributes k2k^2 ordered pairs, because every member is related to every member, including itself. So 32+32+22+22=263^2 + 3^2 + 2^2 + 2^2 = 26. Pairs from different classes are never related, so nothing else is counted.

    Answer. Four classes, and 2626 ordered pairs in the relation.

    Your answerOn {1,2,…,10}\{1, 2, \dots, 10\}, how many ordered pairs (a,b)(a, b) are related by 'same remainder on division by 55'?
    Worked example
    List all equivalence relations on {1,2,3}\{1, 2, 3\}.

    Solution.

    1. Translate to partitions. By the correspondence, counting equivalence relations is counting partitions of {1,2,3}\{1, 2, 3\}. Each partition gives exactly one relation, and each relation exactly one partition.
    2. List them by block shapes. One block: {1,2,3}\{1, 2, 3\}. A block of two and a block of one: {1,2}∣{3}\{1, 2\} \mid \{3\}, {1,3}∣{2}\{1, 3\} \mid \{2\}, {2,3}∣{1}\{2, 3\} \mid \{1\}. Three blocks of one: {1}∣{2}∣{3}\{1\} \mid \{2\} \mid \{3\}. Choosing which element is alone gives the three shapes of type 2 + 1.
    3. Count. 1+3+1=51 + 3 + 1 = 5. Sum over the shapes.
    4. Check one relation. The partition {1,2}∣{3}\{1, 2\} \mid \{3\} gives the pairs (1,1),(1,2),(2,1),(2,2),(3,3)(1,1), (1,2), (2,1), (2,2), (3,3), which is 22+12=52^2 + 1^2 = 5 pairs. A block of size kk contributes k2k^2 ordered pairs, since every element of the block is related to every element of the block.

    Answer. There are 55 equivalence relations on a 3-element set. As a cross-check, there are 29=5122^9 = 512 relations on {1,2,3}\{1,2,3\} (each of the 99 ordered pairs is in or out), and exactly 55 of them are reflexive, symmetric and transitive. On a 4-element set there are 1515.

    Your answerHow many equivalence relations on {1,2,3,4}\{1, 2, 3, 4\} have exactly two classes?
    Worked example
    The relation a∼ba \sim b iff a2=b2a^2 = b^2 on Z\mathbb Z is an equivalence relation. Find its classes. Then find a partition of R\mathbb R whose relation is x∼yx \sim y iff ⌊x⌋=⌊y⌋\lfloor x \rfloor = \lfloor y \rfloor.

    Solution.

    1. Recognise the shape. a∼ba \sim b iff f(a)=f(b)f(a) = f(b) for f(a)=a2f(a) = a^2, so it is an equivalence relation by ‘same value is an equivalence relation’. No separate check of the three properties is needed.
    2. Find the classes. [a]={b:b2=a2}={a,−a}[a] = \{b : b^2 = a^2\} = \{a, -a\}. So [0]={0}[0] = \{0\}, [1]={1,−1}[1] = \{1, -1\}, [2]={2,−2}[2] = \{2, -2\}, and so on. b2=a2b^2 = a^2 means b=±ab = \pm a.
    3. Check it is a partition. Every integer is in exactly one of {0},{±1},{±2},…\{0\}, \{\pm 1\}, \{\pm 2\}, \dots. The classes of an equivalence relation always form a partition.
    4. The second relation. Floor ⌊x⌋\lfloor x \rfloor is the greatest integer at most xx. The classes are the intervals [n,n+1)[n, n + 1) for n∈Zn \in \mathbb Z (for example ⌊2.7⌋=2=⌊2.0⌋\lfloor 2.7 \rfloor = 2 = \lfloor 2.0 \rfloor, so 2.7∼2.02.7 \sim 2.0). Same floor means the same integer part, so the numbers lie in the same interval [n,n+1)[n, n+1).

    Answer. The classes of the first are the pairs {a,−a}\{a, -a\} and {0}\{0\}. The intervals [n,n+1)[n, n+1) partition R\mathbb R, and they come from “same floor”.

    Your answerThe relation a∼ba \sim b iff a2=b2a^2 = b^2 is applied to the integers −5,−4,…,4,5-5, -4, \dots, 4, 5. How many equivalence classes are there?
    Worked example
    On R2\mathbb R^2 define (x1,y1)∼(x2,y2)(x_1, y_1) \sim (x_2, y_2) iff y1−2x1=y2−2x2y_1 - 2x_1 = y_2 - 2x_2. Show it is an equivalence relation and describe its classes.

    Solution.

    1. Recognise the shape. Let f(x,y)=y−2xf(x, y) = y - 2x. Then (x1,y1)∼(x2,y2)(x_1, y_1) \sim (x_2, y_2) iff f(x1,y1)=f(x2,y2)f(x_1, y_1) = f(x_2, y_2). The relation is “same value of a function”, so the proposition above gives reflexive, symmetric and transitive at once.
    2. Describe one class. The class of (x0,y0)(x_0, y_0) is {(x,y):y−2x=c}\{(x, y) : y - 2x = c\} where c=y0−2x0c = y_0 - 2x_0. This is the line y=2x+cy = 2x + c of slope 22. A class is everything with the same value of ff.
    3. Check the partition picture. Every point (x,y)(x, y) lies on exactly one such line, the one with c=y−2xc = y - 2x. This is the theorem on classes in action: the lines are non-empty, cover the plane, and never overlap.

    Answer. An equivalence relation whose classes are all the lines of slope 22, one for each real number cc.

    Worked example
    Prove: if ∼\sim and ≈\approx are equivalence relations on AA, then so is R\mathrel{R}, defined by aRba \mathrel R b iff (a∼ba \sim b and a≈ba \approx b).

    Solution. The plan: check the three properties, using the same property of each of the two relations.

    1. Reflexive. For a∈Aa \in A: a∼aa \sim a and a≈aa \approx a, so aRaa \mathrel R a. Both relations are reflexive.
    2. Symmetric. If aRba \mathrel R b then a∼ba \sim b and a≈ba \approx b. So b∼ab \sim a and b≈ab \approx a, that is bRab \mathrel R a. Both relations are symmetric, and we apply that to each half of the “and”.
    3. Transitive. If aRba \mathrel R b and bRcb \mathrel R c, then a∼ba \sim b, b∼cb \sim c, a≈ba \approx b, b≈cb \approx c. So a∼ca \sim c and a≈ca \approx c, that is aRca \mathrel R c. Transitivity of ∼\sim gives the first, and transitivity of ≈\approx gives the second.

    Answer. R\mathrel R is an equivalence relation. The same argument fails for “or” in place of “and”, because transitivity needs the chain a∼ba \sim b, b≈cb \approx c to give something.

    A function is a bijection from its classes to its range

    Every equivalence relation is a “same value” relation: the function π:A→A/∼\pi: A \to A / {\sim}, π(a)=[a]\pi(a) = [a], has π(a)=π(b)\pi(a) = \pi(b) iff [a]=[b][a] = [b] iff a∼ba \sim b by the lemma. The reverse is the next theorem, and it is the set-level shadow of three results later in the book: rank–nullity (2.3), isomorphism theorems (541), and quotient topology (551).

    Theorem B

    A function is a bijection from its classes onto its range

    Let f:A→Bf: A \to B and let ∼\sim be ‘same value’. Then fˉ:A/∼→f(A)\bar f: A / {\sim} \to f(A), fˉ([a])=f(a)\bar f([a]) = f(a), is a well-defined bijection.

    In one lineFor f:A→Bf: A \to B with a∼ba \sim b iff f(a)=f(b)f(a) = f(b), the rule [a]↦f(a)[a] \mapsto f(a) is a well-defined bijection from A/∼A / {\sim} onto the range f(A)f(A).

    Why it is trueGrouping the inputs that ff cannot tell apart leaves exactly one group per output.

    Proofstandard
    The idea: Well-defined: the output must not depend on which representative you use. Injective and surjective are both quick.
    Well-defined: if [a]=[a′][a] = [a'], then a∼a′a \sim a' by the lemma, so f(a)=f(a′)f(a) = f(a'). The value fˉ([a])\bar f([a]) does not depend on the representative.
    A rule defined using a representative is a legitimate function only if a different representative of the same class gives the same answer. This is the check that matters whenever we define something on classes.
    Injective: if fˉ([a])=fˉ([a′])\bar f([a]) = \bar f([a']), then f(a)=f(a′)f(a) = f(a').
    Template for injective: assume equal outputs.
    So a∼a′a \sim a', hence [a]=[a′][a] = [a'].
    That says a∼a′a \sim a', and then the lemma gives equal classes.
    Surjective: if y∈f(A)y \in f(A), then y=f(a)y = f(a) for some aa, and y=fˉ([a])y = \bar f([a]).
    Template for surjective onto the range: every element of f(A)f(A) has the form f(a)f(a).

    Fractions as classes

    Here is the example the whole chapter was building toward, and it answers the question “why is 12=24\tfrac12 = \tfrac24?” The answer is a definition that we choose, and no fact about numbers is discovered.

    Start with the set A=Z×(Z∖{0})A = \mathbb Z \times (\mathbb Z \setminus \{0\}) of pairs (a,b)(a, b) (“the numerator aa over the denominator bb”). We want (1,2)(1, 2) and (2,4)(2, 4) to count as the same. The school rule says ab=cd\tfrac ab = \tfrac cd when ad=bcad = bc (cross-multiplication). Define

    (a,b)∼(c,d)iffad=bc.(a, b) \sim (c, d) \quad\text{iff}\quad ad = bc.
    Worked example Hammack 11.2
    Show that (a,b)∼(c,d)(a, b) \sim (c, d) iff ad=bcad = bc is an equivalence relation on Z×(Z∖{0})\mathbb Z \times (\mathbb Z \setminus \{0\}), and explain why 12=24\tfrac12 = \tfrac24.

    Solution.

    1. Reflexive. (a,b)∼(a,b)(a, b) \sim (a, b) because ab=baab = ba. Multiplication of integers is commutative.
    2. Symmetric. If ad=bcad = bc, then cb=dacb = da, which says (c,d)∼(a,b)(c, d) \sim (a, b). Swap the sides of the equation and reorder the products.
    3. Transitive, setting up. Suppose (a,b)∼(c,d)(a, b) \sim (c, d) and (c,d)∼(e,f)(c, d) \sim (e, f), so ad=bcad = bc and cf=decf = de. We must show af=beaf = be. That is what (a,b)∼(e,f)(a, b) \sim (e, f) means.
    4. Transitive, the algebra. Multiply the first equation by ff to get adf=bcfadf = bcf. Now bcf=b(cf)=b(de)bcf = b(cf) = b(de) by the second equation. So d(af)=d(be)d(af) = d(be). Two substitutions chain the equations together. The middle pair (c,d)(c, d) drops out.
    5. Cancel. Since d≠0d \ne 0, we may cancel dd and get af=beaf = be. In Z\mathbb Z, a product dx=dydx = dy with d≠0d \ne 0 forces x=yx = y. This is where “denominator not zero” is used, and why transitivity would fail if (0,0)(0, 0) were allowed.
    6. The meaning. (1,2)∼(2,4)(1, 2) \sim (2, 4) because 1⋅4=2⋅21 \cdot 4 = 2 \cdot 2. By the lemma on equal classes, [(1,2)]=[(2,4)][(1, 2)] = [(2, 4)]. The lemma says related pairs have equal classes.

    Answer. ∼\sim is an equivalence relation. A rational number ab\tfrac ab is, by definition, the class [(a,b)][(a, b)], so 12\tfrac12 and 24\tfrac24 are two names for one class. The statement "12=24\tfrac12 = \tfrac24" is the statement (1,2)∼(2,4)(1,2) \sim (2,4), which is true.

    Proof workshopRebuild: transitivity of the fraction relation

    Tap the lines in the order a proof would write them. Each line can only use what is already above it.

      Your answerUnder the rule (a,b)∼(c,d)(a, b) \sim (c, d) iff ad=bcad = bc, the pair (3,5)(3, 5) is related to (x,20)(x, 20). What is xx?

      Once rational numbers are classes, arithmetic on them must be defined using representatives, and then we must check the result does not depend on which representatives we picked. This is exactly the well-definedness check of the previous theorem.

      Worked example
      Define [(a,b)]+[(c,d)]=[(ad+bc, bd)][(a, b)] + [(c, d)] = [(ad + bc,\ bd)]. Show that the sum does not depend on the representatives.

      Solution.

      1. State what must be shown. Suppose (a,b)∼(a′,b′)(a, b) \sim (a', b'), that is ab′=a′bab' = a'b. We must show (ad+bc, bd)∼(a′d+b′c, b′d)(ad + bc,\ bd) \sim (a'd + b'c,\ b'd). If we replace one summand by another name for the same class, the answer must name the same class.
      2. Write out what the relation requires. We need (ad+bc)(b′d)=(a′d+b′c)(bd)(ad + bc)(b'd) = (a'd + b'c)(bd). This is the cross-multiplication rule for the two answers. Denominators bdbd and b′db'd are nonzero since a product of nonzero integers is nonzero.
      3. Expand the left side. (ad+bc)(b′d)=ab′d2+bb′cd(ad + bc)(b'd) = ab'd^2 + bb'cd. Distribute.
      4. Expand the right side. (a′d+b′c)(bd)=a′bd2+bb′cd(a'd + b'c)(bd) = a'bd^2 + bb'cd. Distribute.
      5. Compare. The terms bb′cdbb'cd are identical, and ab′d2=a′bd2ab'd^2 = a'bd^2 because ab′=a′bab' = a'b. This is the only place the hypothesis is used.

      Answer. The sum is well defined in the first summand. The formula is symmetric in the two summands (swapping them gives (cb+da, db)(cb + da,\ db), which is the same pair because addition and multiplication of integers are commutative), so it is well defined in the second summand too. Multiplication [(a,b)][(c,d)]=[(ac,bd)][(a,b)][(c,d)] = [(ac, bd)] is checked the same way, and is shorter: ab′=a′bab' = a'b gives (ac)(b′d)=(a′c)(bd)(ac)(b'd) = (a'c)(bd) by multiplying both sides by cdcd.

      Why· The picture behind 'well-defined'

      A class is a room with many doors (its representatives). A rule on classes that is stated using a door must give the same answer whichever door you use. If you define g([a])g([a]) as “the number of letters in the word the fraction is written with”, the rule is nonsense, because 12\tfrac12 and 24\tfrac24 are the same class with different numbers of digits. The check in the previous example is the proof that addition is not like that.

      Quick checkDefine g:Q→Zg: \mathbb Q \to \mathbb Z by g(ab)=a+bg(\tfrac ab) = a + b. Is gg well defined?

      Where it is used

      Used inside maths· Inside maths: quotient objects, and building number systems

      Declaring things equivalent and passing to classes is one of the main constructions in mathematics. The integers can be built from pairs of counting numbers (a,b)(a, b) meaning "a−ba - b", with (a,b)∼(c,d)(a, b) \sim (c, d) iff a+d=b+ca + d = b + c. The real numbers can be built as classes of sequences of rationals that get arbitrarily close, where two sequences are equivalent when their difference tends to 00. The next chapter turns the relation ∼n\sim_n into the number system Zn\mathbb Z_n. In linear algebra (chapter 3.7) a subspace WW of VV defines v∼wv \sim w iff v−w∈Wv - w \in W, and the classes form the quotient space V/WV / W. The theorem above, with ff a linear map and WW its null space, becomes V/N(T)≅T(V)V / N(T) \cong T(V), which is rank–nullity in disguise. Quotient groups G/HG / H (MATH 541) use the same recipe with a subgroup HH.

      A preview· Preview: a plane modulo a line

      In R2\mathbb R^2 let WW be the line y=0y = 0 (the xx-axis), and say v∼wv \sim w iff v−wv - w lies on WW. Two vectors are related when they have the same yy-coordinate, so the classes are the horizontal lines, and the quotient R2/W\mathbb R^2 / W is “the set of horizontal lines”, which can be labelled by one number, the height. The plane has dimension 22, the line has dimension 11, and the quotient has dimension 2−1=12 - 1 = 1. This is the picture behind chapter 3.7.

      Used in the real world· Computer science: union-find, state minimisation, normalisation

      The data structure union-find (disjoint sets) maintains a partition of {1,…,N}\{1, \dots, N\} under two operations, “merge the classes of ii and jj” and “are ii and jj in the same class?”. Start with 8 elements, each alone: eight classes. After merging 1,21,2, then 3,43,4, then 2,42,4, then 5,65,6, the classes are {1,2,3,4}\{1,2,3,4\}, {5,6}\{5,6\}, {7}\{7\}, {8}\{8\}: four classes of sizes 4,2,1,14, 2, 1, 1, and 42+22+1+1=224^2 + 2^2 + 1 + 1 = 22 related ordered pairs. Kruskal’s algorithm for a minimum spanning tree adds an edge only if its endpoints are in different classes, which stops it from creating a cycle. Type inference in compilers uses the same structure to merge type variables that must be equal. The minimal automaton of a regular language is built by merging states that no input string can tell apart, which is an equivalence relation on states (the Myhill and Nerode theorem describes these classes). Even email follows the pattern: Gmail ignores dots in the part before the @, so first.last and firstlast at gmail.com are equivalent addresses and name one inbox.

      Traps

      Watch out· Symmetric and transitive do not give reflexive

      The tempting “proof” is: if a∼ba \sim b then b∼ab \sim a, and then a∼ba \sim b with b∼ab \sim a gives a∼aa \sim a. It assumes aa has some bb to be related to. On A={1,2}A = \{1, 2\} take only the pair (1,1)(1, 1): it is symmetric and transitive, but 2≁22 \not\sim 2. Always check reflexivity separately.

      Watch out· Classes never partly overlap

      Two equivalence classes are equal or disjoint. If you find a relation where two groups share some elements but not all, then it is not transitive (or not symmetric), and it is not an equivalence relation. The relation ∣a−b∣≤1|a - b| \le 1 in the first example is exactly like that.

      Watch out· A rule on classes must be checked for well-definedness

      Whenever you define a function on classes using a representative, show the answer does not depend on the choice. The sum of fractions passes. “Numerator plus denominator” does not.

      Watch out· Many names for one class

      [2]=[7]=[−3][2] = [7] = [-3] for ∼5\sim_5. Writing [2]≠[7][2] \ne [7] is a mistake. The fraction 12\tfrac12 is not “the” pair (1,2)(1, 2) but the whole class, and (2,4)(2, 4) is another name for it.

      Watch out· 'Parallel' needs a definition that includes equal lines

      If “parallel” means “never meets”, a line is not parallel to itself, so reflexivity fails. Define ℓ∥m\ell \parallel m as “equal, or never meeting” (equivalently “same direction”) and it becomes an equivalence relation.

      Problems

      check

      Is ”aa divides bb” an equivalence relation on the positive integers? Prove or give a counterexample for each property.

      Solution

      Reflexive: a=a⋅1a = a \cdot 1, so a∣aa \mid a. Transitive: if b=akb = ak and c=blc = bl then c=a(kl)c = a(kl). Not symmetric: 2∣42 \mid 4 but 4∤24 \nmid 2. So it is not an equivalence relation.

      check

      On R\mathbb R let x∼yx \sim y iff x−y∈Zx - y \in \mathbb Z. Is it an equivalence relation? Describe [0.3][0.3].

      Solution

      Reflexive: x−x=0∈Zx - x = 0 \in \mathbb Z. Symmetric: if x−y∈Zx - y \in \mathbb Z then y−x∈Zy - x \in \mathbb Z. Transitive: (x−y)+(y−z)=x−z(x - y) + (y - z) = x - z, a sum of integers. Yes. [0.3]={0.3+k:k∈Z}={…,−1.7,−0.7,0.3,1.3,2.3,… }[0.3] = \{0.3 + k : k \in \mathbb Z\} = \{\dots, -1.7, -0.7, 0.3, 1.3, 2.3, \dots\}. Each class has exactly one member in [0,1)[0, 1).

      check

      Which of these are partitions of {1,2,3,4}\{1, 2, 3, 4\}? (a) {1,3},{2,4}\{1, 3\}, \{2, 4\}. (b) {1,2,3},{3,4}\{1, 2, 3\}, \{3, 4\}. (c) {1},{2},{3}\{1\}, \{2\}, \{3\}.

      Solution

      (a) Yes. (b) No: 33 lies in two blocks. (c) No: 44 lies in no block.

      use

      List the classes of “same remainder on division by 44” on {1,2,…,10}\{1, 2, \dots, 10\}, and count the ordered pairs in the relation.

      Solution

      Classes: {1,5,9}\{1, 5, 9\}, {2,6,10}\{2, 6, 10\}, {3,7}\{3, 7\}, {4,8}\{4, 8\}. A block of size kk gives k2k^2 ordered pairs, so 9+9+4+4=269 + 9 + 4 + 4 = 26 pairs.

      use

      On R2\mathbb R^2 define (x1,y1)∼(x2,y2)(x_1, y_1) \sim (x_2, y_2) iff x1+y1=x2+y2x_1 + y_1 = x_2 + y_2. Show it is an equivalence relation and describe the classes geometrically.

      Solution

      It is “same value” for f(x,y)=x+yf(x, y) = x + y, so it is an equivalence relation by the proposition. The class of (x0,y0)(x_0, y_0) is the line x+y=x0+y0x + y = x_0 + y_0, a line of slope −1-1. The classes are all the lines of slope −1-1, one for each value of x+yx + y, and they partition the plane.

      use

      Show that multiplication [(a,b)]⋅[(c,d)]=[(ac,bd)][(a,b)] \cdot [(c,d)] = [(ac, bd)] of fractions is well defined in the first factor.

      Solution

      Suppose (a,b)∼(a′,b′)(a, b) \sim (a', b'), so ab′=a′bab' = a'b. We need (ac,bd)∼(a′c,b′d)(ac, bd) \sim (a'c, b'd), that is (ac)(b′d)=(a′c)(bd)(ac)(b'd) = (a'c)(bd). The left side is (ab′)cd(ab')cd and the right side is (a′b)cd(a'b)cd, equal because ab′=a′bab' = a'b. Also bd≠0bd \ne 0 and b′d≠0b'd \ne 0 since the integers are nonzero.

      prove

      Let ∼\sim and ≈\approx be equivalence relations on AA, and let aRba \mathrel{R} b mean (a∼ba \sim b and a≈ba \approx b), an equivalence relation by the worked example. Prove that [a]R=[a]∼∩[a]≈[a]_R = [a]_\sim \cap [a]_\approx. Then deduce: if ∼\sim has 33 classes and ≈\approx has 22 classes, then RR has at most 66 classes.

      Solution

      For the classes: x∈[a]Rx \in [a]_R iff xRax \mathrel R a iff (x∼ax \sim a and x≈ax \approx a) iff (x∈[a]∼x \in [a]_\sim and x∈[a]≈x \in [a]_\approx) iff x∈[a]∼∩[a]≈x \in [a]_\sim \cap [a]_\approx. For the count, every class of RR is C∩DC \cap D for one of the 33 classes CC of ∼\sim and one of the 22 classes DD of ≈\approx, and there are only 3⋅2=63 \cdot 2 = 6 such choices. Some of the intersections may be empty, which is why the number of classes can be smaller than 66.

      prove

      Give an example of two equivalence relations whose union is not an equivalence relation.

      Solution

      On {1,2,3}\{1, 2, 3\} take ∼\sim with the single nontrivial pair 1∼21 \sim 2 (blocks {1,2},{3}\{1,2\}, \{3\}) and ≈\approx with 2≈32 \approx 3 (blocks {1},{2,3}\{1\}, \{2,3\}). The union contains 1∼21 \sim 2 and 2≈32 \approx 3 but not (1,3)(1, 3), so it is not transitive. Intersections (the worked example above) are safe, unions are not.

      prove

      Let AA be a finite set and ∼\sim an equivalence relation in which every class has exactly kk elements. Prove that ∣A∣=k⋅m\lvert A \rvert = k \cdot m, where mm is the number of classes.

      Solution

      The mm classes form a partition of AA, so each element lies in exactly one class. Counting the elements of AA class by class counts each element once, and each class contributes kk. So ∣A∣=k+k+⋯+k=km\lvert A \rvert = k + k + \dots + k = km. The disjointness of the classes is what prevents double counting, and covering is what prevents missing elements. (This is the idea behind Lagrange’s theorem in MATH 541.)

      prove

      Prove that (a,b)∼(c,d)(a, b) \sim (c, d) iff a+d=b+ca + d = b + c is an equivalence relation on N×N\mathbb N \times \mathbb N (the relation used to build the integers). Which pairs are related to (1,3)(1, 3), and what integer should [(1,3)][(1, 3)] be?

      Solution

      Reflexive: a+b=b+aa + b = b + a. Symmetric: if a+d=b+ca + d = b + c then c+b=d+ac + b = d + a, which says (c,d)∼(a,b)(c, d) \sim (a, b). Transitive: if a+d=b+ca + d = b + c and c+f=d+ec + f = d + e, add: a+d+c+f=b+c+d+ea + d + c + f = b + c + d + e; cancel c+dc + d to get a+f=b+ea + f = b + e. The pairs related to (1,3)(1, 3) are those with 1+d=3+c1 + d = 3 + c, that is d=c+2d = c + 2: (1,3),(2,4),(3,5),…(1, 3), (2, 4), (3, 5), \dots. The class should be the integer 1−3=−21 - 3 = -2, since a−ba - b is the same for every pair in it.

      stretch

      Count the equivalence relations on a set with 44 elements by listing partitions by block sizes. Check with your answer for 33 elements.

      Solution

      Block shapes: 44: 11 way. 3+13 + 1: choose the single element, 44 ways. 2+22 + 2: split into two pairs, 33 ways ({12∣34}\{12|34\}, {13∣24}\{13|24\}, {14∣23}\{14|23\}). 2+1+12 + 1 + 1: choose the pair, (42)=6\binom42 = 6 ways. 1+1+1+11 + 1 + 1 + 1: 11 way. Total 1+4+3+6+1=151 + 4 + 3 + 6 + 1 = 15. For 33 elements the shapes are 33 (1 way), 2+12 + 1 (3 ways), 1+1+11 + 1 + 1 (1 way): 55, matching the earlier example.

      stretch

      On R\mathbb R define x∼yx \sim y iff x−y∈Qx - y \in \mathbb Q. Show it is an equivalence relation, show every class is countable, and use the uncountability of R\mathbb R to show there are uncountably many classes.

      Solution

      Equivalence: x−x=0∈Qx - x = 0 \in \mathbb Q; if x−y∈Qx - y \in \mathbb Q so is y−xy - x; and x−z=(x−y)+(y−z)x - z = (x - y) + (y - z) is a sum of rationals. The class of xx is x+Q={x+q:q∈Q}x + \mathbb Q = \{x + q : q \in \mathbb Q\}, and the function q↦x+qq \mapsto x + q is a bijection from Q\mathbb Q onto it, so the class is countable. Suppose there were only countably many classes. Choose one representative rkr_k from the kkth class of a list of the classes, and list Q\mathbb Q as q1,q2,…q_1, q_2, \dots. Every real number lies in some class, so it equals rk+qnr_k + q_n for some k,nk, n. So (k,n)↦rk+qn(k, n) \mapsto r_k + q_n is a function from the countable set N×N\mathbb N \times \mathbb N onto R\mathbb R, and R\mathbb R would be countable by closure property 2 of chapter 0.3. That is false, so there are uncountably many classes. (This relation is the starting point of the Vitali set in measure theory.)

      Summary

      • A relation on AA is a subset of A×AA \times A. It is an equivalence relation if it is reflexive, symmetric and transitive. Each property is disproved by one counterexample.
      • The equivalence class [a][a] is everything related to aa. The lemma: a∼ba \sim b iff [a]=[b][a] = [b] iff the classes share an element.
      • Therefore the classes are non-empty, cover AA, and are equal or disjoint: they form a partition. Conversely, “same block” for any partition is an equivalence relation. The two notions are the same information.
      • “Same value of a function” is always an equivalence relation, and [a]↦f(a)[a] \mapsto f(a) is a bijection from the classes onto the range.
      • A rule defined on classes using a representative must be checked to be well defined. Addition of fractions passes.
      • A fraction ab\tfrac ab is the class of the pair (a,b)(a, b) under ad=bcad = bc, so 12=24\tfrac12 = \tfrac24 is a definition, not a discovery.
      • Seeds: Zn\mathbb Z_n (0.5), quotient spaces (3.7), quotient groups (541).

      Watch and read

      The same ideas explained by someone else. Use these when an explanation here does not land.

      Where this sits

      Comes from
      0.1 How to read a theorem
      0.3 Sets, functions, and counting infinity
      Leads to
      0.5 Integers mod n, gcd and Bézout
      3.7 Dual spaces and quotient spaces
      Same idea elsewhere
      CS 240: The equality of fractions, 'same remainder mod n' and graph connectivity are all equivalence relations. CS 240 used these ideas without the name; this chapter names them and proves the one theorem that makes them useful.
      MATH 431: Outcomes that the question cannot tell apart are grouped into one event. That grouping is a partition of the sample space, and a random variable partitions the space by its value.
      MATH 541: A quotient group is the set of equivalence classes of the relation 'a and b differ by an element of the subgroup'. This chapter is the set-level version of that construction.
      MATH 551: A circle is a segment with its two ends declared equivalent; a torus is a square with opposite sides identified. These 'gluing' constructions are quotient spaces.