Professional Documents
Culture Documents
Lahore Campus
CSC102 - Discrete Structures
By
Mahwish Waqas
06/29/2021 CSC102 - Discrete Structures 2
Lecture Outline
• Relations
• What is a Relation?
• Binary Relation
• Representation of Relation
• Relation Properties
• Combining Relations
06/29/2021 CSC102 - Discrete Structures 3
Relations
• The connections between people and things.
Cartesian Product
• The Cartesian product of sets A and B, denoted by A B, is
the set of all ordered pairs of elements from A and B.
Relations
Binary Relation
•
• Let A and B be sets. A binary relation from set A to set B
is any subset of .
• Binary relations represent relationship between two sets.
06/29/2021 CSC102 - Discrete Structures 8
Example
•
06/29/2021 CSC102 - Discrete Structures 9
More Relations
•
• Relations can be generalized to subsets of cartesian
products of more than two sets
Functions as Relations
• A function f:AB is a relation from A to B
• A relation from A to B is not always a function f:AB
• Relations are generalizations of functions!
06/29/2021 CSC102 - Discrete Structures 11
Relations on a Set
• A (binary) relation from a set A to itself is called a relation
on the set A.
06/29/2021 CSC102 - Discrete Structures 12
Relations on a Set
• A (binary) relation from a set A to itself is called a relation
on the set A.
06/29/2021 CSC102 - Discrete Structures 13
Reflexivity
• Note: from now on we will consider only binary relations
on A.
• That is such relations are subsets of .
• Reflexivity: A binary relation is said to be reflexive if
• is reflexive.
06/29/2021 CSC102 - Discrete Structures 19
Reflexivity
06/29/2021 CSC102 - Discrete Structures 20
Symmetricity
• Symmetricity: A binary relation said to be symmetric if,
• is symmetric, because if a is a sibling of b, then b is a
sibling of a
06/29/2021 CSC102 - Discrete Structures 21
Symmetricity
06/29/2021 CSC102 - Discrete Structures 22
Transitivity:
• Transitivity: A binary relation said to be transitive if,
• is transitive, because if, and then
If Transitive
Case 1 Ture True Ture
Case
Case 2
2 Ture
Ture False
False False
False
Case
Case 3
3 False
False Ture
Ture
06/29/2021 CSC102 - Discrete Structures 23
Transitivity:
Transitive
Non-Zero Non-Zero Ture
Non-Zero Zero True
Zero Non-Zero False
06/29/2021 CSC102 - Discrete Structures 24
Anti-Symmetricity
• Anti-Symmetricity: A binary relation said to be anti-
symmetric, if
• The relation Motherhood ('x is the mother of y') is anti-
symmetric, because if x is a mother of y, then y is not the
mother of x.
06/29/2021 CSC102 - Discrete Structures 25
Anti-Symmetricity
Anti-Symmetricity
Case 1 Ture True Ture
Case
Case 2
2 Ture
Ture False
False False
False
Case
Case 3
3 False
False Ture
Ture
06/29/2021 CSC102 - Discrete Structures 26
Equivalence Relations
• A relation on a set A is called an equivalence relation if it
is reflexive, symmetric, and transitive.
06/29/2021 CSC102 - Discrete Structures 27
Example
• Which of these relations on {0, 1, 2, 3} are equivalence
relations? Determine the properties of an equivalence
relation that the others lack
• { (0,0), (1,1), (2,2), (3,3) }
• Has all the properties, thus, is an equivalence relation
• { (0,0), (0,2), (2,0), (2,2), (2,3), (3,2), (3,3) }
• Not reflexive: (1,1) is missing
• Not transitive: (0,2) and (2,3) are in the relation, but not (0,3)
• { (0,0), (1,1), (1,2), (2,1), (2,2), (3,3) }
• Has all the properties, thus, is an equivalence relation
• { (0,0), (1,1), (1,3), (2,2), (2,3), (3,1), (3,2) (3,3) }
• Not transitive: (1,3) and (3,2) are in the relation, but not (1,2)
• { (0,0), (0,1) (0,2), (1,0), (1,1), (1,2), (2,0), (2,2), (3,3) }
• Not symmetric: (1,2) is present, but not (2,1)
• Not transitive: (2,0) and (0,1) are in the relation, but not (2,1)
06/29/2021 CSC102 - Discrete Structures 28
Combining Relations
• Relations from are subsets of , two relations from A to B
can be combined in any way two sets can be combined.
• Let
• The relations
06/29/2021 CSC102 - Discrete Structures 29
Combining Relations
•
• Let
• The relations
06/29/2021 CSC102 - Discrete Structures 30
Combining Relations
• Let be a relation from a set to a set and be a relation
from to a set The composite of and is the relation
consisting of ordered pairs , where and for which their
exists an element such that and We denote the
composite of and by
• What is the composite of the relations and , where is
the relation from with
and
is the relation from with
06/29/2021 CSC102 - Discrete Structures 31
Combining Relations
•
Find .
06/29/2021 CSC102 - Discrete Structures 32
Exercise
•1. Find .
2. Find using matrix representing of the relations. Let
is the relation from with
and
is the relation from with
06/29/2021 CSC102 - Discrete Structures 33
Exercise
06/29/2021 CSC102 - Discrete Structures 34
Examples
•
• Parenthood ('x is the parent of y')
• Brotherhood ('x is the brother of y')
• Neighborhood ('x is the neighbor of y')
• Ownership ('x is the owner of y‘)
• 'x divides y'
•xy
•x=y
•x<y
06/29/2021 CSC102 - Discrete Structures 35
Chapter # 9
Topic # 9.1
Q-1,2,3,10,11,18,30,32
Topic # 9.3
Q-1,2,3,4,5,6,7,8,13-c,14,23-28