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 (20)

Relations
RelationsRelations
Relations
 
Sets and relations
Sets and relationsSets and relations
Sets and relations
 
Recurrence relations
Recurrence relationsRecurrence relations
Recurrence relations
 
Regular language and Regular expression
Regular language and Regular expressionRegular language and Regular expression
Regular language and Regular expression
 
Relations and Its Applications
Relations and Its ApplicationsRelations and Its Applications
Relations and Its Applications
 
Set Theory
Set TheorySet Theory
Set Theory
 
Function and Its Types.
Function and Its Types.Function and Its Types.
Function and Its Types.
 
5.4 mathematical induction
5.4 mathematical induction5.4 mathematical induction
5.4 mathematical induction
 
Set concepts
Set conceptsSet concepts
Set concepts
 
Sequences and series
Sequences and seriesSequences and series
Sequences and series
 
Introductions to Relations
Introductions to RelationsIntroductions to Relations
Introductions to Relations
 
Relations and functions
Relations and functions Relations and functions
Relations and functions
 
Functions
FunctionsFunctions
Functions
 
Cartesian product of two sets
Cartesian product of two setsCartesian product of two sets
Cartesian product of two sets
 
Functions
FunctionsFunctions
Functions
 
Trees and graphs
Trees and graphsTrees and graphs
Trees and graphs
 
PPt on Functions
PPt on FunctionsPPt on Functions
PPt on Functions
 
System Of Linear Equations
System Of Linear EquationsSystem Of Linear Equations
System Of Linear Equations
 
Introduction to Set Theory
Introduction to Set TheoryIntroduction to Set Theory
Introduction to Set Theory
 
Sequences and Series
Sequences and SeriesSequences and Series
Sequences and Series
 

Similar to CMSC 203 Relations Matrix Representation

Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics NANDINI SHARMA
 
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
 
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
 

Similar to CMSC 203 Relations Matrix Representation (20)

Sadat sumon
Sadat sumonSadat sumon
Sadat sumon
 
Per5 relasi
Per5 relasiPer5 relasi
Per5 relasi
 
Properties of relations
Properties of relationsProperties of relations
Properties of relations
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics
 
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
 
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
 
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 )
 

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

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...liera silvan
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 

CMSC 203 Relations Matrix Representation

  • 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