You are on page 1of 115

Relation

Lecture 3

1
Cartesian product (review)

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

The Cartesian product A x B is defined by a set of ordered


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.
2
Binary relation
Definition: Let A and B be two sets. A binary relation
from A to B is a subset of a Cartesian product A x 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 a R b to denote (a,b) ϵ R and a R b


to denote (a,b) ϵ R. If a R b, 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?

3
Binary relation
Definition: Let A and B be two sets. A binary relation
from A to B is a subset of a Cartesian product A x 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 a R b to denote (a,b) ϵ R and a R b


to denote (a,b) ϵ R. If a R b, 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?
4
Binary relation
Definition: Let A and B be two sets. A binary relation
from A to B is a subset of a Cartesian product A x 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 a R b to denote (a,b) ϵ R and a R b


to denote (a,b) ϵ R. If a R b, 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?
5
Binary relation
Definition: Let A and B be two sets. A binary relation
from A to B is a subset of a Cartesian product A x 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 a R b to denote (a,b) ϵ R and a R b


to denote (a,b) ϵ R. If a R b, 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
6
Representing Binary relation
We can graphically represent a binary relation R as follows:
• if a R b 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: 2

0 u

7
1 V
Representing Binary relation
We can graphically represent a binary relation R as follows:
• if a R b 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
• Table: R u v R u v
0 x x 0 1 1
1 x 1 0 1
2 x 2 1 0 8
Relation and Function
Relations represent one to many relationships between
elements in A and B.
• Example: a 1

b 3

• What is the difference between a relation and a function


from A to B?

9
Relation and Function
Relations represent one to many relationships between
elements in A and B.
• Example: a 1

b 3

• 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. a 1
2
b 3 10
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 = {(x,y)| x divides y} y%x==0

• What does Rdiv consist of? 21

• Rdiv = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4)}

R 1 2 3 4
1 x x x x
2 x x
3 x
4 x 11
Relation on the set
Definition: A relation on the set A is a relation from A to
itself.
Example 2:
• Let A = {1,2,3,4}.
• Define a R≠ b if and only if a ≠ b.
R≠ = {(a,b)| 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)}

R 1 2 3 4
1 x x x
2 x x x
3 x x x
4 x x x 12
Binary Relation
Theorem: The number of binary relations on a set A, where
| A | = n is:
n2
Proof:
2
• If | A | = n then the cardinality of the Cartesian product
| A x A | = n 2.
• R is a binary relation on A if R  A  A (that is, R is a subset
of A x A).
• The number of subsets of a set with k elements : 2k
A A
• The number of subsets of A x A is : 2 2 n2

13
Binary Relation
Example: Let A = {1,2} |A|=2
• What is A x A = {(1,1),(1,2),(2,1),(2,2)} |AXA|=4

• List of possible relations (subsets of A x A):


Ø 1
{(1,1)} {(1,2)} {(2,1)} {(2,2)} 4
{(1,1), (1,2)} {(1,1),(2,1)} {(1,1),(2,2)} 6
{(1,2),(2,1)} {(1,2),(2,2)} {(2,1),(2,2)}

{(1,1),(1,2),(2,1)} {(1,1),(1,2),(2,2)} 4
{(1,1),(2,1),(2,2)} {(1,2),(2,1),(2,2)}

{(1,1),(1,2),(2,1),(2,2)} 1

Use formula: 24 = 16 16

14
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 1:

• Assume 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)}

• Is Rdiv reflexive?

15
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 1:

• Assume 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)}

• Is Rdiv reflexive?

• Answer: Yes. (1,1), (2,2), (3,3), and (4,4) ϵ A.

16
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

0 0 1 0

0 0 0 1

A relation R is reflexive if and only if R has 1 in every


position on its main diagonal.

17
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?

18
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) ,(4,4) Rfun.

19
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 a R≠ 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≠ irreflexive?

20
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 a R≠ 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≠ irreflexive?

Answer: Yes. Because (1,1),(2,2),(3,3) and (4,4)  R≠ 21


Irreflexive Relation
Irreflexive relation

• R≠ on A={1,2,3,4}, such that a R≠ 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

1 1 0 1

1 1 1 0

A relation R is irreflexive if and only if R has 0 in every


position on its main diagonal
22
Irreflexive Relation
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?

23
Irreflexive Relation
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

24
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called
symmetric if

