SlideShare a Scribd company logo
1 of 15
Fall 2002 CMSC 203 - Discrete Structures 1
You Never Escape Your…You Never Escape Your…
RelationsRelations
Fall 2002 CMSC 203 - Discrete Structures 2
RelationsRelations
If we want to describe a relationship betweenIf we want to describe a relationship between
elements of two sets A and B, we can useelements of two sets A and B, we can use orderedordered
pairspairs with their first element taken from A andwith their first element taken from A and
their second element taken from B.their second element taken from B.
Since this is a relation betweenSince this is a relation between two setstwo sets, it is, it is
called acalled a binary relationbinary relation..
Definition:Definition: Let A and B be sets. A binary relationLet A and B be sets. A binary relation
from A to B is a subset of Afrom A to B is a subset of A××B.B.
In other words, for a binary relation R we haveIn other words, for a binary relation R we have
RR ⊆⊆ AA××B. We use the notation aRb to denote thatB. We use the notation aRb to denote that
(a, b)(a, b)∈∈R and aR and aRb to denote that (a, b)b to denote that (a, b)∉∉R.R.
Fall 2002 CMSC 203 - Discrete Structures 3
RelationsRelations
When (a, b) belongs to R, a is said to beWhen (a, b) belongs to R, a is said to be relatedrelated toto
b by R.b by R.
Example:Example: Let P be a set of people, C be a set ofLet P be a set of people, C be a set of
cars, and D be the relation describing which personcars, and D be the relation describing which person
drives which car(s).drives which car(s).
P = {Carl, Suzanne, Peter, Carla},P = {Carl, Suzanne, Peter, Carla},
C = {Mercedes, BMW, tricycle}C = {Mercedes, BMW, tricycle}
D = {(Carl, Mercedes), (Suzanne, Mercedes),D = {(Carl, Mercedes), (Suzanne, Mercedes),
(Suzanne, BMW), (Peter, tricycle)}(Suzanne, BMW), (Peter, tricycle)}
This means that Carl drives a Mercedes, SuzanneThis means that Carl drives a Mercedes, Suzanne
drives a Mercedes and a BMW, Peter drives adrives a Mercedes and a BMW, Peter drives a
tricycle, and Carla does not drive any of thesetricycle, and Carla does not drive any of these
vehicles.vehicles.
Fall 2002 CMSC 203 - Discrete Structures 4
Relations on a SetRelations on a Set
Definition:Definition: A relation on the set A is a relationA relation on the set A is a relation
from A to A.from A to A.
In other words, a relation on the set A is a subsetIn other words, a relation on the set A is a subset
of Aof A××A.A.
Example:Example: Let A = {1, 2, 3, 4}. Which ordered pairsLet A = {1, 2, 3, 4}. Which ordered pairs
are in the relation R = {(a, b) | a < b} ?are in the relation R = {(a, b) | a < b} ?
Fall 2002 CMSC 203 - Discrete Structures 5
Relations on a SetRelations on a Set
Solution:Solution: R = {R = {(1, 2),(1, 2), (1, 3),(1, 3), (1, 4),(1, 4), (2, 3),(2, 3),(2, 4),(2, 4),(3, 4)}(3, 4)}
RR 11 22 33 44
11
22
33
44
11 11
22
33
44
22
33
44
XX XX XX
XX XX
XX
Fall 2002 CMSC 203 - Discrete Structures 6
Properties of RelationsProperties of Relations
We will now look at some useful ways to classifyWe will now look at some useful ways to classify
relations.relations.
Definition:Definition: A relation R on a set A is calledA relation R on a set A is called
reflexivereflexive if (a, a)if (a, a)∈∈R for every element aR for every element a∈∈A.A.
Are the following relations on {1, 2, 3, 4} reflexive?Are the following relations on {1, 2, 3, 4} reflexive?
R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)}R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)} No.No.
R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)}R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)} Yes.Yes.
R = {(1, 1), (2, 2), (3, 3)}R = {(1, 1), (2, 2), (3, 3)} No.No.
Definition:Definition: A relation on a set A is calledA relation on a set A is called
irreflexiveirreflexive if (a, a)if (a, a)∉∉R for every element aR for every element a∈∈A.A.
Fall 2002 CMSC 203 - Discrete Structures 7
Properties of RelationsProperties of Relations
Definitions:Definitions:
A relation R on a set A is calledA relation R on a set A is called symmetricsymmetric if (b,if (b,
a)a)∈∈R whenever (a, b)R whenever (a, b)∈∈R for all a, bR for all a, b∈∈A.A.
A relation R on a set A is calledA relation R on a set A is called antisymmetricantisymmetric ifif
a = b whenever (a, b)a = b whenever (a, b)∈∈R and (b, a)R and (b, a)∈∈R.R.
A relation R on a set A is calledA relation R on a set A is called asymmetricasymmetric ifif
(a, b)(a, b)∈∈R implies that (b, a)R implies that (b, a)∉∉R for all a, bR for all a, b∈∈A.A.
Fall 2002 CMSC 203 - Discrete Structures 8
Properties of RelationsProperties of Relations
Are the following relations on {1, 2, 3, 4}Are the following relations on {1, 2, 3, 4}
symmetric, antisymmetric?symmetric, antisymmetric?
R = {(1, 1), (1, 2), (2, 1), (3, 3), (4, 4)}R = {(1, 1), (1, 2), (2, 1), (3, 3), (4, 4)} symmetricsymmetric
R = {(1, 1)}R = {(1, 1)} Sym. and antisym.Sym. and antisym.
R = {(1, 3), (3, 2), (2, 1)}R = {(1, 3), (3, 2), (2, 1)}
R = {(4, 4), (3, 3), (1, 4)}R = {(4, 4), (3, 3), (1, 4)}
antisym.antisym.
antisym.antisym.
Fall 2002 CMSC 203 - Discrete Structures 9
Properties of RelationsProperties of Relations
Definition:Definition: A relation R on a set A is calledA relation R on a set A is called
transitivetransitive if whenever (a, b)if whenever (a, b)∈∈R and (b, c)R and (b, c)∈∈R, thenR, then
(a, c)(a, c)∈∈R for a, b, cR for a, b, c∈∈A.A.
Are the following relations on {1, 2, 3, 4}Are the following relations on {1, 2, 3, 4}
transitive?transitive?
R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)}R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)} Yes.Yes.
R = {(1, 3), (3, 2), (2, 1)}R = {(1, 3), (3, 2), (2, 1)} No.No.
R = {(2, 4), (4, 3), (2, 3), (4, 1)}R = {(2, 4), (4, 3), (2, 3), (4, 1)} No.No.
Fall 2002 CMSC 203 - Discrete Structures 10
Representing RelationsRepresenting Relations
Example:Example: How can we represent the relationHow can we represent the relation
R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix?R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix?
Solution:Solution: The matrix MThe matrix MRR is given byis given by










