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 21 and 42 are “the same number”, and that 2 and 7 are “the same” when you only care about remainders on dividing by 5. 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}?
An ordered pair picks one element from each set: 2 choices for the first coordinate times 3 for the second is 6. The count 5 is the size of the union of the sets (if they were disjoint), and 8 is 23, which counts something else.Review: Cartesian product
Quick checkTo DISPROVE 'for all a and b: if a is related to b then b is related to a', what must you give?
The negation of 'for all, if P then Q' is 'there exist a, b with P and not Q'. A single counterexample of that shape disproves it. Examples where it works prove nothing.Review: rules for negating
Quick checkIs f:Z→Z, f(n)=n+1 a bijection?
If n+1=m+1 then n=m, so f is injective. And every b is hit by n=b−1, which is an integer, so f is surjective. The inverse is n↦n−1.Review: bijective
The picture
Sort all the integers by their remainder on division by 3. Every integer lands in exactly one row, and no row is empty.
Group
Members
Remainder 0
…,−6,−3,0,3,6,9,…
Remainder 1
…,−5,−2,1,4,7,10,…
Remainder 2
…,−4,−1,2,5,8,11,…
Two integers are in the same row exactly when they differ by a multiple of 3. That “differ by a multiple of 3” 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) for ”m divides a−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 ≡ 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:00 and 2 pm as the same time. A fraction 42 and 21 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 a is “the same as” b, then b must be the same as a (otherwise whose view is it?). Everything is the same as itself. And if a is the same as b and b the same as c, then a is the same as c, 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 A is a subset R⊆A×A. We write a∼b (or aRb) when (a,b)∈R, and say ”a is related to b”. For example, on Z the relation "<" is the set of all pairs (a,b) with a less than b.
In one lineA relation on a set A is a rule that says, for each ordered pair (a,b), whether a is related to b; formally, a subset of A×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∼b and b∼a are different claims. Three properties a relation may have are the whole subject. For a relation ∼ on A:
Reflexive:∀a∈A:a∼a. (Everything is related to itself.)
Symmetric:∀a,b∈A:a∼b⇒b∼a. (Relatedness goes both ways.)
By the negation rules of 0.1, a relation fails to be reflexive when some a has a∼a; fails to be symmetric when some a,b have a∼b but b∼a; and fails to be transitive when some a,b,c have a∼b and b∼c but a∼c. Each failure is shown by a single counterexample.
Definition B
Equivalence relation
A relation ∼ on A 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 are equivalence relations? (i) a∼b iff a−b is even. (ii) a∼b iff ∣a−b∣≤1. (iii) a∼b iff a≤b.
Solution.
(i) Reflexive.a−a=0=2⋅0 is even. Every integer differs from itself by 0.
(i) Symmetric. If a−b=2k, then b−a=2(−k) is even. The negative of an even number is even.
(i) Transitive. If a−b=2k and b−c=2l, then 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,c, not for chosen numbers.
(ii) Not transitive.0∼1 and 1∼2, but ∣0−2∣=2>1, so 0∼2. One counterexample to transitivity is enough. (It is reflexive and symmetric, so only transitivity fails.)
(iii) Not symmetric.1≤2 but 2≤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, define x∼y iff xy≥0. Which property fails?
xx=x2≥0, so it is reflexive, and xy=yx makes it symmetric. But 1∼0 (since 1⋅0=0≥0) and 0∼−1, while 1⋅(−1)=−1<0, so 1∼−1. The element 0 is related to everything and links the positives to the negatives.
Quick checkOn A={1,2,3} let R={(1,1),(2,2),(1,2),(2,1)}. Which property fails?
Reflexive needs (3,3)∈R and it is missing, so 3∼3. Symmetric holds because (1,2) and (2,1) both appear, and transitive holds because the only chains stay inside {1,2}. Elements that are related to nothing are the usual way reflexivity fails.
The same remainder, the same length
Worked example Hammack 11.2
Show that a∼nb iff n∣(a−b) is an equivalence relation on Z, for a fixed positive integer n. Then describe the classes for n=5.
Here n∣m (”n divides m”) means m=nk for some integer k. Chapter 0.5 studies divisibility properly and gives this relation its usual name, congruence mod n.
Solution.
Reflexive.a−a=0=n⋅0, so n∣(a−a). Zero is a multiple of everything.
Symmetric. If a−b=nk then b−a=n(−k). The negative of a multiple of n is a multiple of n.
Transitive. If a−b=nk and b−c=nl, then a−c=n(k+l). Add the two equations.
Describe the classes for n=5. The integers 2,7,12,−3,−8,… all differ from 2 by multiples of 5, so they form one group: all numbers of the form 2+5k. There are five such groups, one for each possible remainder 0,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 is an equivalence relation. For n=5 it sorts Z into five groups, for example {…,−8,−3,2,7,12,…}.
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→B be a function. Define a∼fb to mean f(a)=f(b). Then ∼f is an equivalence relation on A.
In one lineFor any function f:A→B, the relation a∼b iff f(a)=f(b) is an equivalence relation on A.
Why it is trueIt inherits reflexivity, symmetry and transitivity from equality of values in B.
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), so a∼fa.
Equality is reflexive: any value equals itself.
Symmetric: if f(a)=f(b) then f(b)=f(a), so b∼fa.
Equality is symmetric.
Transitive: if f(a)=f(b) and f(b)=f(c), then f(a)=f(c), so a∼fc.
Equality is transitive.
Examples: on vectors in the plane, f(v)=∥v∥ gives “same length”, with the circles as groups. On lines in the plane, f(ℓ)= the direction of ℓ (its angle with the x-axis, at least 0 and less than π) gives “parallel”, where a line counts as parallel to itself. On Z, f(a)= the remainder of a on division by n gives ∼n.
Equivalence classes
Definition B
Equivalence class
Let ∼ be an equivalence relation on A. The equivalence class of a∈A is [a]={x∈A:x∼a}. An element of a class is called a representative of it. The set of all classes is the quotient setA/∼.
In one lineThe equivalence class [a] of a is the set of everything related to a.
Why it existsIt is the 'group' that a belongs to, and it is the object we compute with when we treat related things as one.
For ∼5 on Z: [2]={…,−8,−3,2,7,12,…} and [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 on Z (differ by a multiple of 5), which statement is false?
7−2=5 and −3−2=−5 are multiples of 5, so [7] and [−3] are other names for [2]. But 3−2=1 is not a multiple of 5, so [3] is a different class. Five classes in all: [0],[1],[2],[3],[4].
Lemma B
Equal classes
Let ∼ be an equivalence relation on A and a,b∈A. The following are equivalent:
a∼b;
[a]=[b];
[a]∩[b]=∅.
In one lineFor an equivalence relation, a∼b exactly when [a]=[b], exactly when [a] and [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∼b. Let x∈[a], so x∼a.
Show [a]⊆[b] by double inclusion (0.3). Let x∈[a]. By the definition of class, x∼a.
Then x∼b, so x∈[b]. Hence [a]⊆[b].
Transitivity applied to x∼a and a∼b.
Since b∼a by symmetry, the same argument gives [b]⊆[a]. So [a]=[b].
Symmetry turns the assumption a∼b into b∼a. Now repeat the argument with the roles swapped.
(2 implies 3.) The element a lies in [a] and in [b], so [a]∩[b]=∅.
Reflexivity: a∼a, so a∈[a]. If [a]=[b], then a∈[b] as well.
Assume the classes share an element z.
(3 implies 1.) Pick z∈[a]∩[b]. By the definition of class, z∼a and z∼b.
Then a∼b.
Symmetry gives a∼z. Transitivity applied to a∼z and z∼b gives a∼b.
Definition B
Partition
A partition of a set A is a collection of subsets of A, called blocks, such that:
every block is non-empty;
any two different blocks are disjoint (have no element in common);
every element of A lies in some block.
Equivalently, every element of A 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}?
In the first, 2 lies in two blocks (they overlap). In the third, the empty set is not allowed as a block (and 3 is missing). The second covers every element exactly once.
Now the main theorem. Equivalence relations and partitions are the same thing seen in two ways.
Theorem BHammack Thm 11.1
Equivalence classes partition the set
If ∼ is an equivalence relation on A, then the set of equivalence classes is a partition of A.
In one lineThe equivalence classes of an equivalence relation on A form a partition of A.
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].
Reflexivity: a∼a for every a, so a∈[a].
Every element of A lies in some class.
The same fact: each element a belongs to at least one class, namely its own.
Two classes are either equal or disjoint.
Suppose two classes [a] and [b] are not disjoint, so [a]∩[b]=∅. The lemma 'equal classes', direction 3 implies 2, then gives [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.
We assume the classes overlap and show they must then be the same. This proves 'equal or disjoint'.
This is what it means for z to be in [a] and in [b].
First pick the element z that lies in both classes.
Symmetry reverses the first relation; transitivity chains it with the second.
You need z∼a and z∼b from the previous line.
Transitivity again, now with an arbitrary member x of the first class.
This uses a∼b, which was derived in the previous line.
The roles of a and b can be swapped because the relation is symmetric.
The swapped argument copies the one just made, so it must come after it.
Double inclusion: each class is a subset of the other.
Equality needs both inclusions.
The converse also holds: a partition always comes from an equivalence relation.
Theorem BHammack Thm 11.2
Partitions give equivalence relations
Let P be a partition of A. Define a∼b to mean that a and b lie in a common block of P. Then ∼ is an equivalence relation on A, and its equivalence classes are exactly the blocks of P.
In one lineGiven a partition of A, '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∈A, a and a 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,b lie in a block B, then b,a lie in B.
'Lie in a common block' does not depend on the order of a and b.
Transitive: if a∼b and b∼c, the two blocks involved both contain b, so they are the same block B.
Say a,b∈B1 and b,c∈B2. Then b∈B1∩B2. Blocks are either equal or disjoint (condition 2), and these are not disjoint, so B1=B2.
Hence a and c lie in a common block, and a∼c.
Both a and c lie in that single block B.
The class [a] is exactly the block containing a, so the classes are the blocks.
Let B be the block containing a (exactly one exists). Then x∼a iff x lies in a block with a, and that block must be B since a is in only one block.
Together these two theorems say that equivalence relations on A and partitions of A correspond exactly: from a relation take its classes, from a partition take ‘same block’, and each undoes the other. (Starting from ∼, the new relation says a and b are in the same class, which by the lemma holds iff a∼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} and count the ordered pairs in the relation.
Solution.
Find each element’s remainder. The remainders of 1,2,…,10 on division by 4 are 1,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.
Group by remainder. Remainder 1: {1,5,9}. Remainder 2: {2,6,10}. Remainder 3: {3,7}. Remainder 0: {4,8}. These four groups are non-empty, disjoint, and cover {1,…,10}, so they form a partition, as the theorem promises.
Count the pairs inside each class. A class of size k contributes k2 ordered pairs, because every member is related to every member, including itself. So 32+32+22+22=26. Pairs from different classes are never related, so nothing else is counted.
Answer. Four classes, and 26 ordered pairs in the relation.
Your answerOn {1,2,…,10}, how many ordered pairs (a,b) are related by 'same remainder on division by 5'?
Find the classes first, then count k2 for a class of size k.
Each remainder 0,1,2,3,4 is shared by exactly two numbers ({5,10}, {1,6}, and so on), so there are 5 classes of size 2. Each contributes 22=4 ordered pairs, and 5⋅4=20.
Worked example
List all equivalence relations on {1,2,3}.
Solution.
Translate to partitions. By the correspondence, counting equivalence relations is counting partitions of {1,2,3}. Each partition gives exactly one relation, and each relation exactly one partition.
List them by block shapes. One block: {1,2,3}. A block of two and a block of one: {1,2}∣{3}, {1,3}∣{2}, {2,3}∣{1}. Three blocks of one: {1}∣{2}∣{3}. Choosing which element is alone gives the three shapes of type 2 + 1.
Count.1+3+1=5. Sum over the shapes.
Check one relation. The partition {1,2}∣{3} gives the pairs (1,1),(1,2),(2,1),(2,2),(3,3), which is 22+12=5 pairs. A block of size k contributes k2 ordered pairs, since every element of the block is related to every element of the block.
Answer. There are 5 equivalence relations on a 3-element set. As a cross-check, there are 29=512 relations on {1,2,3} (each of the 9 ordered pairs is in or out), and exactly 5 of them are reflexive, symmetric and transitive. On a 4-element set there are 15.
Your answerHow many equivalence relations on {1,2,3,4} have exactly two classes?
List the possible block sizes for two blocks, then count the ways to choose the blocks for each.
Two blocks means block sizes 3 + 1 or 2 + 2. For 3 + 1, choose the single element: 4 ways. For 2 + 2, split into two pairs: {12∣34}, {13∣24}, {14∣23}, 3 ways. Total 4+3=7.
Worked example
The relation a∼b iff a2=b2 on Z is an equivalence relation. Find its classes. Then find a partition of R whose relation is x∼y iff ⌊x⌋=⌊y⌋.
Solution.
Recognise the shape.a∼b iff f(a)=f(b) for f(a)=a2, so it is an equivalence relation by ‘same value is an equivalence relation’. No separate check of the three properties is needed.
Find the classes.[a]={b:b2=a2}={a,−a}. So [0]={0}, [1]={1,−1}, [2]={2,−2}, and so on. b2=a2 means b=±a.
Check it is a partition. Every integer is in exactly one of {0},{±1},{±2},…. The classes of an equivalence relation always form a partition.
The second relation. Floor ⌊x⌋ is the greatest integer at most x. The classes are the intervals [n,n+1) for n∈Z (for example ⌊2.7⌋=2=⌊2.0⌋, so 2.7∼2.0). Same floor means the same integer part, so the numbers lie in the same interval [n,n+1).
Answer. The classes of the first are the pairs {a,−a} and {0}. The intervals [n,n+1) partition R, and they come from “same floor”.
Your answerThe relation a∼b iff a2=b2 is applied to the integers −5,−4,…,4,5. How many equivalence classes are there?
Group the integers by their square.
The classes are {0} and {−k,k} for k=1,2,3,4,5. That is 1+5=6 classes, and their sizes 1+2⋅5=11 add up to the 11 integers.
Worked example
On R2 define (x1,y1)∼(x2,y2) iff y1−2x1=y2−2x2. Show it is an equivalence relation and describe its classes.
Solution.
Recognise the shape. Let f(x,y)=y−2x. Then (x1,y1)∼(x2,y2) iff f(x1,y1)=f(x2,y2). The relation is “same value of a function”, so the proposition above gives reflexive, symmetric and transitive at once.
Describe one class. The class of (x0,y0) is {(x,y):y−2x=c} where c=y0−2x0. This is the line y=2x+c of slope 2. A class is everything with the same value of f.
Check the partition picture. Every point (x,y) lies on exactly one such line, the one with c=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 2, one for each real number c.
Worked example
Prove: if ∼ and ≈ are equivalence relations on A, then so is R, defined by aRb iff (a∼b and a≈b).
Solution. The plan: check the three properties, using the same property of each of the two relations.
Reflexive. For a∈A: a∼a and a≈a, so aRa. Both relations are reflexive.
Symmetric. If aRb then a∼b and a≈b. So b∼a and b≈a, that is bRa. Both relations are symmetric, and we apply that to each half of the “and”.
Transitive. If aRb and bRc, then a∼b, b∼c, a≈b, b≈c. So a∼c and a≈c, that is aRc. Transitivity of ∼ gives the first, and transitivity of ≈ gives the second.
Answer.R is an equivalence relation. The same argument fails for “or” in place of “and”, because transitivity needs the chain a∼b, b≈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/∼, π(a)=[a], has π(a)=π(b) iff [a]=[b] iff a∼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→B and let ∼ be ‘same value’. Then fˉ:A/∼→f(A), fˉ([a])=f(a), is a well-defined bijection.
In one lineFor f:A→B with a∼b iff f(a)=f(b), the rule [a]↦f(a) is a well-defined bijection from A/∼ onto the range f(A).
Why it is trueGrouping the inputs that f 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′], then a∼a′ by the lemma, so f(a)=f(a′). The value 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′]), then f(a)=f(a′).
Template for injective: assume equal outputs.
So a∼a′, hence [a]=[a′].
That says a∼a′, and then the lemma gives equal classes.
Surjective: if y∈f(A), then y=f(a) for some a, and y=fˉ([a]).
Template for surjective onto the range: every element of f(A) has the form f(a).
Fractions as classes
Here is the example the whole chapter was building toward, and it answers the question “why is 21=42?” The answer is a definition that we choose, and no fact about numbers is discovered.
Start with the set A=Z×(Z∖{0}) of pairs (a,b) (“the numerator a over the denominator b”). We want (1,2) and (2,4) to count as the same. The school rule says ba=dc when ad=bc (cross-multiplication). Define
(a,b)∼(c,d)iffad=bc.
Worked example Hammack 11.2
Show that (a,b)∼(c,d) iff ad=bc is an equivalence relation on Z×(Z∖{0}), and explain why 21=42.
Solution.
Reflexive.(a,b)∼(a,b) because ab=ba. Multiplication of integers is commutative.
Symmetric. If ad=bc, then cb=da, which says (c,d)∼(a,b). Swap the sides of the equation and reorder the products.
Transitive, setting up. Suppose (a,b)∼(c,d) and (c,d)∼(e,f), so ad=bc and cf=de. We must show af=be. That is what (a,b)∼(e,f) means.
Transitive, the algebra. Multiply the first equation by f to get adf=bcf. Now bcf=b(cf)=b(de) by the second equation. So d(af)=d(be). Two substitutions chain the equations together. The middle pair (c,d) drops out.
Cancel. Since d=0, we may cancel d and get af=be. In Z, a product dx=dy with d=0 forces x=y. This is where “denominator not zero” is used, and why transitivity would fail if (0,0) were allowed.
The meaning.(1,2)∼(2,4) because 1⋅4=2⋅2. By the lemma on equal classes, [(1,2)]=[(2,4)]. The lemma says related pairs have equal classes.
Answer.∼ is an equivalence relation. A rational numberba is, by definition, the class [(a,b)], so 21 and 42 are two names for one class. The statement "21=42" is the statement (1,2)∼(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.
We assume the two hypotheses, written out as equations using the definition of the relation.
We want af to appear, and multiplying by f brings it in on the left.
This multiplies the first hypothesis, which must be written down first.
The second hypothesis lets us swap cf for de, which removes c from the chain.
You need the equation adf=bcf before you can substitute into its right side.
Commutativity of integer multiplication lets us pull the common factor d to the front.
This regroups the equation adf=bde from the previous line.
In the integers, dx=dy with d=0 forces x=y. This is where 'the denominator is not zero' is used.
The cancellation applies to d(af)=d(be), so that line must come first.
The equation af=be is the definition of (a,b)∼(e,f).
The conclusion needs the cancelled equation af=be.
Your answerUnder the rule (a,b)∼(c,d) iff ad=bc, the pair (3,5) is related to (x,20). What is x?
Write the cross-multiplication equation ad=bc with a=3, b=5, c=x, d=20.
The rule says 3⋅20=5⋅x, so 60=5x and x=12. Indeed 53=2012.
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)]. Show that the sum does not depend on the representatives.
Solution.
State what must be shown. Suppose (a,b)∼(a′,b′), that is ab′=a′b. We must show (ad+bc,bd)∼(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.
Write out what the relation requires. We need (ad+bc)(b′d)=(a′d+b′c)(bd). This is the cross-multiplication rule for the two answers. Denominators bd and b′d are nonzero since a product of nonzero integers is nonzero.
Expand the left side.(ad+bc)(b′d)=ab′d2+bb′cd. Distribute.
Expand the right side.(a′d+b′c)(bd)=a′bd2+bb′cd. Distribute.
Compare. The terms bb′cd are identical, and ab′d2=a′bd2 because ab′=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), 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)] is checked the same way, and is shorter: ab′=a′b gives (ac)(b′d)=(a′c)(bd) by multiplying both sides by cd.
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]) as “the number of letters in the word the fraction is written with”, the rule is nonsense, because 21 and 42 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→Z by g(ba)=a+b. Is g well defined?
A rule on classes must give the same answer for every representative. 21 and 42 are the same rational number, but the rule sends one to 3 and the other to 6. Being an integer is not the issue; consistency across representatives is.
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) meaning "a−b", with (a,b)∼(c,d) iff a+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 0. The next chapter turns the relation ∼n into the number system Zn. In linear algebra (chapter 3.7) a subspace W of V defines v∼w iff v−w∈W, and the classes form the quotient space V/W. The theorem above, with f a linear map and W its null space, becomes V/N(T)≅T(V), which is rank–nullity in disguise. Quotient groups G/H (MATH 541) use the same recipe with a subgroup H.
A preview· Preview: a plane modulo a line
In R2 let W be the line y=0 (the x-axis), and say v∼w iff v−w lies on W. Two vectors are related when they have the same y-coordinate, so the classes are the horizontal lines, and the quotient R2/W is “the set of horizontal lines”, which can be labelled by one number, the height. The plane has dimension 2, the line has dimension 1, and the quotient has dimension 2−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} under two operations, “merge the classes of i and j” and “are i and j in the same class?”. Start with 8 elements, each alone: eight classes. After merging 1,2, then 3,4, then 2,4, then 5,6, the classes are {1,2,3,4}, {5,6}, {7}, {8}: four classes of sizes 4,2,1,1, and 42+22+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∼b then b∼a, and then a∼b with b∼a gives a∼a. It assumes a has some b to be related to. On A={1,2} take only the pair (1,1): it is symmetric and transitive, but 2∼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 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] for ∼5. Writing [2]=[7] is a mistake. The fraction 21 is not “the” pair (1,2) but the whole class, and (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 as “equal, or never meeting” (equivalently “same direction”) and it becomes an equivalence relation.
Problems
check
Is ”a divides b” an equivalence relation on the positive integers? Prove or give a counterexample for each property.
Solution
Reflexive: a=a⋅1, so a∣a. Transitive: if b=ak and c=bl then c=a(kl). Not symmetric: 2∣4 but 4∤2. So it is not an equivalence relation.
check
On R let x∼y iff x−y∈Z. Is it an equivalence relation? Describe [0.3].
Solution
Reflexive: x−x=0∈Z. Symmetric: if x−y∈Z then y−x∈Z. Transitive: (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,…}. Each class has exactly one member in [0,1).
check
Which of these are partitions of {1,2,3,4}? (a) {1,3},{2,4}. (b) {1,2,3},{3,4}. (c) {1},{2},{3}.
Solution
(a) Yes. (b) No: 3 lies in two blocks. (c) No: 4 lies in no block.
use
List the classes of “same remainder on division by 4” on {1,2,…,10}, and count the ordered pairs in the relation.
Solution
Classes: {1,5,9}, {2,6,10}, {3,7}, {4,8}. A block of size k gives k2 ordered pairs, so 9+9+4+4=26 pairs.
use
On R2 define (x1,y1)∼(x2,y2) iff x1+y1=x2+y2. Show it is an equivalence relation and describe the classes geometrically.
Solution
It is “same value” for f(x,y)=x+y, so it is an equivalence relation by the proposition. The class of (x0,y0) is the line x+y=x0+y0, a line of slope −1. The classes are all the lines of slope −1, one for each value of x+y, and they partition the plane.
use
Show that multiplication [(a,b)]⋅[(c,d)]=[(ac,bd)] of fractions is well defined in the first factor.
Solution
Suppose (a,b)∼(a′,b′), so ab′=a′b. We need (ac,bd)∼(a′c,b′d), that is (ac)(b′d)=(a′c)(bd). The left side is (ab′)cd and the right side is (a′b)cd, equal because ab′=a′b. Also bd=0 and b′d=0 since the integers are nonzero.
prove
Let ∼ and ≈ be equivalence relations on A, and let aRb mean (a∼b and a≈b), an equivalence relation by the worked example. Prove that [a]R=[a]∼∩[a]≈. Then deduce: if ∼ has 3 classes and ≈ has 2 classes, then R has at most 6 classes.
Solution
For the classes: x∈[a]R iff xRa iff (x∼a and x≈a) iff (x∈[a]∼ and x∈[a]≈) iff x∈[a]∼∩[a]≈. For the count, every class of R is C∩D for one of the 3 classes C of ∼ and one of the 2 classes D of ≈, and there are only 3⋅2=6 such choices. Some of the intersections may be empty, which is why the number of classes can be smaller than 6.
prove
Give an example of two equivalence relations whose union is not an equivalence relation.
Solution
On {1,2,3} take ∼ with the single nontrivial pair 1∼2 (blocks {1,2},{3}) and ≈ with 2≈3 (blocks {1},{2,3}). The union contains 1∼2 and 2≈3 but not (1,3), so it is not transitive. Intersections (the worked example above) are safe, unions are not.
prove
Let A be a finite set and ∼ an equivalence relation in which every class has exactly k elements. Prove that ∣A∣=k⋅m, where m is the number of classes.
Solution
The m classes form a partition of A, so each element lies in exactly one class. Counting the elements of A class by class counts each element once, and each class contributes k. So ∣A∣=k+k+⋯+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) iff a+d=b+c is an equivalence relation on N×N (the relation used to build the integers). Which pairs are related to (1,3), and what integer should [(1,3)] be?
Solution
Reflexive: a+b=b+a. Symmetric: if a+d=b+c then c+b=d+a, which says (c,d)∼(a,b). Transitive: if a+d=b+c and c+f=d+e, add: a+d+c+f=b+c+d+e; cancel c+d to get a+f=b+e. The pairs related to (1,3) are those with 1+d=3+c, that is d=c+2: (1,3),(2,4),(3,5),…. The class should be the integer 1−3=−2, since a−b is the same for every pair in it.
stretch
Count the equivalence relations on a set with 4 elements by listing partitions by block sizes. Check with your answer for 3 elements.
Solution
Block shapes: 4: 1 way. 3+1: choose the single element, 4 ways. 2+2: split into two pairs, 3 ways ({12∣34}, {13∣24}, {14∣23}). 2+1+1: choose the pair, (24)=6 ways. 1+1+1+1: 1 way. Total 1+4+3+6+1=15. For 3 elements the shapes are 3 (1 way), 2+1 (3 ways), 1+1+1 (1 way): 5, matching the earlier example.
stretch
On R define x∼y iff x−y∈Q. Show it is an equivalence relation, show every class is countable, and use the uncountability of R to show there are uncountably many classes.
Solution
Equivalence: x−x=0∈Q; if x−y∈Q so is y−x; and x−z=(x−y)+(y−z) is a sum of rationals. The class of x is x+Q={x+q:q∈Q}, and the function q↦x+q is a bijection from Q onto it, so the class is countable. Suppose there were only countably many classes. Choose one representative rk from the kth class of a list of the classes, and list Q as q1,q2,…. Every real number lies in some class, so it equals rk+qn for some k,n. So (k,n)↦rk+qn is a function from the countable set N×N onto R, and 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 A is a subset of A×A. It is an equivalence relation if it is reflexive, symmetric and transitive. Each property is disproved by one counterexample.
The equivalence class[a] is everything related to a. The lemma: a∼b iff [a]=[b] iff the classes share an element.
Therefore the classes are non-empty, cover A, 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) 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 ba is the class of the pair (a,b) under ad=bc, so 21=42 is a definition, not a discovery.
Seeds: Zn (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.
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.