0% found this document useful (0 votes)
27 views27 pages

Relations - Slide - Discrete Math - DSU

Uploaded by

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

Relations - Slide - Discrete Math - DSU

Uploaded by

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

Relations

Discrete Mathematics

Dr. Mohammad Salah Uddin


Associate Professor
Computer Science & Engineering Department
East West University

March 13, 2024


Cartesian Product (Review)

Let A = {a1 , a2 , . . . , ak } and B = {b1 , b2 , . . . , bm }.


The Cartesian product A × B is defined by a set of pairs:

{(a1 , b1 ), (a1 , b2 ), . . . , (a1 , bm ), . . . , (ak , bm )}.

Cartesian product defines a product set, or a set of all ordered


arrangements of elements in sets in the Cartesian product.
Binary Relations

Definition: Let A and B be two sets. A binary relation from A to


B is a subset of the Cartesian product A × B.
▶ Let R ⊆ A × B means R is a set of ordered pairs of the form
(a, b) where a ∈ A and b ∈ B.
▶ We use the notation aRb to denote (a, b) ∈ R and a ̸ Rb to
denote (a, b) ∈
/ R. If aRb, we say a is related to b by R.
Example: Let A = {a, b, c} and B = {1, 2, 3}.
▶ Is R = {(a, 1), (b, 2), (c, 2)} a relation from A to B? Yes.
▶ Is Q = {(1, a), (2, b)} a relation from A to B? No.
▶ Is P = {(a, a), (b, c), (b, a)} a relation from A to A? Yes.
Representing Relations
We can graphically represent a binary relation R as follows:
▶ If aRb, then draw an arrow from a to b: a → b.
Example:
▶ Let A = {0, 1, 2}, B = {u, v }, and
R = {(0, u), (0, v ), (1, v ), (2, u)}.
▶ Note: R ⊆ A × B.
Graph:
Representing Relations

We can represent a binary relation R by a table showing (marking)


the ordered pairs of R.
Example:
▶ Let A = {0, 1, 2}, B = {u, v }, and
R = {(0, u), (0, v ), (1, v ), (2, u)}.
Table:
R u v R u v
0 × × 0 1 1
1 × 1 0 1
2 × 2 1 0
Relations and Functions
Relations represent one-to-many relationships between elements in
A and B.
Example:

Example:
▶ What is the difference between a relation and a function from
A to B? A function defined on sets A, B A → B assigns to
each element in the domain set A exactly one element from
B. So it is a special relation.
Relation on the Set

Definition: A relation on the set A is a relation from A to itself.


Example 1:
▶ Let A = {1, 2, 3, 4} and Rdiv = {(a, b) | a divides b}.
▶ What does Rdiv consist of?
▶ Rdiv = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}
Table:
Rdiv 1 2 3 4
1 × × × ×
2 × ×
3 ×
4 ×
Relation on the Set

Example:
▶ Let A = {1, 2, 3, 4}.
▶ Define a relation aR̸= b if and only if a ̸= b.
▶ R̸= = {(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1),
(3,2),(3,4),(4,1),(4,2),(4,3)}
Table:
R̸= 1 2 3 4
1 × × ×
2 × × ×
3 × × ×
4 × × ×
Binary Relations

Theorem: The number of binary relations on a set A, where


2
|A| = n, is 2n .
Proof:
▶ If |A| = n, then the cardinality of the Cartesian product
|A × A| = n2 .
▶ R is a binary relation on A if R ⊆ A × A (i.e., R is a subset of
A × A).
▶ The number of subsets of a set with k elements is 2k .
2
▶ Therefore, the number of subsets of A × A is 2n .
Properties of Relations

Definition (Reflexive Relation): A relation R on a set A is called


reflexive if (a, a) ∈ R for every element a ∈ A.
Example 1:
▶ Assume relation Rdiv = {(a, b) if a|b} on A = {1, 2, 3, 4}.
▶ Is Rdiv reflexive?
▶ Rdiv = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}
▶ Answer: Yes. (1, 1), (2, 2), (3, 3), and (4, 4) ∈ A.
Reflexive Relation

