E N D
Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.Based on a work at http://peerinstruction4cs.org.Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org. CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett
Today’s Topics: • Relations • Equivalence relations
Relations are graphs • Think of relations as graphs • xRy means “there in an edge xy” • Is • R ? • R ? • Both • Neither
Relations are graphs • What does this relation capture? xRy means • x>y • x=y • x divides y • x+y • None/more than one 2 3 1 4 6 5
Types of relations • A relation is symmetric if xRyyRx. • That is, if the graph is undirected • Which of the following is symmetric • x<y • x divides y • x and y have the same sign • xy • None/more than one
Types of relations • A relation is reflexive if xRx is true for all x • That is, the graph has loops in all vertices • Which of the following is reflexive • x<y • x divides y • x and y have the same sign • xy • None/more than one
Types of relations • A relation is transitive if xRy yRz xRz • This is less intuitive… will show equivalent criteria soon • Which of the following is transitive • x<y • x divides y • x and y have the same sign • xy • None/more than one
Types of relations • A relation is transitive if xRy yRz xRz • Theorem: Let G be the graph corresponding to a relation R. R is transitive iff whenever you can reach from x to y in G then the edge xy is in G. • Try to prove yourself first
Types of relations • Theorem: R is transitive iff when you can reach from x to y in G then the edge xy is also in G. • Proof (sufficient): Assume the graph G has this property. We will show R is transitive. Let x,y,z be such that xRy and yRz hold. In the graph G we can reach from x to z via the path xyz. So by assumption on G xz is also an edge in G. Hence xRz so R is transitive.
Types of relations • Theorem: R is transitive iff when you can reach from x to y in G then the edge xy is also in G. • Proof (necessary) by contradiction: Assume by contradiction R is transitive but G doesn’t have this property. So, there are vertices x,y with a path xv1…vky in G but where there is no edge xy. Choose such a pair x,y with minimal path length k. We divide the proof to cases. • Case 1: k=0. So xy in G. Contradiction. • Case 2: k=1. Since R is transitive then xv1 and v1y imply xy. Contradiction. • Case 3: k>1. Then xvkmust be in G since the path has length k-1 and we assumed the path from x to y is of minimal length. So in fact xvky. Contradiction. QED
Equivalence relations • Definition: a relation is an equivalence relation if it is • Reflexive • Symmetric • Transitive • What does that actually means???
Equivalence relations • Best to explain by example • In the universe of people, xRy if x,y have the same birthday • Relfexive: xRx • Symmetric: xRy implies yRx • Transitive: if x,y have the same birthday, and y,z have the same birthday, then so do x,z.
Equivalence relations • An equivalence relation partitions the universe to equivalence classes • E.g. all people who were born on 1/1/2011 is one equivalence class • Reflexive: a person has the same birthday as himself… dahhh…. • Symmetric: if x,y have the same birthday then so do y,x • Transitive: if x,y have the same birthday, and y,z have the same birthday, then so do x,z
Equivalence relations • As a graph
Equivalence relations • As a graph Equivalence classes
Equivalence relations • Which of the following is an equivalence relation in the universe of integer numbers • x divides y • x*y>0 • x+y>0 • x+y is even • None/more than one/other
Equivalence relations • Which of the following is an equivalence relation in the universe of graphs • x,y have the same number of vertices • x,y have the same edges • x,y are both Eulerian • x,y are the same up to re-labeling the vertices (isomorhpic) • None/more than one/other
Equivalence relations as functions • We can see an equivalence relation as a function UniverseProperty E.g. People birthday Integers sign Graphs #vertices • An equivalence class is the set of elements mapped to the same value