Discrete Mathematics Relations

Slides:



Advertisements
Similar presentations
Equivalence Relations
Advertisements

The Engineering Design of Systems: Models and Methods
Basic Properties of Relations
Relations.
Discrete Mathematics Lecture # 16 Inverse of Relations.
CS2210(22C:19) Discrete Structures Relations Spring 2015 Sukumar Ghosh.
CSE115/ENGR160 Discrete Mathematics 04/24/12 Ming-Hsuan Yang UC Merced 1.
Discrete Mathematics Lecture#11.
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.
Reminders: –Test3 is scheduled for Friday, April 25 was sent that included a proposed schedule –HW 8 is due Wednesday, April 9 in class Pascal’s.
1 Representing Relations Epp section ??? CS 202 Aaron Bloomfield.
Relations Chapter 9.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 8: Relations Relations(8.1) n-any Relations &
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.
1 Relations and Their Properties Epp, section ??? CS 202 Aaron Bloomfield.
Properties of Relations In many applications to computer science and applied mathematics, we deal with relations on a set A rather than relations from.
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.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Lecture 14 Relations CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
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.
Relations and Their Properties
April 14, 2015Applied Discrete Mathematics Week 10: Equivalence Relations 1 Properties of Relations Definition: A relation R on a set A is called transitive.
1 Relations and Their Properties Rosen, section 7.1 CS/APMA 202 Aaron Bloomfield.
Chapter 7: Relations Relations(7.1) Relations(7.1) n-any Relations & their Applications (7.2) n-any Relations & their Applications (7.2)
Representing Relations
Section 4.4 Properties of Relations. Order Relations Draw an arrow diagram for the relation R defined on the set {1,2,3,4} such that
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
CS 103 Discrete Structures Lecture 19 Relations. Chapter 9.
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
1 Partial Orderings Aaron Bloomfield CS 202 Epp, section ???
Discrete Mathematics SETS. What is a set? ^A set is a unordered collection of “objects”  People in a class: {A yşe, B arış, C anan }  Cities in Turkey.
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
1 Equivalence relations Binary relations: –Let S1 and S2 be two sets, and R be a (binary relation) from S1 to S2 –Not every x in S1 and y in S2 have such.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
ORDERED SETS. RELATIONS COSC-1321 Discrete Structures 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 B = {a,b} {( 0, a), (
Discrete Mathematics Functions
Section 9.1. Section Summary Relations and Functions Properties of Relations Reflexive Relations Symmetric and Antisymmetric Relations Transitive Relations.
Lecture 7: Relations Dr Andrew Purkiss-Trew Cancer Research UK Mathematics for Computing.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Citra Noviyasari, S.Si, MT
Chapter 5 Relations and Operations
Relations and Their Properties
Relations Chapter 9.
Applied Discrete Mathematics Week 10: Relations
RELATION KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS )
Dr. Ameria Eldosoky Discrete mathematics
Cartesian product Given two sets A, B we define their Cartesian product is the set of all the pairs whose first element is in A and second in B. Note that.
Relations and Their Properties
CSE 504 Discrete Structures & Foundations of Computer Science
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 9 Relations Slides are adopted from.
Applied Discrete Mathematics Week 9: Equivalence Relations
CS2210 Discrete Structures Relations
Relations and Their Properties
8.1 Relations and Their Properties
CSE15 Discrete Mathematics 04/26/17
Applied Discrete Mathematics Week 5: Boolean Algebra
Applied Discrete Mathematics Week 6: Relations/Digraphs
Relations and their Properties
Introduction to Relations and Functions
Properties of Relations
Discrete Math (2) Haiming Chen Associate Professor, PhD
Equivalence relations
Combining relations via relational composition
Equivalence Relations
Agenda Lecture Content: Relations (Relasi)
Presentation transcript:

Discrete Mathematics Relations

What is a relation Relation generalizes the notion of functions. Recall: A function takes EACH element from a set and maps it to a UNIQUE element in another set f: X  Y  x  X,  y such that f(x) = y Let A and B be sets. A binary relation R from A to B is a subset of A  B Recall: A x B = {(a, b) | a  A, b  B} aRb: (a, b)  R. Application Relational database model is based on the concept of relation.

What is a relation Example Let A be the students in a the CS major A = {Ayşe, Barış, Canan, Davut} Let B be the courses the department offers B = {BİM111, BİM122, BİM124} We specify relation R  A  B as the set that lists all students a  A enrolled in class b  B R = {(Ayşe, BİM111), (Barış, BİM122), (Barış, BİM124), (Davut, BİM122), (Davut, BİM124)}

More relation examples Another relation example: Let A be the cities in Turkey Let B be the districts in Turkey We define R to mean a is a district in city b Thus, the following are in our relation: (Bakırköy, İstanbul) (Keçiören, Ankara) (Nilüfer, Bursa) (Tepebaşı, Eskişehir) etc… Most relations we will see deal with ordered pairs of integers

Representing relations We can represent relations graphically: We can represent relations in a table: BİM111 BİM122 BİM124 Ayşe X Barış Canan Davut BİM111 BİM122 BİM124 Ayşe Barış Canan Davut Not valid functions!

Relations vs. functions If R  X  Y is a relation, then is R a function? If f: X  Y is a function, then is f a relation?

Relations on a set A relation on the set A is a relation from A to A In other words, the domain and co-domain are the same set We will generally be studying relations of this type

Relations on a set R 1 2 3 4 X Let A be the set { 1, 2, 3, 4 } Which ordered pairs are in the relation R = { (a,b) | a divides b } R = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4)} 1 2 3 4 1 2 3 4 R 1 2 3 4 X

