CS 250, Discrete Structures, Fall 2015

Slides:



Advertisements
Similar presentations
Discrete Mathematics Lecture # 16 Inverse of Relations.
Advertisements

Lecture 2.3: Set Theory, and Functions* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.
Lecture 4.5: POSets and Hasse Diagrams CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.
9/8/2011Lecture Functions1 Lecture 2.4: Functions CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda.
Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag.
CS Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 Ofc hr: Thur, 9:30-11:30a Fall 2002KSU - Discrete Structures1.
April 10, 2002Applied Discrete Mathematics Week 10: Relations 1 Counting Relations Example: How many different reflexive relations can be defined on a.
Lecture 5.2: Special Graphs and Matrix Representation CS 250, Discrete Structures, Fall 2013 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag.
CS 250, Discrete Structures, Fall 2011 Nitesh Saxena
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
Lecture 2.2: Set Theory* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.
Lecture 4.4: Equivalence Classes and Partially Ordered Sets CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda.
Copyright © Zeph Grunschlag, Relations Zeph Grunschlag.
Lecture 4.3: Closures and Equivalence Relations CS 250, Discrete Structures, Fall 2013 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Lecture 2.1: Sets and Set Operations CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Lecture 5.4: Paths and Connectivity CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
Lecture 4.1: Relations Basics CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Lecture 4.2: Relations Basics CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag.
Lecture 2.2: Set Theory CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Lecture 4.2: Relations CS 250, Discrete Structures, Fall 2013 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag.
Relations. L222 Agenda –Relations 7.3 Representing Relations As subsets of Cartesian products Column/line diagrams Boolean matrix Digraph Operations on.
Lecture 4.4: Equivalence Classes and Partially Ordered Sets CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda.
Lecture 1.5: Proof Techniques CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda Heeren 1.
Lecture 4.1: Relations Basics CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.
9/29/2011Lecture Strong Induction1 Lecture 3.2: Strong Induction CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures.
Lecture 5.3: Graph Isomorphism and Connectivity CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
9/27/2011 Lecture Mathematical Induction1 Lecture 3.1: Mathematical Induction* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from.
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag.
Lecture 1.5: Proof Techniques
Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation is a relation on.
Lecture 5.4: Paths and Connectivity
Lecture 5.2: Special Graphs and Matrix Representation
Lecture 4.1: Relations Basics
Lecture 1.5: Proof Techniques
CS 173: Discrete Mathematical Structures
CS 250, Discrete Structures, Fall 2015
Lecture 4.3: Closures and Equivalence Relations
Lecture 3.2: Induction and Strong Induction (contd.)
Lecture 4.1: Relations Basics
MimarTebebi revaz grigolia.
Lecture 3.2: Induction, and Strong Induction
CS 250, Discrete Structures, Fall 2011 Nitesh Saxena
Lecture 3.2: Induction and Strong Induction (contd.)
CS 250, Discrete Structures, Fall 2014
Lecture 3.2: Induction, and Strong Induction
CS 250, Discrete Structures, Fall 2014
CS 250, Discrete Structures, Fall 2013
CS 250, Discrete Structures, Fall 2015
Lecture 4.3: Closures and Equivalence Relations
Lecture 3.2: Induction, and Strong Induction
Lecture 1.6: Proof Techniques (contd)
CS 250, Discrete Structures, Fall 2015 Nitesh Saxena
Lecture 2.1: Sets and Set Operations*
CS 250, Discrete Structures, Fall 2013
Lecture 2.3: Set Theory, and Functions
CS 250, Discrete Structures, Fall 2013
Lecture 3.1: Mathematical Induction
Lecture 4.1: Relations Basics
CS 336/536: Computer Network Security Fall 2014 Nitesh Saxena
CS 250, Discrete Structures, Fall 2014 Nitesh Saxena
CS 250, Discrete Structures, Fall 2014 Nitesh Saxena
Properties of Relations
Lecture 1.6: Proof Techniques (contd)
Lecture 5.3: Graph Isomorphism and Paths
CS 250, Discrete Structures, Fall 2014 Nitesh Saxena
Lecture 2.3: Set Theory, and Functions
DETERMINANT MATH 80 - Linear Algebra.
Lecture 3.1: Mathematical Induction
CS 250, Discrete Structures, Fall 2015 Nitesh Saxena
CS 250, Discrete Structures, Fall 2012
Presentation transcript:

CS 250, Discrete Structures, Fall 2015 Lecture 4.2: Relations CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

Course Admin Mid-Term 2 Exam HW3 Solution will be posted soon Should have the results this week HW3 Was due just now Solution will be posted Should have the results soon If you haven’t picked up your previous graded submissions, please do so from my office 1/17/2019

Roadmap PLEASE DO ATTEND THE LECTURES Done with about 75% of the course We are left with one more homework We are left with one final exam Cumulative – will cover everything Focus more on material covered after the two mid-terms Please try to do your best in the remainder of the time; I know you have been working hard Please submit your homeworks on time Still a lot of scope of improvement PLEASE DO ATTEND THE LECTURES 1/17/2019