. a, b  A( a, b)  R  (b, a )  R

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 symmetric?

25
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if

. a, b  A( a, b)  R  (b, a )  R

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 symmetric?

• Answer: No. It is not symmetric since (1,2) ϵ R but


(2,1)R. 26
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if
a, b  A(a, b)  R  (b, a )  R

Example 2:

• R≠ on A={1,2,3,4}, such that a R≠ 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≠ symmetric ?

27
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if
a, b  A(a, b)  R  (b, a )  R

Example 2:

• R≠ on A={1,2,3,4}, such that a R≠ 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≠ symmetric ?

Answer: Yes. a, b  A( a, b)  R  (b, a )  R 28


Symmetric Relation
Symmetric relation:

• R≠ on A={1,2,3,4}, such that a R≠ 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

1 1 0 1

1 1 1 0

A relation R is symmetric if and only if mij = mji for all i,j.

29
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if
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?

30
Symmetric Relation

Definition (symmetric relation): A relation R on a set A is


called symmetric if
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


31
Asymmetric Relation
Definition (asymmetric relation): A relation on a set A is
called anti-symmetric if

• (a,b) ϵ R → (b,a) R where a, b ϵ A.

Example 3:
• Relation Rfun on A = {1,2,3,4} defined as:

• Rfun = {(1,2),(2,1),(3,2)}.

• Is Rfun asymmetric?

32
Asymmetric Relation
Definition (asymmetric relation): A relation on a set A is
called anti-symmetric if

• (a,b) ϵ R → (b,a) R where a, b ϵ A.

Example 3:
• Relation Rfun on A = {1,2,3,4} defined as:

• Rfun = {(1,2),(2,1),(3,2)}.

• Is Rfun asymmetric?

no. It is not asymmetric 33


Asymmetric Relation
Definition (asymmetric relation): A relation on a set A is
called anti-symmetric if

• (a,b) ϵ R → (b,a) R where a, b ϵ A.

Example 3:
• Relation Rfun on A = {1,2,3,4} defined as:

• Rfun = {(1,2),(2,3),(3,3)}.

• Is Rfun asymmetric?

34
Asymmetric Relation
Definition (asymmetric relation): A relation on a set A is
called anti-symmetric if

• (a,b) ϵ R → (b,a) R where a, b ϵ A.

Example 3:
• Relation Rfun on A = {1,2,3,4} defined as:

• Rfun = {(1,2),(2,3),(3,3)}.

• Is Rfun asymmetric?

Answer: no. It is not asymmetric 35


Anti-symmetric Relation
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?

36
Anti-symmetric Relation
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 37


Anti-symmetric Relation
Antisymmetric relation
• relation Rfun = {(1,2),(2,2),(3,3)}

0 1 0 0

0 1 0 0

0 0 1 0

0 0 0 0

A relation is antisymmetric if and only if m ij = 1 → mji = 0 for


i≠ j.
38
Transitive Relation
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? 11 12 12 12 22 12 13 33 13
11 13 13 12 24 14 14 44 14
11 14 14 22 24 24 33 33 33
24 44 24 44 44 44 39
Transitive Relation
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.
40
Transitive Relation
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 a R≠ 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 ?
41
Transitive Relation
Definition (transitive relation): A relation R on a set A is
calledtransitive 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 a R≠ 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. 42
Transitive Relation
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? 12 22 12
22 22 22
33 33 33
abbc ac
43
Transitive Relation
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.

44
Transitive Relation
Find the smallest relation containing the relation
{(1, 2), (1, 4), (3, 3), (4, 1)} that is
a) reflexive and transitive.
b) symmetric and transitive.
c) reflexive, symmetric, and transitive. on {1,2,3,4}

45
Transitive Relation
Find the smallest relation containing the relation
{(1, 2), (1, 4), (3, 3), (4, 1)} that is

a) reflexive and transitive. A={1,2,3,4}

R = {(1,1), (1,2) (1,4) (2,2) (3,3) (4,1) (4,2) (4,4) }

R= {(11)(12)(13)(14)
(21)(22)(23)(24)
(31)(32)(33)(34)
(41)(42)(43)(44)}
46
Transitive Relation
Find the smallest relation containing the relation
{(1, 2), (1, 4), (3, 3), (4, 1)} that is

b) symmetric and transitive.