More examples Consider some relations on the set Z Are the following ordered pairs in the relation? (1,1) (1,2) (2,1) (1,-1) (2,2) R1 = { (a,b) | a≤b } R2 = { (a,b) | a>b } R3 = { (a,b) | a=|b| } R4 = { (a,b) | a=b } R5 = { (a,b) | a=b+1 } R6 = { (a,b) | a+b≤3 } X X X X X X X X X X X X X X X

Relation properties Six properties of relations we will study: Reflexive Irreflexive Symmetric Asymmetric Antisymmetric Transitive

Reflexivity vs. Irreflexivity Definition: A relation is reflexive if (a,a)  R for all a  A Irreflexivity Definition: A relation is irreflexive if (a,a)  R for all a  A Examples Is the “divides” relation on Z+ reflexive? Is the “” (not ) relation on a P(A) irreflexive? = < >   reflexive o x x o o irreflexive x o o x x

Reflexivity vs. Irreflexivity A relation can be neither reflexive nor irreflexive Example? A = {1, 2}, R = {(1, 1)} It is not reflexive, since (2, 2)  R, It is not irreflexive, since (1, 1)  R.

Symmetry, Asymmetry, Antisymmetry A relation is symmetric if for all a, b  A, (a,b)  R (b,a)  R A relation is asymmetric if for all a, b  A, (a,b)  R  (b,a)  R A relation is antisymmetric if for all a, b  A, ((a,b)  R  (b,a)  R)  a=b (Second definition) for all a, b  A, ((a,b)  R  a  b)  (b,a)  R) < > =   isTwinOf symmetric x x o x x o asymmetric o o x x x x antisymmetric o o o o o x

Notes on *symmetric relations A relation can be neither symmetric or asymmetric R = { (a,b) | a=|b| } This is not symmetric -4 is not related to itself This is not asymmetric 4 is related to itself Note that it is antisymmetric

Transitivity A relation is transitive if for all a, b, c  A, ((a,b)R  (b,c)R)  (a,c)R If a < b and b < c, then a < c Thus, < is transitive If a = b and b = c, then a = c Thus, = is transitive

Transitivity examples Consider isAncestorOf() Let Ayşe be Barış’s ancestor, and Barış be Canan’s ancestor Thus, Ayşe is an ancestor of Barış, and Barış is an ancestor of Canan Thus, Ayşe is an ancestor of Canan Thus, isAncestorOf() is a transitive relation Consider isParentOf() Let Ayşe be Barış’s parent, and Barış be Canan’s parent Thus, Ayşe is a parent of Barış, and Barış is a parent of Canan However, Ayşe is not a parent of Canan Thus, isParentOf() is not a transitive relation

Summary of properties of relations reflexive a (a, a)  R irreflexive a (a, a)  R symmetric  a, b  A, (a,b)  R  (b,a)  R asymmetric  a, b  A, (a,b)  R  (b,a)  R antisymmetric  a, b  A, ((a,b)  R  (b,a)  R)  a=b (*)for all a, b  A, ((a,b)  R  a  b)  (b,a)  R) transitive  a, b, c  A, ((a,b)  R  (b,c)  R)  (a,c)  R (*) Alternative definition…

Combining relations There are two ways to combine relations R1 and R2 Via Set operators Via relation “composition”

Combining relations via Set operators Consider two relations R≥ and R≤ R≥ U R≤ = all numbers ≥ OR ≤ That’s all the numbers R≥ ∩ R≤ = all numbers ≥ AND ≤ That’s all numbers equal to R≥  R≤ = all numbers ≥ or ≤, but not both That’s all numbers not equal to R≥ - R≤ = all numbers ≥ that are not also ≤ That’s all numbers strictly greater than R≤ - R≥ = all numbers ≤ that are not also ≥ That’s all numbers strictly less than Note that it’s possible the result is the empty set

Combining via relational composition Similar to function composition Let R be a relation from A to B, and S be a relation from B to C Let a  A, b  B, and c  C Let (a,b)  R, and (b,c)  S Then the composite of R and S consists of the ordered pairs (a,c) We denote the relation by S ◦ R Note that S comes first when writing the composition! (a, c)  S ◦ R if  b such that (a, b)  R, and (b,c)  S

Combining via relational composition Let M be the relation “is mother of” Let F be the relation “is father of” What is M ◦ F? If (a,b)  F, then a is the father of b If (b,c)  M, then b is the mother of c Thus, M ◦ F denotes the relation “maternal grandfather” What is F ◦ M? If (a,b)  M, then a is the mother of b If (b,c)  F, then b is the father of c Thus, F ◦ M denotes the relation “paternal grandmother” What is M ◦ M? Thus, M ◦ M denotes the relation “maternal grandmother”

Combining via relational composition Given relation R R ◦ R can be denoted by R2 R2 ◦ R = (R ◦ R) ◦ R = R3 Example: M3 is your mother’s mother’s mother