Outline Relation Examples and Definitions Matrix Representation 1/17/2019

Composing Relations Q: Suppose R defined on N by: xRy iff y = x 2 and S defined on N by: xSy iff y = x 3 What is the composition SR ? 1/17/2019

Composing Relations xRy iff y = x 2 xSy iff y = x 3 A: These are functions (squaring and cubing) so the composite SR is just the function composition (raising to the 6th power). xSRy iff y = x 6 (in this odd case SR = RS) Q: Compose the following: 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 More detail on: xRSy iff y = x 6 1) xRx2 2) ySy3 so x2S(x2) 3 3) Composing (1) and (2) we get xRSx6 1/17/2019

Composing Relations 1 1 1 2 2 2 3 3 3 4 4 5 A: Draw all possible shortcuts. In our case, all shortcuts went through 1: 1 1 2 2 3 3 4 1/17/2019

Composing Relations: Picture 1 1 1 2 2 2 3 3 3 4 4 5 A: Draw all possible shortcuts. In our case, all shortcuts went through 1: 1 1 2 2 3 3 4 1/17/2019

Composing Relations: Picture 1 1 1 2 2 2 3 3 3 4 4 5 A: Draw all possible shortcuts. In our case, all shortcuts went through 1: 1 1 2 2 3 3 4 1/17/2019

Composing Relations: Picture 1 1 1 2 2 2 3 3 3 4 4 5 A: Draw all possible shortcuts. In our case, all shortcuts went through 1: 1 1 2 2 3 3 4 1/17/2019

Composing Relations: Picture 1 1 1 2 2 2 3 3 3 4 4 5 A: Draw all possible shortcuts. In our case, all shortcuts went through 1: 1 1 2 2 3 3 4 1/17/2019

Inverting Relations Relational inversion amounts to just reversing all the tuples of a binary relation. DEF: If R is a relation from A to B, then the relation R -1 from B to A defined by setting bR -1a if and only aRb. Q: Suppose R defined from Z to N by: xRy iff y = x 2. What is the inverse R -1 ? 1/17/2019

Inverting Relations A: xRy iff y = x 2. R is the square function so R -1 is square root: i.e. the union of the two square-root branches. I.e: yR -1x iff y = x 2 or in terms of square root: xR -1y iff y = ±x where x is non-negative 1/17/2019

Relations – matrix representation Suppose we have a relation R on AxB, where A={1,2,3,4}, and B={u,v,w}, R={(1,u),(1,v),(2,w),(3,w),(4,u)}. Then we can represent R as: The labels on the outside are for clarity. It’s really the matrix in the middle that’s important. u v w 1 2 3 4 This is a |A| x |B| matrix whose entries indicate membership in R. 1/17/2019

Relations – matrix representation Some things to think about. Let R be a relation on a set A, and let MR be the matrix representation of R. Then R is reflexive if, ______________. All entries in MR are 1. The \ diagonal of MR contains only 1s. The first column of MR contains no 0s. None of the above. 1/17/2019

Relations – matrix representation Some things to think about. Let R be a relation on a set A, and let MR be the matrix representation of R. Then R is symmetric if, ______________. All entries above the \ are 1. The first and last columns of MR contain an equal # of 0s. MR is visually symmetric about the \ diagonal. None of the above. 1/17/2019

Relations – matrix representation Suppose we have R1 and R2 defined on A: R1 u v w 1 R2 u v w 1 1 Then R1  R2 is the bitwise “or” of the entries (Join By): MR1R2 = MR1 v MR2 1 Then R1  R2 is the bitwise “and” of the entries (Meet): MR1R2 = MR1  MR2 1/17/2019

Relations – composition using matrices Suppose we have R and S defined on A: R u v w 1 S u v w 1 1 Then SR corresponds to the boolean product   1/17/2019

Relations - A Theorem Theorem: If R is a transitive relation, then Rn  R, n. How to prove? What strategy or technique should we use? 1/17/2019

Typical way of proving subset. Relations - A Theorem If R is a transitive relation, then Rn  R, n. Proof by induction on n. Base case (n=1): R1  R because by definition, R1 = R. Induction case: if R is transitive, then Rk  R. Prove: if R is transitive, then Rk+1  R. Typical way of proving subset. We are trying to prove that Rk+1  R. To do this, we select an element of Rk+1 and show that it is also an element of R. Let (a,b) be an element of Rk+1. Since Rk+1 = Rk  R, we know there is an x so that (a,x)  R and (x,b)  Rk. By assumption at the induction step, since Rk  R, (x,b)  R. But wait, if (a,x)  R, and (x,b)  R, and R is transitive, then (a,b)  R. 1/17/2019

Relations - Another Theorem If R is a reflexive relation, then Rn is reflexive relation, n. Whiteboard! 1/17/2019

N-ary Relations So far, we were talking about binary relations – defined on two sets. Can be generalized to N sets Ex: R = {(a, b, c): a < b < c}, defined on set of integers – a 3-ary relation Applications in databases 1/17/2019

Today’s Reading Rosen 9.1 and 9.3 1/17/2019