0% found this document useful (0 votes)
6 views

Chapter 9

Chapter 9 discusses relations and their properties, including reflexive, symmetric, antisymmetric, and transitive relations. It explains how to represent relations graphically and through tables, and provides examples of binary relations on sets. The chapter also covers combining relations and the concept of composition of relations.

Uploaded by

Selman Bayburt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Chapter 9

Chapter 9 discusses relations and their properties, including reflexive, symmetric, antisymmetric, and transitive relations. It explains how to represent relations graphically and through tables, and provides examples of binary relations on sets. The chapter also covers combining relations and the concept of composition of relations.

Uploaded by

Selman Bayburt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 57

Relations

Chapter 9
Chapter Summary
Relations and Their Properties
Representing Relations
Equivalence Relations
Partial Orderings
Relations and Their
Properties
Section 9.1
Section Summary
Relations and Functions
Properties of Relations
Reflexive Relations
Symmetric and Antisymmetric Relations
Transitive Relations
Combining Relations
Binary Relations
to a set B is a subset R ⊆ A × B.
Definition: A binary relation R from a set A

Example:
Let A = {0,1,2} and B = {a,b}
{(0, a), (0, b), (1,a) , (2, b)} is a relation from A
to B.
We can represent relations from a set A to a set
B graphically or using a table:
Relations are more general
than functions. A function is a
relation where exactly one
element of B is related to each
element of A.
Example
 Let A be the students in a the CS major
 A = {Alice, Bob, Claire, Dan}
 Let B be the courses the department offers
 B = {CS101, CS201, CS202}
 We specify relation R = A  B as the set that lists all
students a  A enrolled in class b  B
 R = { (Alice, CS101), (Bob, CS201), (Bob, CS202),
(Dan, CS201), (Dan, CS202) }

6
Representing
We can represent
relations
We can represent
relations relations in a
graphically: table:
CS101 CS201 CS202
Alice
CS101
Alice X
Bob Bob X X
CS201
Claire
Claire
CS202
Dan X X
Dan

Not valid functions!


7
When to use which?
A function is used when you need to obtain a
SINGLE result for any element in the domain
Example: sin, cos, tan

A relation is when there are multiple


mappings between the domain and the co-
domain
Example: students enrolled in multiple courses

8
Binary Relation on a Set
A relation on the set A is a relation from A to A

Definition: A binary relation R on a set A is a subset of A × A or a


In other words, the domain and co-domain are the same set

relation from A to A.
Example:
 Suppose that A = {a,b,c}. Then R = {(a,a),(a,b), (a,c)} is a

 Let A = {1, 2, 3, 4}. The ordered pairs in the relation R =


relation on A.

{(a,b) | a divides b} are


(1,1), (1, 2), (1,3), (1, 4), (2, 2), (2, 4), (3, 3),
and (4, 4).
Relations on a set
 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 1 R 1 2 3 4
1 X X X X
2 2
2 X X
3 3 3 X
4 X
4 4
10
Binary Relations on a Set (cont.)
R1 = {(a,b) | a ≤ b}, R4 = {(a,b) | a = b},
Example: Consider these relations on the set of integers:

R2 = {(a,b) | a > b}, R5 = {(a,b) | a = b + 1},


R3 = {(a,b) | a = b or a = −b}, R6 = {(a,b) | a + b ≤ 3}.
Note that these relations are on an infinite set and each of these
relations is an infinite set.

Which of these relations contain each of the pair


(1,1), (1, 2), (2, 1), (1, −1), and (2, 2)?

relation, we see that the pair (1,1) is in R1, R3, R4 , and R6:
Solution: Checking the conditions that define each

(1,2) is in R1 and R6: (2,1) is in R2, R5, and R6: (1, −1) is in
R2, R3, and R6 : (2,2) is in R1, R3, and R4.
Reflexivity
A relation is reflexive if every element is
related to itself
Or, (a,a)R

Examples of reflexive relations:


=, ≤, ≥

Examples of relations that are not reflexive:


<, >

12
Reflexive Relations
Definition: R is reflexive iff (a,a) ∊ R for every element
a ∊ A. Written symbolically, R is reflexive if and only if
∀x[x∊U ⟶ (x,x) ∊ R]

