CSE 20 DISCRETE MATH Prof. Shachar Lovett http://cseweb.ucsd.edu/classes/wi15/cse20-a/ Clicker frequency: CA Todays topics • Equivalence relations • Section 6.2 in Jenkyns, Stephenson (Binary) Relations • Model a relation between two families of objects • Formally: • U universe set • Relation: π ⊆ π × π • For π₯, π¦ ∈ π we write: π₯π π¦ as a shorthand for "(π₯, π¦) ∈ π “ • Example 1: x<y, formally… • U=N • “π₯ < 𦔠represents the relation π = π₯, π¦ : π₯, π¦ ∈ π, π₯ < π¦ • Example 1: x<y, formally… • U = P(N) • “π₯ ⊂ 𦔠represents the relation π = { π₯, π¦ : π₯, π¦ ∈ π(π), π₯ ⊂ π¦} Three important properties of relations • There are several important properties of relations • We will focus on the most important three • A relation R is symmetric if ∀π₯, π¦, π₯π π¦ ⇔ π¦π π₯ • A relation R is reflexive if ∀π₯, π₯π π₯ • A relation R is transitive if ∀π₯, π¦, π§, π₯π π¦ ∧ π¦π π§ → π₯π π§ • An equivalence relation is a relation which satisfies all of them Examples of equivalence relations • U=Z (integers) • xRy = “x=y” Prove that R is an equivalence relation Examples of equivalence relations • U=Z (integers) • xRy = “|x|=|y|” (absolute value of x = absolute value of y) Prove that R is an equivalence relation Examples of equivalence relations • U=“all students in this class” • xRy = “x and y have the same birthday” Prove that R is an equivalence relation Examples of equivalence relations • U=Z (integers) • xRy = “x+y is even” Prove that R is an equivalence relation What is so special about equivalence relations? • Equivalence relations describe a partition of the universe U to equivalence classes Equivalence classes • Let π1 , π2 , … , ππ be a partition of U • For π₯ ∈ π, define πΆπππ π π₯ to be the (unique!) part that x belongs to • Equivalently, define πΆπππ π : π → {1, … , π} and equivalence classes are defined by all elements with same image ππ = {π₯ ∈ π: πΆπππ π π₯ = π} • Theorem: let π ⊆ π × π be an equivalence relation. Then there is a mapping πΆπππ π : π → πΆ such that ∀π₯, π¦ ∈ π, π₯π π¦ ⇔ πΆπππ π π₯ = πΆπππ π (π¦) Equivalence classes: example 1 • U=Z (integers) • xRy = “x=y” Class(x)= A. x B. y C. U D. “x=y” E. Other Equivalence classes: example 2 • U=Z (integers) • xRy = “|x|=|y|” Class(x)= A. x B. |x| C. “x=y” D. “|x|=|y|” E. Other Equivalence classes: example 3 • U=“all students in this class” • xRy = “x and y have the same birthday” Class(x)= A. x B. Birthday of x C. “x=y” D. “|x|=|y|” E. Other Equivalence classes: example 4 • U=Z (integers) • xRy = “x+y is even” Class(x)=??? Figure this out in your groups Equivalence classes: proof • Theorem: let π ⊆ π × π be an equivalence relation. Then there is a mapping πΆπππ π : π → πΆ such that ∀π₯, π¦ ∈ π, π₯π π¦ ⇔ πΆπππ π π₯ = πΆπππ π (π¦) Proof: For each π₯ ∈ π, define: Class π₯ = {π¦ ∈ π: π₯π π¦} (and so πΆ = πΆπππ π π₯ : π₯ ∈ π ⊂ π(π) ) We need to show that ∀π₯, π¦ ∈ π, π₯π π¦ ⇔ πΆπππ π π₯ = πΆπππ π (π¦) Equivalence classes: proof (contd) For each π₯ ∈ π, define: Class π₯ = {π¦ ∈ π: π₯π π¦} (⇐) Assume Class π₯ = πΆπππ π (π¦). We will show xRy. By definition: we need to show π¦ ∈ πΆπππ π (π₯). But π¦ ∈ πΆπππ π π¦ since R is reflexive (and so π¦π π¦)) and since we assume Class π₯ = πΆπππ π (π¦) then also π¦ ∈ πΆπππ π (π₯). Equivalence classes: proof (contd) For each π₯ ∈ π, define: Class π₯ = {π¦ ∈ π: π₯π π¦} (⇒) Assume xRy. We need to show Class π₯ = πΆπππ π (π¦). We will first show πΆπππ π π¦ ⊆ πΆπππ π (π₯). Let π§ ∈ πΆπππ π π¦ . Then yπ π§. Since R is transitive, π₯π π¦ ∧ π¦π π§ imply that xπ π§. So π§ ∈ πΆπππ π (π₯). Since R is symmetric, we also have yRx. The same argument as above (with the roles of x,y reversed) then implies that πΆπππ π π₯ ⊆ πΆπππ π (π¦). So: πΆπππ π π₯ = πΆπππ π (π¦). Next class • Modular arithmetic • Section 6.2 in Jenkyns, Stephenson • Review session for midterm 2