Equivalence Relations

Download Report

Transcript Equivalence Relations

Rosen, Section 8.5
Equivalence Relations
Longin Jan Latecki
Temple University, Philadelphia
[email protected]
Some slides from Aaron Bloomfield
Introduction
• Certain combinations of relation properties are very
useful
• In this set we will study equivalence relations:
A relation that is reflexive, symmetric and transitive
• Next slide set we will study partial ordering:
A relation that is reflexive, antisymmetric, and transitive
• The difference is whether the relation is symmetric or
antisymmetric
Outline
• What is an equivalence relation
• Equivalence relation examples
• Related items
– Equivalence class
– Partitions
We can group properties of relations together to define new types of
important relations.
_________________
Definition: A relation R on a set A is an equivalence relation iff R is
• reflexive
• symmetric
• transitive
Two elements related by an equivalence relation are called equivalent.
Consider relation R = { (a,b) | len(a) = len(b) }, where len(a) means the
length of string a
It is reflexive: len(a) = len(a)
It is symmetric: if len(a) = len(b), then len(b) = len(a)
It is transitive: if len(a) = len(b) and len(b) = len(c), then len(a) =
len(c)
Thus, R is a equivalence relation
Equivalence relation example
• Consider the relation R = { (a,b) | a ≡ b (mod m) }
– Remember that this means that m | a-b
– Called “congruence modulo m”
• Is it reflexive: (a,a)  R means that m | a-a
– a-a = 0, which is divisible by m
• Is it symmetric: if (a,b)  R then (b,a)  R
– (a,b) means that m | a-b
– Or that km = a-b. Negating that, we get b-a = -km
– Thus, m | b-a, so (b,a)  R
• Is it transitive: if (a,b)  R and (b,c)  R then (a,c)  R
–
–
–
–
–
–
(a,b) means that m | a-b, or that km = a-b
(b,c) means that m | b-c, or that lm = b-c
(a,c) means that m | a-c, or that nm = a-c
Adding these two, we get km+lm = (a-b) + (b-c)
Or (k+l)m = a-c
Thus, m divides a-c, where n = k+l
• Thus, congruence modulo m is an equivalence relation
Rosen, section 8.5, question 1
•
a)
Which of these relations on {0, 1, 2, 3} are equivalence
relations? Determine the properties of an equivalence
relation that the others lack
{ (0,0), (1,1), (2,2), (3,3) }
Has all the properties, thus, is an equivalence relation
b)
{ (0,0), (0,2), (2,0), (2,2), (2,3), (3,2), (3,3) }
Not reflexive: (1,1) is missing
Not transitive: (0,2) and (2,3) are in the relation, but not (0,3)
c)
{ (0,0), (1,1), (1,2), (2,1), (2,2), (3,3) }
Has all the properties, thus, is an equivalence relation
d)
{ (0,0), (1,1), (1,3), (2,2), (2,3), (3,1), (3,2) (3,3) }
Not transitive: (1,3) and (3,2) are in the relation, but not (1,2)
e)
{ (0,0), (0,1) (0,2), (1,0), (1,1), (1,2), (2,0), (2,2), (3,3) }
Not symmetric: (1,2) is present, but not (2,1)
Not transitive: (2,0) and (0,1) are in the relation, but not (2,1)
Rosen, Section 8.5, question 9
• Suppose that A is a non-empty set, and f is a function
that has A as its domain. Let R be the relation on A
consisting of all ordered pairs (x,y) where f(x) = f(y)
– Meaning that x and y are related if and only if f(x) = f(y)
• Show that R is an equivalence relation on A
• Reflexivity: f(x) = f(x)
– True, as given the same input, a function always produces the
same output
• Symmetry: if f(x) = f(y) then f(y) = f(x)
– True, by the definition of equality
• Transitivity: if f(x) = f(y) and f(y) = f(z) then f(x) = f(z)
– True, by the definition of equality
Rosen, Section 8.5, question 11
• Show that the relation R, consisting of all pairs (x,y)
where x and y are bit strings of length three or more that
agree except perhaps in their first three bits, is an
equivalence relation on the set of all bit strings
• Let f(x) = the bit string formed by the last n-3 bits of the
bit string x (where n is the length of the string)
• Thus, we want to show: let R be the relation on A
consisting of all ordered pairs (x,y) where f(x) = f(y)
• This has been shown in question 9 on the previous slide
An equivalence class of an element x:
[x] = {y | <x, y> is in R}
[x] is the subset of all elements related to [x] by R.
The element in the bracket is called a representative
of the equivalence class. We could have chosen any one.
Theorem: Let R be an equivalence relation on A. Then either
[a] = [b] or [a] ∩[b] = Φ
The number of equivalence classes is called the rank of the equivalence
relation.
Let A={a,b,c} and R be given by a digraph:
More on equivalence classes
• Consider the relation R = { (a,b) | a mod 2 = b
mod 2 } on the set of integers
– Thus, all the even numbers are related to each other
– As are the odd numbers
• The even numbers form an equivalence class
– As do the odd numbers
• The equivalence class for the even numbers is
denoted by [2] (or [4], or [784], etc.)
– [2] = { …, -4, -2, 0, 2, 4, … }
– 2 is a representative of its equivalence class
• There are only 2 equivalence classes formed by
this equivalence relation
More on equivalence classes
• Consider the relation
R = { (a,b) | a = b or a = -b }
– Thus, every number is related to additive inverse
• The equivalence class for an integer a:
– [7] = { 7, -7 }
– [0] = { 0 }
– [a] = { a, -a }
• There are an infinite number of equivalence
classes formed by this equivalence relation
Theorem: Let R be an equivalence relation on a set A.
The equivalence classes of R partition the set A into disjoint nonempty
subsets whose union is the entire set.
This partition is denoted A/R and called
• the quotient set, or
• the partition of A induced by R, or,
• A modulo R.
Definition: Let S1, S2, . . ., Sn be a collection of subsets of a set A.
Then the collection forms a partition of A if the subsets are nonempty,
disjoint and exhaust A:
Note that { {}, {1,3}, {2} } is not a partition (it contains the empty set).
{ {1,2}, {2, 3} } is not a partition because ….
{ {1}, {2} } is not a partition of {1, 2, 3} because none of its blocks contains 3.
It is easy to recognize equivalence relations using digraphs:
• The equivalence class of a particular element forms a universal relation
(contains all possible edges) between the elements in the equivalence class.
The (sub)digraph representing the subset is called a complete (sub)digraph,
since all arcs are present.
Example: All possible equivalence relations on a set A with 3 elements:
Rosen, section 8.5, question 44
•
Which of the following are partitions of the set of integers?
a)
The set of even integers and the set of odd integers
Yes, it’s a valid partition
b)
The set of positive integers and the set of negative integers
No: 0 is in neither set
c)
The set of integers divisible by 3, the set of integers leaving a
remainder of 1 when divided by 3, and the set of integers leaving
a remaineder of 2 when divided by 3
Yes, it’s a valid partition
d)
The set of integers less than -100, the set of integers with
absolute value not exceeding 100, and the set of integers greater
than 100
Yes, it’s a valid partition
e)
The set of integers not divisible by 3, the set of even integers, and
the set of integers that leave a remainder of 3 when divided by 6
The first two sets are not disjoint (2 is in both), so it’s not a valid
partition
1. Determine whether the relations represented by these zero-one matrices
are equivalence relations. If yes, with how many equivalence classes?
1
1 1 1
0
M  0 1 1 P  
1
1 1 1

