Lecture 4.1: Relations Basics CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.

Slides:



Advertisements
Similar presentations
Basic Properties of Relations
Advertisements

Discrete Structures Chapter 5 Relations Nurul Amelina Nasharuddin Multimedia Department.
CSE115/ENGR160 Discrete Mathematics 04/24/12 Ming-Hsuan Yang UC Merced 1.
1 Representing Relations Part 2: directed graphs.
Reflexive -- First sentence of proof is: (1) Let x  Z (2) Let (x,x)  R. (3) Let (x,x)  I (4) Let x  R.
1 Section 7.1 Relations and their properties. 2 Binary relation A binary relation is a set of ordered pairs that expresses a relationship between elements.
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
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.
Relation. Relations Recall the definition of the Cartesian (Cross) Product: The Cartesian Product of sets A and B, A x B, is the set A x B = { : x  A.
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.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
1 Relations Rosen 6 th ed., § Relations Re lationships between elements of sets occur in many contextsRe lationships between elements of sets occur.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit Unit 04 Relations IT DisiciplineITD1111 Discrete Mathematics & Statistics STDTLP1 Unit 4 Relations.
Discrete Math for CS 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.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.
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.
1 Lecture 3.3: Recursion CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag.
Lecture 4.3: Closures and Equivalence Relations CS 250, Discrete Structures, Fall 2013 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Lecture 2.1: Sets and Set Operations CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
CS 103 Discrete Structures Lecture 19 Relations. Chapter 9.
Lecture 5.4: Paths and Connectivity CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
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.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
Lecture 2.2: Set Theory CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Chapter Relations and Their Properties
Relations Section 9.1, 9.3—9.5 of Rosen Spring 2012
Lecture 4.2: Relations CS 250, Discrete Structures, Fall 2013 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Lecture 4.4: Equivalence Classes and Partially Ordered Sets CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda.
Chap. 7 Relations: The Second Time Around
Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and B = {a,b} {( 0, a), (
Lecture 1.5: Proof Techniques CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda Heeren 1.
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.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
Section 9.1. Section Summary Relations and Functions Properties of Relations Reflexive Relations Symmetric and Antisymmetric Relations Transitive Relations.
9/27/2011 Lecture Mathematical Induction1 Lecture 3.1: Mathematical Induction* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from.
Chapter8 Relations 8.1: Relations and their properties.
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.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Relations Chapter 9.
Representing Relations
Lecture 4.1: Relations Basics
CS 173: Discrete Mathematical Structures
Lecture 4.3: Closures and Equivalence Relations
Relations and Their Properties
8.1 Relations and Their Properties
Lecture 4.1: Relations Basics
CS 250, Discrete Structures, Fall 2011 Nitesh Saxena
CS 250, Discrete Structures, Fall 2014
CS 250, Discrete Structures, Fall 2015
Lecture 4.3: Closures and Equivalence Relations
Relations and their Properties
Lecture 1.6: Proof Techniques (contd)
Lecture 2.1: Sets and Set Operations*
CS 250, Discrete Structures, Fall 2013
Lecture 4.1: Relations Basics
Lecture 1.6: Proof Techniques (contd)
CS 250, Discrete Structures, Fall 2012
Presentation transcript:

Lecture 4.1: Relations Basics CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren

10/24/2011Lecture 4.1: Relations Basics Course Admin Mid-Term 2 Exam How was it? Solution will be posted soon Should have the results by the coming weekend HW3 Was due yesterday Bonus problem? Solution will be posted soon Results should be ready by the coming weekend

Roadmap Done with about 60% of the course We are left with two more homeworks 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 Do you need periodic reminders? Still a lot of scope of improvement Done with travel for this semester – I will be fully at your disposal for the rest of the semester 10/24/2011Lecture 4.1: Relations Basics

10/24/2011Lecture 4.1: Relations Basics Outline Relation Definition and Examples Types of Relations Operations on Relations

Lecture 4.1: Relations Basics Relations Recall the definition of the Cartesian (Cross) Product: The Cartesian Product of sets A and B, A x B, is the set A x B = { : x  A and y  B}. A relation is just any subset of the CP!! R  AxB Ex: A = students; B = courses. R = {(a,b) | student a is enrolled in class b} We often say: aRb if (a,b) belongs to R 10/24/2011

Lecture 4.1: Relations Basics Relations vs. Functions Recall the definition of a function: f = { : b = f(a), a  A and b  B} Is every function a relation? Draw venn diagram of cross products, relations, functions Yes, a function is a special kind of relation. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations Reflexivity: A relation R on AxA is reflexive if for all a  A, (a,a)  R. Symmetry: A relation R on AxA is symmetric if (a,b)  R implies (b,a)  R. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations Transitivity: A relation on AxA is transitive if (a,b)  R and (b,c)  R imply (a,c)  R. Anti-symmetry: A relation on AxA is anti-symmetric if (a,b)  R implies (b,a)  R. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Techniques How can we check for the reflexive property? Draw a picture of the relation (called a “graph”). Vertex for every element of A Edge for every element of R Now, what’s R? {(1,1),(1,2),(1,3),(1,4),(2,2),(2,3),(2,4),(3,3),(3,4),(4,4)} Loops must exist on EVERY vertex. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Techniques How can we check for the symmetric property? Draw a picture of the relation (called a “graph”). Vertex for every element of A Edge for every element of R Now, what’s R? {(1,1),(1,2),(1,3),(1,4),(2,2),(2,3),(2,4),(3,3),(3,4),(4,4)} EVERY edge must have a return edge. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Techniques How can we check for transitivity? Draw a picture of the relation (called a “graph”). Vertex for every element of A Edge for every element of R Now, what’s R? {(1,1),(1,2),(1,3),(1,4),(2,2),(2,3),(2,4),(3,3),(3,4),(4,4)} A “short cut” must be present for EVERY path of length 2. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Techniques How can we check for the anti-symmetric property? Draw a picture of the relation (called a “graph”). Vertex for every element of A Edge for every element of R Now, what’s R? {(1,1),(1,2),(1,3),(1,4),(2,2),(2,3),(2,4),(3,3),(3,4),(4,4)} No edge can have a return edge. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Examples Let R be a relation on People, R={(x,y): x and y have lived in the same country} No Is R transitive? Is it reflexive? Yes Is it symmetric? Yes Is it anti-symmetric? No ? 1 ? 1 2 ? 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Examples Let R be a relation on positive integers, R={(x,y): 3|(x-y)} Yes Is R transitive? Suppose (x,y) and (y,z) are in R. Then we can write 3j = (x-y) and 3k = (y-z) Definition of “divides” Can we say 3m = (x-z)? Is (x,z) in R? Add prev eqn to get: 3j + 3k = (x-y) + (y-z) 3(j + k) = (x-z) 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Techniques Let R be a relation on positive integers, R={(x,y): 3|(x-y)} Yes Is R transitive? Is it reflexive? Yes Is (x,x) in R, for all x? Does 3k = (x-x) for some k? Definition of “divides” Yes, for k=0. 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Techniques Let R be a relation on positive integers, R={(x,y): 3|(x-y)} Yes Is R transitive? Is it reflexive? Yes Is it symmetric? Yes Suppose (x,y) is in R. Then 3j = (x-y) for some j. Definition of “divides” Yes, for k=-j. Does 3k = (y-x) for some k? 10/24/2011

Lecture 4.1: Relations Basics Properties of Relations - Techniques Let R be a relation on positive integers, R={(x,y): 3|(x-y)} Yes Is R transitive? Is it reflexive? Yes Is it symmetric? Yes Is it anti-symmetric? No Suppose (x,y) is in R. Then 3j = (x-y) for some j. Definition of “divides” Yes, for k=-j. Does 3k = (y-x) for some k? 10/24/2011

Lecture 4.1: Relations Basics More than one relation Suppose we have 2 relations, R 1 and R 2, and recall that relations are just sets! So we can take unions, intersections, complements, symmetric differences, etc. There are other things we can do as well… 10/24/2011

Lecture 4.1: Relations Basics More than one relation Let R be a relation from A to B (R  AxB), and let S be a relation from B to C (S  BxC). The composition of R and S is the relation from A to C (S  R  AxC): S  R = {(a,c):  b  B, (a,b)  R, (b,c)  S} S  R = {(1,u),(1,v),(2,t),(3,t),(4,u)} A BC x y z s t u v R S 10/24/2011

Lecture 4.1: Relations Basics More than one relation Let R be a relation on A. Inductively define R 1 = R R n+1 = R n  R R 2 = R 1  R = {(1,1),(1,2),(1,3),(2,3),(3,3),(4,1), (4,2)} A AA R R1R /24/2011

Lecture 4.1: Relations Basics More than one relation Let R be a relation on A. Inductively define R 1 = R R n+1 = R n  R R 3 = R 2  R = {(1,1),(1,2),(1,3),(2,3),(3,3),(4,1),(4,2),(4,3)} A AA R R2R … = R 4 = R 5 = R 6 … 10/24/2011

Lecture 4.1: Relations Basics Today’s Reading Rosen 9.1