Reflexive Relation:
▶ Rdiv = {(a, b) if a|b} on A = {1, 2, 3, 4}.
▶ Rdiv = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}
 
1 1 1 1
0 1 0 1
MRdiv =
0

0 1 0
0 0 0 1
A relation R is reflexive if and only if MR has 1 in every position
on its main diagonal.
Reflexive Relation

Definition (Reflexive Relation): A relation R on a set A is called


reflexive if (a, a) ∈ R for every element a ∈ A.
Example 2:
▶ Relation Rfun on A = {1, 2, 3, 4} defined as:
▶ Rfun = {(1, 2), (2, 2), (3, 3)}.
▶ Is Rfun reflexive?
▶ No. It is not reflexive since (1, 1) ∈
/ Rfun .
Irreflexive Relation

Definition (Irreflexive Relation): A relation R on a set A is


called irreflexive if (a, a) ∈
/ R for every a ∈ A.
Example 1:
▶ Assume relation R̸= on A = {1, 2, 3, 4}, such that aR̸= b if and
only if a ̸= b.
▶ Is R̸= irreflexive?
▶ R̸= = {(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2),
(3,4),(4,1),(4,2),(4,3)}
▶ Answer: Yes. Because (1, 1), (2, 2), (3, 3), and (4, 4) ∈
/ R̸= .
Properties of Relations

Irreflexive Relation
▶ R̸= on A = {1, 2, 3, 4}, such that aR̸= b if and only if a ̸= b.
▶ R̸= = {(1, 2), (1, 3), (1, 4), (2, 1), (2, 3),
(2,4),(3,1),(3,2),(3,4),(4,1),(4,2),(4,3)}
 
0 1 1 1
1 0 1 1
MR =  1 1 0 1

1 1 1 0
A relation R is irreflexive if and only if MR has 0 in every position
on its main diagonal.
Properties of Relations

Definition (Irreflexive Relation): A relation R on a set A is


called irreflexive if (a, a) ∈
/ R for every a ∈ A.
Example 2:
▶ Rfun on A = {1, 2, 3, 4} defined as:
▶ Rfun = {(1, 2), (2, 2), (3, 3)}.
▶ Is Rfun irreflexive?
▶ Answer: No. Because (2, 2) and (3, 3) ∈ Rfun .
Properties of Relations

Definition (Symmetric Relation): A relation R on a set A is


called symmetric if for all a, b ∈ A, (a, b) ∈ R → (b, a) ∈ R.
Example 1:
▶ Rdiv = {(a, b) if a|b} on A = {1, 2, 3, 4}.
▶ Is Rdiv symmetric?
▶ Rdiv = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}
▶ Answer: No. It is not symmetric since (1, 2) ∈ R but
(2, 1) ∈
/ R.
Properties of Relations

Definition (Symmetric Relation): A relation R on a set A is


called symmetric if for all a, b ∈ A, (a, b) ∈ R → (b, a) ∈ R.
Example 2:
▶ R̸= on A = {1, 2, 3, 4}, such that aR̸= b if and only if a ̸= b.
▶ Is R̸= symmetric?
▶ R̸= = {(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2),
(3,4),(4,1),(4,2),(4,3)}
▶ Answer: Yes. If (a, b) ∈ R̸= → (b, a) ∈ R̸= .
Properties of Relations

Symmetric Relation:
▶ R̸= on A = {1, 2, 3, 4}, such that aR̸= b if and only if a ̸= b.
▶ R̸= = {(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2),
(3,4),(4,1),(4,2),(4,3)}
 
0 1 1 1
1 0 1 1
MR =  1 1 0 1

1 1 1 0
A relation R is symmetric if and only if mij = mji for all i, j.
Properties of Relations

Definition (Symmetric Relation): A relation R on a set A is