R = {(1,1), (1, 2) (1, 4) (2,1) (2, 2) (2,4) (3, 3) (4,1) (4, 2)


(4,4) }

47
Transitive Relation
Find the smallest relation containing the relation
{(1, 2), (1, 4), (3, 3), (4, 1)} that is

c) reflexive, symmetric, and transitive.

R = {(1,1), (1, 2) (1, 4) (2,1) (2,2) (2,4) (3, 3) (4,1) (4, 2) (4,4) }

48
Intermission

49
Cartesian product (review)

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

The Cartesian product A x B is defined by a set of ordered


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.
50
Binary relation
Definition: Let A and B be two sets. A binary relation
from A to B is a subset of a Cartesian product A x 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 a R b to denote (a,b) ϵ R and a R b


to denote (a,b) ϵ R. If a R b, 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?

51
Binary relation
Definition: Let A and B be two sets. A binary relation
from A to B is a subset of a Cartesian product A x 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 a R b to denote (a,b) ϵ R and a R b


to denote (a,b) ϵ R. If a R b, 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?
52
Binary relation
Definition: Let A and B be two sets. A binary relation
from A to B is a subset of a Cartesian product A x 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 a R b to denote (a,b) ϵ R and a R b


to denote (a,b) ϵ R. If a R b, 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.

53
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 1:

• Assume 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)}

• Is Rdiv reflexive?

54
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 1:

• Assume 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)}

• Is Rdiv reflexive?

• Answer: Yes. (1,1), (2,2), (3,3), and (4,4) ϵ A.

55
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?

56
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) ,(4,4) Rfun.

57
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if
a, b  A(a, b)  R  (b, a )  R

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 symmetric?

58
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if

. a, b  A( a, b)  R  (b, a )  R

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 symmetric?

• Answer: No. It is not symmetric since (1,2) ϵ R but


(2,1)R. 59
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if
a, b  A(a, b)  R  (b, a )  R

Example 2:

• R≠ on A={1,2,3,4}, such that a R≠ 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≠ symmetric ?

60
Symmetric Relation
Definition (symmetric relation): A relation R on a set A is
called symmetric if
a, b  A(a, b)  R  (b, a )  R

Example 2:

• R≠ on A={1,2,3,4}, such that a R≠ 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≠ symmetric ?

Answer: Yes. a, b  A( a, b)  R  (b, a )  R 61


Transitive Relation
Definition (transitive relation): A relation R on a set A is
called transitive if
[( a, b)  R and (b, c)  R ]  (a, c)  R 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?

62
Transitive Relation
Definition (transitive relation): A relation R on a set A is
called transitive if
[( a, b)  R and (b, c)  R ]  (a, c)  R 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.
Is this one transitive? R={(2,3),(3,4),(2,4)}
63
Transitive Relation
Definition (transitive relation): A relation R on a set A is
called transitive if
[( a, b)  R and (b, c)  R ]  (a, c)  R a, b, c  A
• Example 2:

• R≠ on A={1,2,3,4}, such that a R≠ 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 ? 12 21 11
64
Transitive Relation
Definition (transitive relation): A relation R on a set A is
calledtransitive if
[( a, b)  R and (b, c)  R ]  (a, c)  R a, b, c  A
• Example 2:

• R≠ on A={1,2,3,4}, such that a R≠ 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. 65
Combining Relation

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


is a subset of a Cartesian product A x B.

• Let R  A  B means R is a set of ordered pairs of the


form (a,b) where a ϵ A and b ϵ B.

Combining Relations
• Relations are sets → combinations via set operations
• Set operations of: union, intersection, difference and
symmetric difference.

66
Combining Relation

Example:
• Let A = {1,2,3} and B = {u,v} and
• R1 = {(1,u), (2,u), (2,v), (3,u)}
• R2 = {(1,v),(3,u),(3,v)}

What is:
• R1 U R2 = ?

67
Combining Relation

Example:
• Let A = {1,2,3} and B = {u,v} and
• R1 = {(1,u), (2,u), (2,v), (3,u)}
• R2 = {(1,v),(3,u),(3,v)}

What is:
• R1 U R2 = {(1,u),(1,v),(2,u),(2,v),(3,u),(3,v)}
• R1 ∩ R2 = ?

68
Combining Relation

Example:
• Let A = {1,2,3} and B = {u,v} and
• R1 = {(1,u), (2,u), (2,v), (3,u)}
• R2 = {(1,v),(3,u),(3,v)}