=
11
01
00
RM
Fall 2002 CMSC 203 - Discrete Structures 11
Representing RelationsRepresenting Relations
What do we know about the matrices representingWhat do we know about the matrices representing
aa relation on a setrelation on a set (a relation from A to A) ?(a relation from A to A) ?
They areThey are squaresquare matrices.matrices.
What do we know about matrices representingWhat do we know about matrices representing
reflexivereflexive relations?relations?
All the elements on theAll the elements on the diagonaldiagonal of such matricesof such matrices
MMrefref must bemust be 1s1s..




















=
1
.
.
.
1
1
refM
Fall 2002 CMSC 203 - Discrete Structures 12
Representing RelationsRepresenting Relations
What do we know about the matrices representingWhat do we know about the matrices representing
symmetric relationssymmetric relations??
These matrices are symmetric, that is, MThese matrices are symmetric, that is, MRR = (M= (MRR))tt
..












=
1101
1001
0010
1101
RM
symmetric matrix,symmetric matrix,
symmetric relation.symmetric relation.












=
0011
0011
0011
0011
RM
non-symmetric matrix,non-symmetric matrix,
non-symmetric relation.non-symmetric relation.
Fall 2002 CMSC 203 - Discrete Structures 13
Representing RelationsRepresenting Relations
The Boolean operationsThe Boolean operations joinjoin andand meetmeet (you(you
remember?)remember?) can be used to determine the matricescan be used to determine the matrices
representing therepresenting the unionunion and theand the intersectionintersection of twoof two
relations, respectively.relations, respectively.
To obtain theTo obtain the joinjoin of two zero-one matrices, weof two zero-one matrices, we
apply the Boolean “or” function to all correspondingapply the Boolean “or” function to all corresponding
elements in the matrices.elements in the matrices.
To obtain theTo obtain the meetmeet of two zero-one matrices, weof two zero-one matrices, we
apply the Boolean “and” function to all correspondingapply the Boolean “and” function to all corresponding
elements in the matrices.elements in the matrices.
14
Representing Relations Using MatricesRepresenting Relations Using Matrices
Example:Example: How can we represent the relationHow can we represent the relation
R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix?R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix?
Solution:Solution: The matrix MThe matrix MRR is given byis given by