0
0
1
0
1
1
0
1
0
0
1
1
1
R
1
0


1
0
1
1
1
0
1
1
1
0
0
0
0

1
2. What are the equivalence classes (sets in the partition) of the integers
arising from congruence modulo 4?
3. Can you count the number of equivalence relations on a set A with n
elements. Can you find a recurrence relation?
The answers are
• 1 for n = 1
• 2 for n = 2
• 5 for n = 3
How many for n = 4?
Theorem (Bell number)
Let p(n) denotes the number of different equivalence relations on a set with n elements
(which is equivalent to the number of partitions of the set with n elements). Then
n 1
p(n)   C (n  1, j ) p(n  j  1)
j 0
p(n) is called Bell number, named in honor of Eric Temple Bell
Examples:
p(0)=1, since there is only one partition of the empty set:
into the empty collection of subsets
p(1)=C(0,0)p(0)=1, since {{1}} is the only partition of {1}
p(2)=C(1,0)p(1)+C(1,1)p(0)=1+1=2, since portions of {1,2} are {{1,2}} and {{1},{2}}
p(3)=5, since, the set { 1, 2, 3 } has these five partitions.
{ {1}, {2}, {3} }, sometimes denoted by 1/2/3.
{ {1, 2}, {3} }, sometimes denoted by 12/3.
{ {1, 3}, {2} }, sometimes denoted by 13/2.
{ {1}, {2, 3} }, sometimes denoted by 1/23.
{ {1, 2, 3} }, sometimes denoted by 123.
n 1
p(n)   C (n  1, j ) p(n  j  1)
j 0
Proof (Bell number) :
We want to portion {1, 2, …, n}.
For a fixed j, A is a subset of j elements from {1, 2, …, n-1} union {n}.
Note that j can have values from 0 to n-1.
We can select a subset of j elements from {1, 2, …, n-1} in C(n-1,j) ways,
and we have p(n-1-j) partitions of the remaining n-1-j elements. ■
Theorem: If R1 and R2 are equivalence relations on
A, then R1∩R2 is an equivalence relation on A.
Proof: It suffices to show that the intersection of
• reflexive relations is reflexive,
• symmetric relations is symmetric, and
• transitive relations is transitive.
Definition: Let R be a relation on A.
Then the reflexive, symmetric, transitive closure of R, tsr(R), is an
equivalence relation on A, called the equivalence relation induced by R.
Example:
Theorem: tsr(R) is an equivalence relation.
Proof:
We need to show that tsr(R) is still symmetric and reflexive.
• Since we only add arcs vs. deleting arcs when computing closures it
must be that tsr(R) is reflexive since all loops <x, x> on the diagraph
must be present when constructing r(R).
• If there is an arc <x, y> then the symmetric closure of r(R) ensures
there is an arc <y, x>.
• Now argue that if we construct the transitive closure of sr(R) and we
add an edge <x, z> because there is a path from x to z, then there
must also exist a path from z to x (why?) and hence we also must add
an edge <z, x>.
Hence the transitive closure of sr(R) is symmetric.
What we wish computers could do
Quick survey
•
a)
b)
c)
d)
I felt I understood the material in this slide
set…
Very well
With some review, I’ll be good
Not really
Not at all
Quick survey
•
a)
b)
c)
d)
The pace of the lecture for this slide set
was…
Fast
About right
A little slow
Too slow
Quick survey
•
a)
b)
c)
d)
How interesting was the material in this
slide set? Be honest!
Wow! That was SOOOOOO cool!
Somewhat interesting
Rather boring
Zzzzzzzzzzz