What is:
• R1 U R2 = {(1,u),(1,v),(2,u),(2,v),(3,u),(3,v)}
• R1 ∩ R2 = {(3,u)}
• R1 - R2 = ?

69
Combining Relation

Example:
• Let A = {1,2,3} and B = {u,v} and
• R1 = {(1,u), (2,u), (2,v), (3,u)}
• R2 = {(1,v),(3,u),(3,v)}

What is:
• R1 U R2 = {(1,u),(1,v),(2,u),(2,v),(3,u),(3,v)}
• R1 ∩ R2 = {(3,u)}
• R1 - R2 = (1,u),(2,u),(2,v)}
• R2 - R1 = ?

70
Combining Relation

Example:
• Let A = {1,2,3} and B = {u,v} and
• R1 = {(1,u), (2,u), (2,v), (3,u)}
• R2 = {(1,v),(3,u),(3,v)}

What is:
• R1 U R2 = {(1,u),(1,v),(2,u),(2,v),(3,u),(3,v)}
• R1 ∩ R2 = {(3,u)}
• R1 - R2 = (1,u),(2,u),(2,v)}
• R2 - R1 = {(1,v),(3,v)}

71
Composite Relation

Definition: Let R be a relation from a set A to a set B and S


a relation from B to a set C. The composite of R and S is
the relation consisting of the ordered pairs (a,c) where aϵ A
and c ϵ C, and for which there is a b ϵ B such that (a,b) ϵ
R and (b,c) ϵ S. We denote the composite of R and S by
S o R.

Examples:
• Let A = {1,2,3}, B = {0,1,2} and C = {a,b}.
• R = {(1,0), (1,2), (3,1),(3,2)}
• S = {(0,b),(1,a),(2,b)}

• SoR = {(1,b)(3,a)(3,b)}
RoS = {} 72
Composite Relation

Definition: Let R be a relation from a set A to a set B and S


a relation from B to a set C. The composite of R and S is
the relation consisting of the ordered pairs (a,c) where aϵ A
and c ϵ C, and for which there is a b ϵ B such that (a,b) ϵ
R and (b,c) ϵ S. We denote the composite of R and S by
S o R.

Examples:
• Let A = {1,2,3}, B = {0,1,2} and C = {a,b}.
• R = {(1,0), (1,2), (3,1),(3,2)}
• S = {(0,b),(1,a),(2,b)}

• SoR = {(1,b),(3,a),(3,b)}
73
Composite Relation
Definition: Let R be a relation on a set A. The powers Rn, n
= 1,2,3,... is defined inductively by

• R1 = R and Rn+1 = Rn O R.

R2 = R1 O R = {(13)(14)(23)(33)}
R3 = R2 O R = {(13)(23)(33)}
R4 = R3 O R = {(13)(23)(33)}

Examples
• R = {(1,2),(2,3),(2,4), (3,3)} is a relation on A = {1,2,3,4}.
• R1 = {(1,2),(2,3),(2,4), (3,3)}

74
Composite Relation

Definition: Let R be a relation on a set A. The powers Rn, n


= 1,2,3,... is defined inductively by

• R1 = R and Rn+1 = Rn O R.

Examples
• R = {(1,2),(2,3),(2,4), (3,3)} is a relation on A = {1,2,3,4}.
• R1 = {(1,2),(2,3),(2,4), (3,3)}
• R2 = ?

75
Composite Relation

Definition: Let R be a relation on a set A. The powers Rn, n


= 1,2,3,... is defined inductively by

• R1 = R and Rn+1 = Rn O R.

Examples
• R = {(1,2),(2,3),(2,4), (3,3)} is a relation on A = {1,2,3,4}.
• R1 = {(1,2),(2,3),(2,4), (3,3)}
• R2 = {(1,3), (1,4), (2,3), (3,3)}
• R3 = ?

76
Composite Relation

Definition: Let R be a relation on a set A. The powers Rn, n


= 1,2,3,... is defined inductively by

• R1 = R and Rn+1 = Rn O R.

Examples
• R = {(1,2),(2,3),(2,4), (3,3)} is a relation on A = {1,2,3,4}.
• R1 = {(1,2),(2,3),(2,4), (3,3)}
• R2 = {(1,3), (1,4), (2,3), (3,3)}
• R3 = {(1,3), (2,3), (3,3)}
• R4 =