called symmetric if for all a, b ∈ A, (a, b) ∈ R → (b, a) ∈ R.
Example 3:
▶ Relation Rfun on A = {1, 2, 3, 4} defined as:
▶ Rfun = {(1, 2), (2, 2), (3, 3)}.
▶ Is Rfun symmetric?
▶ Answer: No. For (1, 2) ∈ Rfun there is no (2, 1) ∈ Rfun .
Properties of Relations

Definition (Anti-symmetric Relation): A relation on a set A is


called anti-symmetric if [(a, b) ∈ R and (b, a) ∈ R] → a = b where
a, b ∈ A.
Example 3:
▶ Relation Rfun on A = {1, 2, 3, 4} defined as:
▶ Rfun = {(1, 2), (2, 2), (3, 3)}.
▶ Is Rfun anti-symmetric?
▶ Answer: Yes. It is anti-symmetric.
Properties of Relations

Anti-symmetric Relation
▶ Relation Rfun = {(1, 2), (2, 2), (3, 3)}
 
0 1 0 0
0 1 0 0
MRfun =
0

0 1 0
0 0 0 0
A relation is anti-symmetric if and only if mij = 1 → mji = 0 for
i ̸= j.
Properties of Relations

Definition (Transitive Relation): A relation R on a set A is


called transitive if [(a, b) ∈ R and (b, c) ∈ R] → (a, c) ∈ R for all
a, b, c ∈ A.
Example 1:
▶ Rdiv = {(a, b) if a|b} on A = {1, 2, 3, 4}.
▶ Rdiv = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.
▶ Is Rdiv transitive?
▶ Answer: Yes.
Properties of Relations

Definition (Transitive Relation): A relation R on a set A is


called transitive if [(a, b) ∈ R and (b, c) ∈ R] → (a, c) ∈ R for all
a, b, c ∈ A.
Example 2:
▶ R̸= on A = {1, 2, 3, 4}, such that aR̸= b if and only if a ̸= b.
▶ R̸= = {(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2),
(3,4),(4,1),(4,2),(4,3)}.
▶ Is R̸= transitive?
▶ Answer: No. It is not transitive since (1, 2) ∈ R̸= and (2, 1) ∈ R̸= ,
but (1, 1) is not an element of R̸= .
Properties of Relations

Definition (Transitive Relation): A relation R on a set A is


called transitive if [(a, b) ∈ R and (b, c) ∈ R] → (a, c) ∈ R for all
a, b, c ∈ A.
Example 3:
▶ Relation Rfun on A = {1, 2, 3, 4} defined as:
▶ Rfun = {(1, 2), (2, 2), (3, 3)}.
▶ Is Rfun transitive?
▶ Answer: Yes. It is transitive.
Transitive Relation

Let A = {1, 2, 3} and R be the relation on set A defined as


R = {(1, 1), (1, 2), (1, 3), (2, 3), (3, 3)}. The matrix representation
of R is:
 
1 1 1
MR = 0 0 1
0 0 1
Show that R is transitive.
Transitive Relation (Solution)

We can compute MR 2
J
as MR · MR :
     
K 1 1 1 1 1 1 1 1 1
MR 2 = 0 0 1 · 0 0 1 = 0 0 1
0 0 1 0 0 1 0 0 1

Since, MR 2
J
=M JR , the relation R is transitive.
Formula: if MR 2 = MR then the relation is transitive
Equivalence Relations

Definition: An equivalence relation R on a set A is a relation that


is reflexive, symmetric, and transitive.
Properties:
▶ Reflexive: (a, a) ∈ R for all a ∈ A.
▶ Symmetric: (a, b) ∈ R ⇒ (b, a) ∈ R for all a, b ∈ A.
▶ Transitive: (a, b) ∈ R and (b, c) ∈ R ⇒ (a, c) ∈ R for all
a, b, c ∈ A.
Example: The relation of “equality” is an equivalence relation.
For any set A, the relation R = {(a, a) | a ∈ A} is an equivalence
relation on A.

You might also like