=
11
01
00
RM
Fall 2002 CMSC 203 - Discrete Structures 15
Representing Relations Using MatricesRepresenting Relations Using Matrices
Example:Example: Let the relations R and S be representedLet the relations R and S be represented
by the matricesby the matrices










=∨=∪
011
111
101
SRSR MMM










=
001
110
101
SM
What are the matrices representing RWhat are the matrices representing R∪∪S and RS and R∩∩S?S?
Solution:Solution: These matrices are given byThese matrices are given by










=∧=∩
000
000
101
SRSR MMM










=
010
001
101
RM

More Related Content

What's hot

Function and Its Types.
Function and Its Types.Function and Its Types.
Function and Its Types.Awais Bakshy
 
CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relationsallyn joy calcaben
 
Cyclic group- group theory
Cyclic group- group theoryCyclic group- group theory
Cyclic group- group theoryAyush Agrawal
 
Relations & functions.pps
Relations  &  functions.ppsRelations  &  functions.pps
Relations & functions.ppsindu psthakur
 
Relation and function
Relation and functionRelation and function
Relation and functionAadityaGera
 
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial OrderingCMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Orderingallyn joy calcaben
 
Functions in discrete mathematics
Functions in discrete mathematicsFunctions in discrete mathematics
Functions in discrete mathematicsRachana Pathak
 
Set Theory
Set TheorySet Theory
Set Theoryitutor
 
Sequences and Series
Sequences and SeriesSequences and Series
Sequences and Seriessujathavvv
 
the fourier series
the fourier seriesthe fourier series
the fourier seriessafi al amu
 
Methods of solving ODE
Methods of solving ODEMethods of solving ODE
Methods of solving ODEkishor pokar
 
CMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their PropertiesCMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their Propertiesallyn joy calcaben
 
PPt on Functions
PPt on FunctionsPPt on Functions
PPt on Functionscoolhanddav
 
Ideals and factor rings
Ideals and factor ringsIdeals and factor rings
Ideals and factor ringsdianageorge27
 

What's hot (20)

Function and Its Types.
Function and Its Types.Function and Its Types.
Function and Its Types.
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relations
 
Cyclic group- group theory
Cyclic group- group theoryCyclic group- group theory
Cyclic group- group theory
 
Relations & functions.pps
Relations  &  functions.ppsRelations  &  functions.pps
Relations & functions.pps
 
Relation and function
Relation and functionRelation and function
Relation and function
 
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial OrderingCMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
 
Metric space
Metric spaceMetric space
Metric space
 
Sets, functions and groups
Sets, functions and groupsSets, functions and groups
Sets, functions and groups
 
Tree (Data Structure & Discrete Mathematics)
Tree (Data Structure & Discrete Mathematics)Tree (Data Structure & Discrete Mathematics)
Tree (Data Structure & Discrete Mathematics)
 
Functions in discrete mathematics
Functions in discrete mathematicsFunctions in discrete mathematics
Functions in discrete mathematics
 
7 functions
7   functions7   functions
7 functions
 
Set Theory
Set TheorySet Theory
Set Theory
 
Sequences and Series
Sequences and SeriesSequences and Series
Sequences and Series
 
the fourier series
the fourier seriesthe fourier series
the fourier series
 
Methods of solving ODE
Methods of solving ODEMethods of solving ODE
Methods of solving ODE
 
CMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their PropertiesCMSC 56 | Lecture 13: Relations and their Properties
CMSC 56 | Lecture 13: Relations and their Properties
 
PPt on Functions
PPt on FunctionsPPt on Functions
PPt on Functions
 
Ideals and factor rings
Ideals and factor ringsIdeals and factor rings
Ideals and factor rings
 
Types of function
Types of function Types of function
Types of function
 

Similar to Relations

Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics NANDINI SHARMA
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsWongyos Keardsri
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfSanjanaAdri
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxRockyIslam5
 
Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1RAHUL SINGH
 
CMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing RelationsCMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing Relationsallyn joy calcaben
 
Relations
RelationsRelations
RelationsNiliha
 
Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )OliverBaltazar2
 
Relational Algebra (1).pptx
Relational Algebra (1).pptxRelational Algebra (1).pptx
Relational Algebra (1).pptxSarowarSuman
 

Similar to Relations (20)

Sadat sumon
Sadat sumonSadat sumon
Sadat sumon
 
Per5 relasi
Per5 relasiPer5 relasi
Per5 relasi
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 Relations
 
Relations
RelationsRelations
Relations
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdf
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptx
 
Relations
RelationsRelations
Relations
 
Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1Ncert class-12-mathematics-part-1
Ncert class-12-mathematics-part-1
 
CMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing RelationsCMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing Relations
 
Lemh101
Lemh101Lemh101
Lemh101
 
Relations and functions
Relations and functionsRelations and functions
Relations and functions
 
Relations
RelationsRelations
Relations
 
Introductions to Relations
Introductions to RelationsIntroductions to Relations
Introductions to Relations
 
Relation and function_xii
Relation and function_xiiRelation and function_xii
Relation and function_xii
 
Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )
 
Relational Algebra (1).pptx
Relational Algebra (1).pptxRelational Algebra (1).pptx
Relational Algebra (1).pptx
 

More from Ali Saleem

Nested quantifiers
Nested quantifiersNested quantifiers
Nested quantifiersAli Saleem
 
Sequences and summations
Sequences and summationsSequences and summations
Sequences and summationsAli Saleem
 
Nested quantifiers
Nested quantifiersNested quantifiers
Nested quantifiersAli Saleem
 
Writing a memo, letter, and e mail
Writing a memo, letter, and e mailWriting a memo, letter, and e mail
Writing a memo, letter, and e mailAli Saleem
 
Challenges for the newborn state
Challenges for the newborn  stateChallenges for the newborn  state
Challenges for the newborn stateAli Saleem
 
Objectives or goals of technical communication
Objectives or goals of technical communicationObjectives or goals of technical communication
Objectives or goals of technical communicationAli Saleem
 
17 using rules of inference to build arguments
17   using rules of inference to build arguments17   using rules of inference to build arguments
17 using rules of inference to build argumentsAli Saleem
 

More from Ali Saleem (9)

Trees
TreesTrees
Trees
 
Nested quantifiers
Nested quantifiersNested quantifiers
Nested quantifiers
 
Graphs
GraphsGraphs
Graphs
 
Sequences and summations
Sequences and summationsSequences and summations
Sequences and summations
 
Nested quantifiers
Nested quantifiersNested quantifiers
Nested quantifiers
 
Writing a memo, letter, and e mail
Writing a memo, letter, and e mailWriting a memo, letter, and e mail
Writing a memo, letter, and e mail
 
Challenges for the newborn state
Challenges for the newborn  stateChallenges for the newborn  state
Challenges for the newborn state
 
Objectives or goals of technical communication
Objectives or goals of technical communicationObjectives or goals of technical communication
Objectives or goals of technical communication
 
17 using rules of inference to build arguments
17   using rules of inference to build arguments17   using rules of inference to build arguments
17 using rules of inference to build arguments
 

Recently uploaded

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 