77
Composite Relation

Definition: Let R be a relation on a set A. The powers Rn, n


= 1,2,3,... is defined inductively by

• R1 = R and Rn+1 = Rn O R.

Examples
• R = {(1,2),(2,3),(2,4), (3,3)} is a relation on A = {1,2,3,4}.
• R1 = {(1,2),(2,3),(2,4), (3,3)}
• R2 = {(1,3), (1,4), (2,3), (3,3)}
• R3 = {(1,3), (2,3), (3,3)}
• R4 = {(1,3), (2,3), (3,3)}
• Rk = ? when k>3

78
Composite Relation

Definition: Let R be a relation on a set A. The powers Rn, n


= 1,2,3,... is defined inductively by

• R1 = R and Rn+1 = Rn O R.

Examples
• R = {(1,2),(2,3),(2,4), (3,3)} is a relation on A = {1,2,3,4}.
• R1 = {(1,2),(2,3),(2,4), (3,3)}
• R2 = {(1,3), (1,4), (2,3), (3,3)}
• R3 = {(1,3), (2,3), (3,3)}
• R4 = {(1,3), (2,3), (3,3)}
• Rk = {(1,3), (2,3), (3,3)}

79
Closure of a Relation

Let R={(1,1),(1,2),(2,1),(3,2)} on A ={1 2 3}.

• Is this relation reflexive?

• Answer: ?

80
Closure of a Relation

Let R={(1,1),(1,2),(2,1),(3,2)} on A ={1 2 3}.

• Is this relation reflexive?

• Answer: No (2,2) and (3,3) is not in R.

The question is what is the minimal relation S  R that is


reflexive?
• How to make R reflexive with minimum number of
additions?

• Answer: ?
81
Closure of a Relation

Let R={(1,1),(1,2),(2,1),(3,2)} on A ={1 2 3}.

• Is this relation reflexive?


• Answer: No (2,2) and (3,3) is not in R.

The question is what is the minimal relation S  R that is


reflexive?
• How to make R reflexive with minimum number of additions?

• Answer: ? Add (2,2) and (3,3)


• Then S= {(1,1),(1,2),(2,1),(3,2),(2,2),(3,3)}
• RS
• The minimal set S  R is called the reflexive closure of R
82
Closure of a Relation

Relations can have different properties:


• reflexive,
• symmetric
• transitive

• Because of that we define:


• reflexive,
• symmetric and
• transitive
closures.

83
Closure of a Relation

Definition: Let R be a relation on a set A. A relation S on A with


property P is called the closure of R with respect to P if S is a
subset of every relation Q ( S  Q ) with property P that
contains R ( R  Q ).

84
Closure of a Relation

Definition: Let R be a relation on a set A. A relation S on A with


property P is called the closure of R with respect to P if S is a
subset of every relation Q ( S  Q ) with property P that
contains R ( R  Q ).

Example (symmetric closure):


• Assume R={(1,2),(1,3), (2,2)} on A={1,2,3}.

• What is the symmetric closure S of R?

• S=?

85
Closure of a Relation

Definition: Let R be a relation on a set A. A relation S on A with


property P is called the closure of R with respect to P if S is a
subset of every relation Q ( S  Q ) with property P that
contains R ( R  Q ).

Example (symmetric closure):


• Assume R={(1,2),(1,3), (2,2)} on A={1,2,3}.

• What is the symmetric closure S of R?

• S = {(1,2),(1,3), (2,2)} U {(2,1), (3,1)}


S = {(1,2),(1,3), (2,2),(2,1), (3,1)}

86
Closure of a Relation

Definition: Let R be a relation on a set A. A relation S on A with


property P is called the closure of R with respect to P if S is a
subset of every relation Q ( S  Q ) with property P that
contains R ( R  Q ).

Example (transitive closure):


• Assume R={(1,2), (2,2), (2,3)} on A={1,2,3}.

• Is R transitive?

87
Closure of a Relation

Definition: Let R be a relation on a set A. A relation S on A with


property P is called the closure of R with respect to P if S is a
subset of every relation Q ( S  Q ) with property P that
contains R ( R  Q ).

Example (transitive closure):


• Assume R={(1,2), (2,2), (2,3)} on A={1,2,3}.