R1 = {(a,b) | a ≤ b}, = b},is


Example: The following relations on the integers are
If A = ∅Rthen
}, b}, 5 = {(a,b) | a = b +
4 = the
| ab>
reflexive: {(a,b) |a
|a≤
empty relation
2 = {(a,b)
1},
R1 =R{(a,b) Rvacuously.
reflexive That is the

R3 = {(a,b) | a = b or a = −b},
R3 = {(a,b) | a = b or a = −b},
empty relation on an empty set is

R6 = {(a,b) | a + b ≤
{(a,b) | a = b}.
reflexive!

R4 =3}.
The following relations are not reflexive:
R2 = {(a,b) | a > b} (note that 3 ≯ 3),
R5 = {(a,b) | a = b + 1} (note that 3 ≠3 + 1),
R6 = {(a,b) | a + b ≤ 3} (note that 4 + 4 ≰ 3).
Irreflexivity
A relation is irreflexive if every element is not
related to itself
 Or, (a,a)R
 Irreflexivity is the opposite of reflexivity

Examples of irreflexive relations:


 <, >

Examples of relations that are not irreflexive:


 =, ≤, ≥

14
Symmetry
A relation is symmetric if, for every (a,b)R, then
(b,a)R

Examples of symmetric relations:


 =, isTwinOf()

Examples of relations that are not symmetric:


 <, >, ≤, ≥

15
Symmetric Relations
Definition: R is symmetric iff (b,a) ∊ R whenever (a,b) ∊ R
for all a,b ∊ A. Written symbolically, R is symmetric if and
only if
∀x∀y [(x,y) ∊R ⟶ (y,x) ∊ R]

R1 = {(a,b) | a ≤ b}, R4 = {(a,b) | a = b},


Example: The following relations on the integers are

| ab>or
b},a = −b}, R5 = {(a,b) | a = b +
symmetric:
R3 =
R2{(a,b) |a=
1},{(a,b) | a = b},
= {(a,b)

| ab=≤b3}.or a = −b}, R6 = {(a,b) | a + b ≤


R4 =
R3{(a,b)
3}.
= {(a,b)
6
R = |a+
The following are not symmetric:
R1 = {(a,b) | a ≤ b} (note that 3 ≤ 4, but 4 ≰ 3),
R2 = {(a,b) | a > b} (note that 4 > 3, but 3 ≯ 4),
R5 = {(a,b) | a = b + 1} (note that 4 = 3 + 1, but 3 ≠4 + 1).
Asymmetry
A relation is asymmetric if, for every (a,b)R,
then (b,a)R
Asymmetry is the opposite of symmetry

Examples of asymmetric relations:


<, >

Examples of relations that are not


asymmetric:
=, isTwinOf(), ≤, ≥
17
Antisymmetry
A relation is antisymmetric if, for every
(a,b)R, then (b,a)R is true only when a=b
Antisymmetry is not the opposite of
symmetry

Examples of antisymmetric relations:


=, ≤, ≥

Examples of relations that are not


antisymmetric:
 isTwinOf() 18
Antisymmetric Relations
Definition:A relation R on a set A such that for all a,b ∊ A if
(a,b) ∊ R and (b,a) ∊ R, then a = b is called antisymmetric.
Written symbolically, R is antisymmetric if and only if
∀x∀y [(x,y) ∊R ∧ (y,x) ∊ R ⟶ x = y]

R1 = {(a,b) | a ≤ b}, R4 = {(a,b) | a = b},


 Example: The following relations on the integers are

R1 = {(a,b) | a ≤ b}, a a ≤ |ba = b +


R2 = {(a,b) | a > b},
antisymmetric:

R2 = {(a,b) | a > b}, and a ≤ b , then a = b.


R5 = if{(a,b)
1},
For any integer,

3 = {(a,b) | a = b or a = −b},
R4 =R | a = b}, R6 = {(a,b) | a + b ≤
{(a,b) | a = b + 1}.
{(a,b)
R5 =3}.
The following relations are not antisymmetric:
R3 = {(a,b) | a = b or a = −b}
(note that both (1,−1) and (−1,1) belong to R3),
R6 = {(a,b) | a + b ≤ 3} (note that both (1,2) and (2,1) belong to R6).
Transitivity
A relation is transitive if, for every (a,b)R
and (b,c)R, then (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

20
Transitive Relations
whenever (a,b) ∊ R and (b,c) ∊ R, then (a,c) ∊ R, for all a,b,c ∊
Definition: A relation R on a set A is called transitive if

A. Written symbolically, R is transitive if and only if


∀x∀y ∀z[(x,y) ∊R ∧ (y,z) ∊ R ⟶ (x,z) ∊ R ]

| a ≤| ba},≤ b}, a ≤ b | a = b},


 Example: The following relations on the integers are transitive:

| a >| ba},> b}, ≤ c. | a = b +