Recently uploaded (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

Relations

  • 1. Fall 2002 CMSC 203 - Discrete Structures 1 You Never Escape Your…You Never Escape Your… RelationsRelations
  • 2. Fall 2002 CMSC 203 - Discrete Structures 2 RelationsRelations If we want to describe a relationship betweenIf we want to describe a relationship between elements of two sets A and B, we can useelements of two sets A and B, we can use orderedordered pairspairs with their first element taken from A andwith their first element taken from A and their second element taken from B.their second element taken from B. Since this is a relation betweenSince this is a relation between two setstwo sets, it is, it is called acalled a binary relationbinary relation.. Definition:Definition: Let A and B be sets. A binary relationLet A and B be sets. A binary relation from A to B is a subset of Afrom A to B is a subset of A××B.B. In other words, for a binary relation R we haveIn other words, for a binary relation R we have RR ⊆⊆ AA××B. We use the notation aRb to denote thatB. We use the notation aRb to denote that (a, b)(a, b)∈∈R and aR and aRb to denote that (a, b)b to denote that (a, b)∉∉R.R.
  • 3. Fall 2002 CMSC 203 - Discrete Structures 3 RelationsRelations When (a, b) belongs to R, a is said to beWhen (a, b) belongs to R, a is said to be relatedrelated toto b by R.b by R. Example:Example: Let P be a set of people, C be a set ofLet P be a set of people, C be a set of cars, and D be the relation describing which personcars, and D be the relation describing which person drives which car(s).drives which car(s). P = {Carl, Suzanne, Peter, Carla},P = {Carl, Suzanne, Peter, Carla}, C = {Mercedes, BMW, tricycle}C = {Mercedes, BMW, tricycle} D = {(Carl, Mercedes), (Suzanne, Mercedes),D = {(Carl, Mercedes), (Suzanne, Mercedes), (Suzanne, BMW), (Peter, tricycle)}(Suzanne, BMW), (Peter, tricycle)} This means that Carl drives a Mercedes, SuzanneThis means that Carl drives a Mercedes, Suzanne drives a Mercedes and a BMW, Peter drives adrives a Mercedes and a BMW, Peter drives a tricycle, and Carla does not drive any of thesetricycle, and Carla does not drive any of these vehicles.vehicles.
  • 4. Fall 2002 CMSC 203 - Discrete Structures 4 Relations on a SetRelations on a Set Definition:Definition: A relation on the set A is a relationA relation on the set A is a relation from A to A.from A to A. In other words, a relation on the set A is a subsetIn other words, a relation on the set A is a subset of Aof A××A.A. Example:Example: Let A = {1, 2, 3, 4}. Which ordered pairsLet A = {1, 2, 3, 4}. Which ordered pairs are in the relation R = {(a, b) | a < b} ?are in the relation R = {(a, b) | a < b} ?
  • 5. Fall 2002 CMSC 203 - Discrete Structures 5 Relations on a SetRelations on a Set Solution:Solution: R = {R = {(1, 2),(1, 2), (1, 3),(1, 3), (1, 4),(1, 4), (2, 3),(2, 3),(2, 4),(2, 4),(3, 4)}(3, 4)} RR 11 22 33 44 11 22 33 44 11 11 22 33 44 22 33 44 XX XX XX XX XX XX
  • 6. Fall 2002 CMSC 203 - Discrete Structures 6 Properties of RelationsProperties of Relations We will now look at some useful ways to classifyWe will now look at some useful ways to classify relations.relations. Definition:Definition: A relation R on a set A is calledA relation R on a set A is called reflexivereflexive if (a, a)if (a, a)∈∈R for every element aR for every element a∈∈A.A. Are the following relations on {1, 2, 3, 4} reflexive?Are the following relations on {1, 2, 3, 4} reflexive? R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)}R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)} No.No. R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)}R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)} Yes.Yes. R = {(1, 1), (2, 2), (3, 3)}R = {(1, 1), (2, 2), (3, 3)} No.No. Definition:Definition: A relation on a set A is calledA relation on a set A is called irreflexiveirreflexive if (a, a)if (a, a)∉∉R for every element aR for every element a∈∈A.A.
  • 7. Fall 2002 CMSC 203 - Discrete Structures 7 Properties of RelationsProperties of Relations Definitions:Definitions: A relation R on a set A is calledA relation R on a set A is called symmetricsymmetric if (b,if (b, a)a)∈∈R whenever (a, b)R whenever (a, b)∈∈R for all a, bR for all a, b∈∈A.A. A relation R on a set A is calledA relation R on a set A is called antisymmetricantisymmetric ifif a = b whenever (a, b)a = b whenever (a, b)∈∈R and (b, a)R and (b, a)∈∈R.R. A relation R on a set A is calledA relation R on a set A is called asymmetricasymmetric ifif (a, b)(a, b)∈∈R implies that (b, a)R implies that (b, a)∉∉R for all a, bR for all a, b∈∈A.A.
  • 8. Fall 2002 CMSC 203 - Discrete Structures 8 Properties of RelationsProperties of Relations Are the following relations on {1, 2, 3, 4}Are the following relations on {1, 2, 3, 4} symmetric, antisymmetric?symmetric, antisymmetric? R = {(1, 1), (1, 2), (2, 1), (3, 3), (4, 4)}R = {(1, 1), (1, 2), (2, 1), (3, 3), (4, 4)} symmetricsymmetric R = {(1, 1)}R = {(1, 1)} Sym. and antisym.Sym. and antisym. R = {(1, 3), (3, 2), (2, 1)}R = {(1, 3), (3, 2), (2, 1)} R = {(4, 4), (3, 3), (1, 4)}R = {(4, 4), (3, 3), (1, 4)} antisym.antisym. antisym.antisym.
  • 9. Fall 2002 CMSC 203 - Discrete Structures 9 Properties of RelationsProperties of Relations Definition:Definition: A relation R on a set A is calledA relation R on a set A is called transitivetransitive if whenever (a, b)if whenever (a, b)∈∈R and (b, c)R and (b, c)∈∈R, thenR, then (a, c)(a, c)∈∈R for a, b, cR for a, b, c∈∈A.A. Are the following relations on {1, 2, 3, 4}Are the following relations on {1, 2, 3, 4} transitive?transitive? R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)}R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)} Yes.Yes. R = {(1, 3), (3, 2), (2, 1)}R = {(1, 3), (3, 2), (2, 1)} No.No. R = {(2, 4), (4, 3), (2, 3), (4, 1)}R = {(2, 4), (4, 3), (2, 3), (4, 1)} No.No.
  • 10. Fall 2002 CMSC 203 - Discrete Structures 10 Representing RelationsRepresenting Relations Example:Example: How can we represent the relationHow can we represent the relation R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix?R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix? Solution:Solution: The matrix MThe matrix MRR is given byis given by           = 11 01 00 RM
  • 11. Fall 2002 CMSC 203 - Discrete Structures 11 Representing RelationsRepresenting Relations What do we know about the matrices representingWhat do we know about the matrices representing aa relation on a setrelation on a set (a relation from A to A) ?(a relation from A to A) ? They areThey are squaresquare matrices.matrices. What do we know about matrices representingWhat do we know about matrices representing reflexivereflexive relations?relations? All the elements on theAll the elements on the diagonaldiagonal of such matricesof such matrices MMrefref must bemust be 1s1s..                     = 1 . . . 1 1 refM
  • 12. Fall 2002 CMSC 203 - Discrete Structures 12 Representing RelationsRepresenting Relations What do we know about the matrices representingWhat do we know about the matrices representing symmetric relationssymmetric relations?? These matrices are symmetric, that is, MThese matrices are symmetric, that is, MRR = (M= (MRR))tt ..             = 1101 1001 0010 1101 RM symmetric matrix,symmetric matrix, symmetric relation.symmetric relation.             = 0011 0011 0011 0011 RM non-symmetric matrix,non-symmetric matrix, non-symmetric relation.non-symmetric relation.
  • 13. Fall 2002 CMSC 203 - Discrete Structures 13 Representing RelationsRepresenting Relations The Boolean operationsThe Boolean operations joinjoin andand meetmeet (you(you remember?)remember?) can be used to determine the matricescan be used to determine the matrices representing therepresenting the unionunion and theand the intersectionintersection of twoof two relations, respectively.relations, respectively. To obtain theTo obtain the joinjoin of two zero-one matrices, weof two zero-one matrices, we apply the Boolean “or” function to all correspondingapply the Boolean “or” function to all corresponding elements in the matrices.elements in the matrices. To obtain theTo obtain the meetmeet of two zero-one matrices, weof two zero-one matrices, we apply the Boolean “and” function to all correspondingapply the Boolean “and” function to all corresponding elements in the matrices.elements in the matrices.
  • 14. 14 Representing Relations Using MatricesRepresenting Relations Using Matrices Example:Example: How can we represent the relationHow can we represent the relation R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix?R = {(2, 1), (3, 1), (3, 2)} as a zero-one matrix? Solution:Solution: The matrix MThe matrix MRR is given byis given by           = 11 01 00 RM
  • 15. Fall 2002 CMSC 203 - Discrete Structures 15 Representing Relations Using MatricesRepresenting Relations Using Matrices Example:Example: Let the relations R and S be representedLet the relations R and S be represented by the matricesby the matrices           =∨=∪ 011 111 101 SRSR MMM           = 001 110 101 SM What are the matrices representing RWhat are the matrices representing R∪∪S and RS and R∩∩S?S? Solution:Solution: These matrices are given byThese matrices are given by           =∧=∩ 000 000 101 SRSR MMM           = 010 001 101 RM