• Is R transitive? No.
• How to make it transitive?
• S = {(1,2), (2,2), (2,3)} U {(1,3)}
= {(1,2), (2,2), (2,3),(1,3)}
• S is the transitive closure of R
88
Path length

Theorem: Let R be a relation on a set A. There is a path of


length n from a to b if and only if (a,b) ϵ Rn.

Proof (math induction):

89
Path length

Theorem: Let R be a relation on a set A. There is a path of


length n from a to b if and only if (a,b) ϵ Rn.

Proof (math induction):


• P(1): There is a path of length 1 from a to b if and only if (a,b)
ϵ R1, by the definition of R.

90
Path length

Theorem: Let R be a relation on a set A. There is a path of


length n from a to b if and only if (a,b) ϵ Rn.

Proof (math induction):


• P(1): There is a path of length 1 from a to b if and only if (a,b)
ϵ R1, by the definition of R.
Show: P(n) → P(n+1): Assume there is a path of length n from
a to b if and only if (a,b) ϵ Rn → there is a path of length n+1
from a to b if and only if (a,b) ϵ Rn+1.

91
Path length

Theorem: Let R be a relation on a set A. There is a path of


length n from a to b if and only if (a,b) ϵ Rn.

Proof (math induction):


• P(1): There is a path of length 1 from a to b if and only if (a,b)
ϵ R1, by the definition of R.
Show: P(n) → P(n+1): Assume there is a path of length n from
a to b if and only if (a,b) ϵ Rn → there is a path of length n+1
from a to b if and only if (a,b) ϵ Rn+1.

There is a path of length n+1 from a to b if and only if there


exists an x ϵ A, such that (a,x) ϵ R (a path of length 1) and
(x,b) ϵ Rn is a path of length n from x to b.
92
Path length
Theorem: Let R be a relation on a set A. There is a path of length n from a
to b if and only if (a,b) ϵ Rn.

Proof (math induction):


• P(1): There is a path of length 1 from a to b if and only if (a,b) ϵ R1, by the
definition of R.
Show: P(n) → P(n+1): Assume there is a path of length n from a to b if and
only if (a,b) ϵ Rn → there is a path of length n+1 from a to b if and only if
(a,b) ϵ Rn+1.
There is a path of length n+1 from a to b if and only if there
exists an x ϵ A, such that (a,x) ϵ R (a path of length 1) and (x,b) ϵ Rn is a
path of length n from x to b.

(x,b) ϵ Rn holds due to P(n). Therefore, there is a path of length


n + 1 from a to b. This also implies that (a,b) ϵ Rn+1. 93
Connectivity Relation
Definition: Let R be a relation on a set A. The connectivity
relation R* consists of all pairs (a,b) such that there is a path (of
any length, ie. 1 or 2 or 3 or ...) between a and b in R.


R   Rk
*
k 1

Example:
• A = {1,2,3,4}
• R = {(1,2),(1,4),(2,3),(3,4)}

R1 = {(1,2),(1,4),(2,3),(3,4)}
R2 = R1oR = {(1,3)(2,4)}
R3 = R2oR = {(1,4)}
R4 = R3oR = {} 94
Connectivity Relation
Definition: Let R be a relation on a set A. The connectivity
relation R* consists of all pairs (a,b) such that there is a path (of
any length, ie. 1 or 2 or 3 or ...) between a and b in R.


R   Rk
*
k 1

Example:
• A = {1,2,3,4}
• R = {(1,2),(1,4),(2,3),(3,4)}

• R2 =?

95
Connectivity Relation
Definition: Let R be a relation on a set A. The connectivity
relation R* consists of all pairs (a,b) such that there is a path (of
any length, ie. 1 or 2 or 3 or ...) between a and b in R.


R   Rk
*
k 1

Example:
• A = {1,2,3,4}
• R = {(1,2),(1,4),(2,3),(3,4)}

• R2 = {(1,3),(2,4)}
• R3 = ?

96
Connectivity Relation
Definition: Let R be a relation on a set A. The connectivity
relation R* consists of all pairs (a,b) such that there is a path (of
any length, ie. 1 or 2 or 3 or ...) between a and b in R.


R   Rk
*
k 1

Example:
• A = {1,2,3,4}
• R = {(1,2),(1,4),(2,3),(3,4)}