R1{(a,b) R4 = {(a,b)
and b ≤ c, then
R1 = = {(a,b) For every integer,
R2{(a,b) R5 =b{(a,b)
1},
R2 = = {(a,b)
{(a,b) | a = b or a = −b},
| a =| ba}.= b or a = −b}, R6 = {(a,b) | a + b ≤
R3 =
R3{(a,b)
The3}.
R4 = = {(a,b)
following are not transitive:
R5 = {(a,b) | a = b + 1} (note that both (3,2) and (4,3) belong to R5,
but not (3,3)),
R6 = {(a,b) | a + b ≤ 3} (note that both (2,1) and (1,2) belong to R6,
but not (2,2)).
Transitivity examples
Consider isAncestorOf()
 Let Alice be Bob’s parent, and Bob be Claire’s parent
 Thus, Alice is an ancestor of Bob, and Bob is an ancestor
of Claire
 Thus, Alice is an ancestor of Claire
 Thus, isAncestorOf() is a transitive relation

Consider isParentOf()
 Let Alice be Bob’s parent, and Bob be Claire’s parent
 Thus, Alice is a parent of Bob, and Bob is a parent of
Claire
 However, Alice is not a parent of Claire
 Thus, isParentOf() is not a transitive relation

22
Relations of relations summary
= < > ≤ ≥

Reflexive X X X

Irreflexive X X

Symmetric X

Asymmetric X X

Antisymmetric X X X X X

Transitive X X X X X
23
Combining Relations
Given two relations R1 and R2, we can

form new relations such as R1 ∪ R2, R1 ∩ R2,


combine them using basic set operations to

R1 − R2, and R2 − R1.


Example: Let A = {1,2,3} and B = {1,2,3,4}.
The relations R1 = {(1,1),(2,2),(3,3)} and

1 ∪ R2 ={(1,1),(1,2),(1,3),(1,4),(2,2),
R2 = {(1,1),(1,2),(1,3),(1,4)} can
beRcombined
R1 ∩ R2 relations: R1 − R2 ={(2,2),
using basic set operations to
(3,3)}
form new

R2 − R1 ={(1,2),(1,3),(1,4)}
={(1,1)} (3,3)}
Composition
Definition: Suppose
R1 is a relation from a set A to a set B.
R2 is a relation from B to a set C.

Then the composition (or composite) of R2


with R1, is a relation from A to C where
if (x,y) is a member of R1 and (y,z) is a
member of R2, then (x,z) is a member of R2∘ R1.
Representing the Composition of a
Relation
R1 m R2 w
a
x
n
b
y
o
c
p z

R1∘ R2 = {(b,x),(b,z)}
Combining relations 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?
 If (a,b)  M, then a is the mother of b
 If (b,c)  M, then b is the mother of c
 Thus, M ◦ M denotes the relation “maternal grandmother”
 Note that M and F are not transitive relations!!!

27
Combining relations 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

28
Powers of a Relation
Definition: Let R be a binary relation on A. Then
the powers Rn of the relation R can be defined
inductively by:
 Basis Step: R1 = R
 Inductive Step: Rn+1 = Rn ∘ R
(see the slides for Section 9.3 for further insights)
The powers of a transitive relation are subsets of the
relation. This is established by the following

Theorem 1: The relation R on a set A is transitive


theorem:

iff Rn ⊆ R for n = 1,2,3 ….


(see the text for a proof via mathematical induction)
Representing Relations
Section 9.3
Section Summary
Representing Relations using Matrices
Representing Relations using Digraphs
Representing Relations Using Matrices
A relation between finite sets can be represented using a
zero-one matrix.
Suppose R is a relation from A = {a1, a2, …, am} to
B = {b1, b2, …, bn}.
 The elements of the two sets can be listed in any particular
arbitrary order. When A = B, we use the same ordering.
The relation R is represented by the matrix
MR = [mij], where

The matrix representing R has a 1 as its (i,j) entry when ai is


related to bj and a 0 if ai is not related to bj.
Examples of Representing Relations Using
Matrices
Example 1: Suppose that A = {1,2,3} and B

containing (a,b) if a ∈ A, b ∈ B, and a > b.


= {1,2}. Let R be the relation from A to B

What is the matrix representing R (assuming


the ordering of elements is the same as the
increasing numerical
Solution: Because R = {(2,1),order)?
(3,1),(3,2)}, the matrix is
Examples of Representing Relations Using
Matrices (cont.)
Example 2: Let A = {a1,a2, a3} and B =
{b1,b2, b3,b4, b5}. Which ordered pairs are in
the relation R represented by the matrix

(ai,bj) with mij = 1, it follows that:


Solution: Because R consists of those ordered pairs

R = {(a1, b2), (a2, b1),(a2, b3), (a2, b4),(a3, b1), (a3, b3),
(a3, b5)}.
Matrices of Relations on Sets
the main diagonal of MR are equal to 1.
If R is a reflexive relation, all the elements on

1 whenever mji = 1. R is an antisymmetric


 R is a symmetric relation, if and only if mij =

relation, if and only if mij = 0 or mji = 0 when


i≠ j.
Example of a Relation on a Set
Example 3: Suppose that the relation R on a
set is represented by the matrix

Is R reflexive, symmetric, and/or


antisymmetric?
Solution: Because all the diagonal elements are equal to 1, R

antisymmetric because both m1,2 and m2,1 are 1.


is reflexive. Because MR is symmetric, R is symmetric and not
Representing Relations Using Digraphs
Definition: A directed graph, or digraph, consists of a set V of
vertices (or nodes) together with a set E of ordered pairs of
elements of V called edges (or arcs). The vertex a is called the
initial vertex of the edge (a,b), and the vertex b is called the
terminal vertex of this edge.
 An edge of the form (a,a) is called a loop.

Example 7: A drawing of the directed graph with vertices a, b, c,


and d, and edges (a, b), (a, d), (b, b), (b, d), (c, a), (c, b), and (d, b)
is shown here.
Examples of Digraphs Representing
Relations
Example 8: What are the ordered pairs in the
relation
represented by this directed graph?

(1, 3), (1, 4), (2, 1), (2, 2), (2, 3), (3, 1), (3, 3), (4, 1), and (4, 3)
Solution: The ordered pairs in the relation are
Determining which Properties a Relation
has from its Digraph

Reflexivity: A loop must be present at all

Symmetry: If (x,y) is an edge, then so is (y,x).


vertices in the graph.

Antisymmetry: If (x,y) with x ≠ y is an edge,

Transitivity: If (x,y) and (y,z) are edges, then


then (y,x) is not an edge.

so is (x,z).
Determining which Properties a Relation
has from its Digraph – Example 1

a b

c d

• Reflexive?
No, not every vertex has a loop
• Symmetric? Yes (trivially), there is no edge from one vertex to
• Antisymmetric?Yes (trivially), there is no edge from one vertex to
another
•Transitive?Yes,another
(trivially) since there is no edge from one vertex to
another
Determining which Properties a Relation
has from its Digraph – Example 2

a
b

c d

• Reflexive?•No, there are no loops


• Symmetric? •No, there is an edge from a to b, but not from b
• Antisymmetric?
to a there is an edge from d to b and b to d
•No,
•Transitive? •No, there are edges from a to b and from b to d, but there is no
edge from a to d
Determining which Properties a Relation
has from its Digraph – Example 3

a
b

c d
Reflexive?
No, there are no loops
Symmetric?
No, for example, there is no edge from c to a
Antisymmetric?Yes, whenever there is an edge from one vertex to another, there is not
Transitive? No,onethere
going back
is no edge from a to b
Wrong!!!!
Determining which Properties a Relation
has from its Digraph – Example 4

b
a

c d
• Reflexive?
No, there are no loops
• Symmetric? No, for example, there is no edge from d
to a
• Antisymmetric? •Yes, whenever there is an edge from one
vertex
•Transitive?•Yes (trivially), there are no
to another, two is
there edges
not one going
where the first edge ends at the vertex
back
where the second edge begins
Example of the Powers of a Relation
a b a b

R2
d c d c
R

a b b
a

3
R4
d c d c
R
The pair (x,y) is in Rn if there is a path of length n from x to y in R
(following the direction of the arrows).
Equivalence Relations
Section 9.5
Section Summary
Equivalence Relations
Equivalence Classes
Equivalence Classes and Partitions
Equivalence Relations
Definition 1: A relation on a set A is called
an equivalence relation if it is reflexive,
symmetric, and transitive.

Definition 2: Two elements a, and b that are

equivalent. The notation a ∼ b is often used


related by an equivalence relation are called

to denote that a and b are equivalent


elements with respect to a particular
equivalence relation.
Strings
Example: Suppose that R is the relation on the set
of strings of English letters such that aRb if and only if
l(a) = l(b), where l(x) is the length of the string x. Is R
an equivalence relation?
Solution: Show that all of the properties of an equivalence
relation hold.
Reflexivity: Because l(a) = l(a), it follows that aRa for all
strings a.
Symmetry: Suppose that aRb. Since l(a) = l(b), l(b) =
l(a) also holds and bRa.
Transitivity: Suppose that aRb and bRc. Since l(a) =
l(b),and l(b) = l(c), l(a) = l(c) also holds and aRc .
Divides
Example: Show that the “divides” relation on
the set of positive integers is not an equivalence
relation.

Solution: The properties of reflexivity, and transitivity do hold,


but there relation is not transitive. Hence, “divides” is not an

Reflexivity: a ∣ a for all a.


equivalence relation.

Not Symmetric: For example, 2 ∣ 4, but 4 ∤ 2. Hence, the


relation is not symmetric.
Transitivity: Suppose that a divides b and b divides c. Then
there are positive integers k and l such that b = ak and c = bl.
Hence, c = a(kl), so a divides c. Therefore, the relation is
transitive.
Partial Orderings
Section 9.6
Section Summary
Partial Orderings and Partially-ordered Sets
Hasse Diagrams
Partial Orderings
Definition 1: A relation R on a set S is called
a partial ordering, or partial order, if it is
reflexive, antisymmetric, and transitive. A set
together with a partial ordering R is called a
partially ordered set, or poset, and is denoted
by (S, R). Members of S are called elements
of the poset.
Partial Orderings (continued)
Example 1: Show that the “greater than or
equal” relation (≥) is a partial ordering on the
Reflexivity: a ≥ a for every integer a.
set of integers.
Antisymmetry: If a ≥ b and b ≥ a , then a = b.
Transitivity: If a ≥ b and b ≥ c , then a ≥ c.
Partial Orderings (continued)
Example 2: Show that the divisibility

integers. (Z+, ∣) is a poset.


relation (∣) is a partial ordering on the set of

Reflexivity: a ∣ a for all integers a. (see Example 9 in Section


9.1)

a, then a = b. (see Example 12 in Section 9.1)


Antisymmetry: If a and b are positive integers with a | b and b |

Transitivity: Suppose that a divides b and b divides c. Then


there are positive integers k and l such that b = ak and c = bl.
Hence, c = a(kl), so a divides c. Therefore, the relation is
transitive.
Partial Orderings (continued)
Example 3: Show that the inclusion relation
(⊆) is a partial ordering on the power set of a
Reflexivity: A ⊆ A whenever A is a subset of S.
set S.

A ⊆ B and B ⊆ A, then A = B.
Antisymmetry: If A and B are positive integers with

Transitivity: If A ⊆ B and B ⊆ C, then A ⊆ C.

The properties all follow from the


definition of set inclusion.
Hasse Diagrams
Definition: A Hasse diagram is a visual representation of a
partial ordering that leaves out edges that must be present
because of the reflexive and transitive properties.

A partial ordering is shown in (a) of the figure above. The


loops due to the reflexive property are deleted in (b). The
edges that must be present due to the transitive property
are deleted in (c). The Hasse diagram for the partial
ordering (a), is depicted in (c).

You might also like