• R2 = {(1,3),(2,4)}
• R3 = {(1,4)}
•R4 = ?
97
Connectivity Relation
Definition: Let R be a relation on a set A. The connectivity
relation R* consists of all pairs (a,b) such that there is a path (of
any length, ie. 1 or 2 or 3 or ...) between a and b in R.


R   Rk
*
k 1

Example:
• A = {1,2,3,4}
• R = {(1,2),(1,4),(2,3),(3,4)}

• R2 = {(1,3),(2,4)}
• R3 = {(1,4)}
•R4 =Ø
• R* =?
98
Connectivity Relation
Definition: Let R be a relation on a set A. The connectivity
relation R* consists of all pairs (a,b) such that there is a path (of
any length, ie. 1 or 2 or 3 or ...) between a and b in R.


R   Rk
*
k 1

Example:
• A = {1,2,3,4}
• R = {(1,2),(1,4),(2,3),(3,4)}

• R2 = {(1,3),(2,4)}
• R3 = {(1,4)}
•R4 =Ø
• R* = {(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)}
99
Equivalence relation

Reflexive, Symmetric and Transitive at the same


time

A={1,2,3}
R={(1,1)(1,2)(2,1)(2,2)(3,3)}

Is it Reflexive?

100
Equivalence relation

Reflexive, Symmetric and Transitive at the same


time

A={1,2,3}
R={(1,1)(1,2)(2,1)(2,2)(3,3)}

Is it Reflexive? yes
It it Symmetric?

101
Equivalence relation

Reflexive, Symmetric and Transitive at the same


time

A={1,2,3}
R={(1,1)(1,2)(2,1)(2,2)(3,3)}

Is it Reflexive? yes
It it Symmetric? yes
Is it Transitive?
102
Equivalence relation
Reflexive, Symmetric and Transitive at the same
time

A={1,2,3}
R={(1,1)(1,2)(2,1)(2,2)(3,3)}

Is it Reflexive? yes
It it Symmetric? yes
Is it Transitive? yes

103
Is it an Equivalence relation? yes
(mod) congruence Formal Definition

Congruence mod
• Relates two numbers a, a’ to each other relative some base b
• a  a’ (mod b) means that a and a’ have the same remainder
when dividing by b

Let a,a’ be integers and b be a positive integer. We say that a is


congruent to a’ modulo b (denoted by a  a’ (mod b) ) iff b | (a
– a’ ).

Equivalently: a mod b = a’ mod b

Q: Which of the following are true?


1. 3  3 (mod 17)
2. 3  -3 (mod 17)
3. 172  177 (mod 5)
4. -13  13 (mod 26)
104
(mod) congruence

• A:
• 3  3 (mod 17) True.
any number is congruent to itself (3-3 = 0,
divisible by all)
• 3  -3 (mod 17) False.
(3-(-3)) = 6 isn’t divisible by 17.
• 172  177 (mod 5) True.
172-177 = -5 is a multiple of 5
• -13  13 (mod 26) True.
-13-13 = -26 divisible by 26.
105
Equivalence Relation

Definition: A relation R on a set A is called an equivalence


relation if it is reflexive, symmetric and transitive.

Example: Let A = {0,1,2,3,4,5,6} and


• R= {(a,b)| a,b ϵ A, a ≡ b mod 3} (a is congruent to b modulo 3)
Congruencies:
• 0 mod 3 = 0 1 mod 3 = 1 2 mod 3 = 2 3 mod 3 = 0
• 4 mod 3 = 1 5 mod 3 = 2 6 mod 3 = 0

106
Equivalence Relation

Definition: A relation R on a set A is called an equivalence


relation if it is reflexive, symmetric and transitive.

Example: Let A = {0,1,2,3,4,5,6} and


• R= {(a,b)| a,b ϵ A, a ≡ b mod 3} (a is congruent to b modulo 3)
Congruencies:
• 0 mod 3 = 0 1 mod 3 = 1 2 mod 3 = 2 3 mod 3 = 0
• 4 mod 3 = 1 5 mod 3 = 2 6 mod 3 = 0
Relation R has the following pairs:
• (0,0) (0,3), (3,0), (0,6), (6,0)
• (3,3), (3,6) (6,3), (6,6) (1,1),(1,4), (4,1), (4,4)
• (2,2), (2,5), (5,2), (5,5)
107
Equivalence Relation

Example: Let A = {0,1,2,3,4,5,6} and


• R= {(a,b)| a,b ϵ A, a ≡ b mod 3} (a is congruent to b modulo 3)
Relation R has the following pairs:
• (0,0) (0,3), (3,0), (0,6), (6,0)
• (3,3), (3,6) (6,3), (6,6) (1,1),(1,4), (4,1), (4,4)
• (2,2), (2,5), (5,2), (5,5)
3|(a-b)
R={(0,0) (0,3), (3,0), (0,6), (6,0), (3,3), (3,6) (6,3), (6,6)
(1,1),(1,4), (4,1), (4,4), (2,2), (2,5), (5,2), (5,5)}

Is R reflexive

108
Equivalence Relation

Example: Let A = {0,1,2,3,4,5,6} and


• R= {(a,b)| a,b ϵ A, a ≡ b mod 3} (a is congruent to b modulo 3)
Relation R has the following pairs:
• (0,0) (0,3), (3,0), (0,6), (6,0)
• (3,3), (3,6) (6,3), (6,6) (1,1),(1,4), (4,1), (4,4)
• (2,2), (2,5), (5,2), (5,5)

R={(0,0) (0,3), (3,0), (0,6), (6,0), (3,3), (3,6) (6,3), (6,6)


(1,1),(1,4), (4,1), (4,4), (2,2), (2,5), (5,2), (5,5)}

Is R reflexive Yes
Is R symmetric

109
Equivalence Relation

Example: Let A = {0,1,2,3,4,5,6} and


• R= {(a,b)| a,b ϵ A, a ≡ b mod 3} (a is congruent to b modulo 3)
Relation R has the following pairs:
• (0,0) (0,3), (3,0), (0,6), (6,0)
• (3,3), (3,6) (6,3), (6,6) (1,1),(1,4), (4,1), (4,4)
• (2,2), (2,5), (5,2), (5,5)

R={(0,0) (0,3), (3,0), (0,6), (6,0), (3,3), (3,6) (6,3), (6,6)


(1,1),(1,4), (4,1), (4,4), (2,2), (2,5), (5,2), (5,5)}

Is R reflexive Yes
Is R symmetric Yes
Is R transitive 110
Equivalence Relation
Example: Let A = {0,1,2,3,4,5,6} and
• R= {(a,b)| a,b ϵ A, a ≡ b mod 3} (a is congruent to b modulo 3)
Relation R has the following pairs:
• (0,0) (0,3), (3,0), (0,6), (6,0)
• (3,3), (3,6) (6,3), (6,6) (1,1),(1,4), (4,1), (4,4)
• (2,2), (2,5), (5,2), (5,5)

R={(0,0) (0,3), (3,0), (0,6), (6,0), (3,3), (3,6) (6,3), (6,6)


(1,1),(1,4), (4,1), (4,4), (2,2), (2,5), (5,2), (5,5)}

Is R reflexive Yes
Is R symmetric Yes
Is R transitive Yes
111
Then R is an equivalence relation.
Example on Relation

Let R be the relation on the set {0, 1, 2, 3} containing the


ordered pairs R={(0, 1), (1, 1), (1, 2), (2, 0), (2, 2), (3, 0)}. Find
the
a) reflexive closure of R.
b) symmetric closure of R.

112
Equivalence Relation

Find the transitive closures of these relations on {1, 2, 3, 4}.


a) R= {(1, 2), (2,1), (2,3), (3,4), (4,1)}
b) {(2, 1), (2,3), (3,1), (3,4), (4,1), (4, 3)}

R= {(1, 2), (2,1), (2,3), (3,4), (4,1)}


S={(1, 2), (2,1), (2,3), (3,4), (4,1)}
U {(1,1)(1 3) (22)(24) (31)(42)} U{(14)(24)(33)(32) (43)(44)}

113
Equivalence Relation

Which of these relations on {0, 1, 2, 3} are equivalence


relations? Determine the properties of an equivalence relation
that the others lack.
a) {(0, 0), (1, 1), (2, 2), (3, 3)} yes
b) {(0, 0), (0, 2), (2, 0), (2, 2), (2, 3), (3, 2), (3, 3)} no
c) {(0, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 3)} yes
d) {(0, 0), (1, 1), (1, 3), (2, 2), (2, 3), (3, 1), (3, 2),(3, 3)} no

114
Thank You

115

You might also like