You are on page 1of 21

# M131-Chapter8 By Ms.

Suha Al-Shaikh-Dammam

Binary relation

relation R)”.

Example:

Let R: A ↔ B

## A. Roaster Notation: List of ordered pairs

Ex: 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),(2,2),(3,3),(4,4),(1,3),(1,2),(1,4),(2,4)}

## Ex: R={(a,b)| a divides b}

C. Graph

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

1
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

D. Table

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

Relations on a Set

## A (binary) relation from a set A to itself is called a relation on the set A.

Example: The “<” relation defined as a relation on the set N of natural numbers.

## * The identity relation IA on a set A is the set {(a,a)|aA}.

Example:

A = {1,2,3,4}

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

Example:

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

## Which of these relations contain each of the following pairs (1,1),(1,2),(1,-1)?

(1,1) is in R1,R2,R3

(1,2) is in R1,R3

(1,-1) is in R2,R3

2
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Question:

## 2. A has n elements so A x A has n2 elements.

2
3. Number of subsets for n2 elements is 2 n
2
Thus there are 2 n relations on a set with n elements.

Example

S ={a, b, c}

There are :

23  29  512 Relations
2

Properties of Relations

## Ex: Consider the following relations on {1,2,3,4}

1. R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4}

Not Reflexive

2. R2={(1,1),(2,1),(2,2),(3,3),(3,4),(4,4)}

Reflexive

3. R3 = {(a, b) | a ≤ b} Reflexive

Example:

A= {1, 2}

## Not irrflexive because (1,1)  R

3
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Example:

Example:

## *A binary relation R on A is antisymmetric if :

(a,b)R → (b,a)R.

## also: (a,b)R  (b,a) R →(a=b)

Example:

Let A = {1,2,3}

4
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Example:

## Consider these relations on the set of integers:

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

symmetric , antisymmetric

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

## not symmetric, antisymmetric

R3={(a, b) | a=b+1}

3. Transitivity

## A relation R is transitive iff (for all a,b,c)

(a,b)R  (b,c)R → (a,c)R.

Examples: A= {1,2}

R1={(1,1),(1,2),(2,1),(2,2)} transitive

## R2={(1,1),(1,2),(2,1)} not transitive, (2,2) R2

R3 ={(3,4)} transitive

Special cases

Empty set {}

U universal set.

## Reflexive, transitive, symmetric

Combining Relations:

## Let A={1,2,3} , B={1,2,3,4}

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

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

R1  R2 = {(1,1),(2,2),(3,3), (1,2),(1,3),(1,4)}

R1  R2= {(1,1)}

R1- R2={(2,2),(3,3)}

5
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Composite Relations:

If R1 a relation from a set A to a set B, and R2 is a relation from set B to set C, the
R2◦ R1 is a set from A to C.

A 
R1
B 
R2
C

A   C
R 2 R1

Ex:

## R is the relation from {1,2,3} to {1,2,3,4}

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

## S is the relation from {1,2,3,4} to {0,1,2}

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

Power

## the power Rn, n=1,2,3… are defined by

R1 =R and Rn = Rn-1 ◦ R

## Ex: Let R ={(1,1),(2,1),(3,2),(4,3)}.

Find:

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

R3 = R2 ◦ R= {(1,1),(2,1),(3,1),(4,1)}

## The Inverse Relation :

Let R be a Relation from a set A to a set B. The inverse relation from B to A denoted
by: R-1= {(b,a)| (a,b)  R}.

## The Complementary Relation:

R  {(a, b) | (a, b)  R}

6
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## To represent a relation R by a matrix

MR = [mij], let mij = 1 if (ai,bj)R, else 0.

E.g., Joe likes Susan and Mary, Fred likes Mary, and Mark likes Sally.

## The 0-1 matrix representation of that “Likes”relation:

Susan M ary Sally
Joe  1 1 0 
Fred  0 1 0 
M ark  0 0 1 

Example:

## A={1,2,3} , B={1,2} , R: A↔B such that:

0 0 
R= {(2,1),(3,1),(3,2)} then the matrix for R is: M R  1 0 
1 1 

7
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## Terms: Reflexive, non-Reflexive, irreflexive,symmetric and antisymmetric.

These relation characteristics are very easy to recognize by inspection of the zero-
one matrix.

Remark: 1) The relation R is reflexive if all the elements on the main diagonal of M R

## Are equal to 1 (note that M R is a square matrix)

(2) The relation R is symmetric if and only if mij  m ji for all pairs of integers i
and j with i = 1,2,…..,n and j = 1,2,…….n

## (3)The relation R is symmetric if and only if : M R  (M R ) t

(4) The relation R is anti symmetric if and only if (a,b)  R and (b,a)  R → a=b. The
matrix of anti symmetric relation has the property that if mij  1 i  j then m ji  0

Example:

## Is R reflexive, symmetric, antisymmetric?

1 1 0 
M R  1 1 1 
0 1 1
Reflexive, symmetric, not antisymmetric

Operations

## 1) Union and the Intersection

The Boolean Operations join  and meat  can be used to find the matrices
representing the union and the intersection of two relations

Then: M R1 R 2  M R1  M R 2
M R1 R 2  M R1  M R 2

8
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Example:

## Suppose R1 and R2:relations on set A are represented by the matrices:

1 0 1  1 0 1 
M R1  1 0 0 and M R2  0 1 1 
0 1 0 1 0 0
Then :
1 0 1
M R1 R 2  M R1  M R 2  1 1 1 
1 1 0
1 0 1 
M R1 R 2  M R1  M R 2  0 0 0
0 0 0

2) Composite

Suppose that R: A ↔ B, S: B ↔ C

(Boolean Product)

M S R  M R M S

Example:

Let 1 0 1  0 1 0 
M R  1 1 0  and M S  0 0 1
0 0 0 1 0 1 
Find the matrix of S  R

1 1 1 
M S R  0 1 1 
0 0 0

3)Power

M R n  M R[n ]
• R2 =R ◦ R = MR

## • R3= R2◦ R = MR

9
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Example

Find the matrix that represent R2 where the matrix representing R is:

0 1 0  0 1 1 
M R  0 1 1  then M R2  1 1 1 
1 0 0 0 1 0

## A directed graph or digraph G=(VG,EG) is a set VG of vertices (nodes) with a set

EGVG×VG of edges (arcs,links). Visually represented using dots for nodes, and
arrows for edges. Notice that a relation R:A↔B can be represented as a graph
GR=(VG=AB, EG=R).
Susan M ary Sally
Joe  1 1 0 
Fred  0 1 0 
M ark  0 0 1 

Note that : an edge from (a,a) represented using an arc from the
vertex a back to it self. Such an edge is called a loop

Example:

## Answer: Vertices are a,b,c, and d

Edges are (a,b), (b,b), (c,b), (a,d), (b,d), (d,b), and (c,a).

## Example: Draw a diagraph of the relation

R={(1,1),(1,3),(2,1),(2,3),(2,4),(3,1),(3,2),(4,1)} on the set {1,2,3,4}

Solution:

11
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## It is extremely easy to recognize the reflexive/irreflexive/ symmetric/antisymmetric

properties by graph inspection.

Example: Determine whether the relation for the following directed graph are
reflexive, symmetric , anti symmetric, and or transitive.

## (a,a), (b,b), (c,c)  R

2)It is not symmetric because there are (a,b) but not (b,a).

## 3)R is not anti symmetric, because (b,c) and (c,b) in R.

4)R is not transitive because (a,b), and (b,c) belongs to S, but (a,c) doesn’t belong.

11
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Closures of Relations

Definition: For any property X, the “X closure” of a set A is defined as the “smallest”
superset of A that has the given property.

## The reflexive closure of a relation R on A is obtained by adding (a,a) to R for each

aA not already in R

I.e., it is R  IA

Example

## The relation R={(1,1),(1,2),(2,1),(3,2)} on the set A ={1,2,3} is not reflexive.

How can you produce a reflexive relation containing R that is as small as possible?

## Reflexive closure of R is:

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

Example

## {(a ,b)| a < b}  {(a,a)| a  Z} = {(a,b) | a ≤ b}

12
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## The symmetric closure of R is obtained by adding (b,a) to R for each (a,b) in R.

i.e., it is R  R−1

Example

The relation

## {(1,1),(2,2),(1,2),(3,1),(2,3),(3,2)} on the set {1,2,3} is not symmetric.

How can we produce a symmetric relation that is as small as possible and contains R?

## Answer: by adding (2,1) and (1,3) so theSymmetric Closure of R is:

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

Example

## The transitive closure or connectivity relation of R is obtained by repeatedly

adding (a, c) to R for each (a, b), (b, c) in R.

i.e., it is R*  R n

nZ 

## Or in term of zero-one matrices:

MR*=MR MR…………MR[n]

Example

## R={(1,1), (1,2), (2,1),(3,2)} on the set A= {1, 2, 3}

• R* = R  R2  R3

• R2 = R ◦ R = {(1,1),(1,2),(2,2),(3,1)}

• R3 = R2o R = {(1,1),(1,2),(2,1),(2,2),(3,2)}

• R* = {(1,1),(1,2),(2,1),(3,2),(2,2),(3,1)}

13
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Example:

1 0 1 
*
Find MR for M R  0 1 0
1 1 0 
1 1 1 
M R *  M R  M R[ 2 ]  M R[ 3 ]  0 1 0
1 1 1 

Questions: 1) let R be the relation on the set {0,1,2,3} containing the pairs
(0,1),(1,1),(1,2),(2,0),(2,2) and (3,0). Find the

a) Reflexive closure of R

b) Symmetric closure of R

## b) Symmetric closure of R={(0,1),(0,2),(0,3),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2),(3,0)}

_____________________________________________________________________

2) Let R be the relation {(a,b)| a divides b} on the set of integers. What is the
symmetric closure of R?

## Solution: Symm. Closure of R={(a,b)| a divides b or b divides A}

_____________________________________________________________________

3) Draw the directed graph of the reflexive closure and the symm. Closure of the
relation with the directed graph shown

Solution:

14
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Equivalence Relations
An equivalence relation on a set A is simply any binary relation on A that is reflexive,
symmetric, and transitive.

Example:

## R is symmetric since a-b and b-a is an integer

R is transitive since for (a,b) then a-b integer and for (b,c) then b-c integer ,

## Therefore( a-b )+( b-c) =a-c is also an integer so (a,c) in R

so R is an Equivalence Relation.

Example:

relation.

## It follows: b-a = (-k)m

So that : b ≡a(mod m)

*R is transitive: Suppose

## a - b=km and b - c=lm

a-c=(a-b)+(b-c)=km+lm=(k+l)m

## Thus: a ≡c ( mod m) So R is Equivalence

15
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## Read example 4 and 5 page 557

Example: show that “divides” relation on the set of positive integers is not an
equivalence relation.

Solution:

## so R is not an equivalence relation

Example: let R be the relation on the set of real numbers such that x Ry if and only if
x and y are real numbers that differ by less than 1. That is |x-y|<1. Show that R is not
an equivalence relation.

Solution:

## Symmetric: suppose xRy→|x-y|<1 but

|x-y|=|y-x|<1→yRx so R is symmetric.

## Suppose xRy and yRz

 x  y  1 and y  z  1
 1  x  y  1
   add  2  x  y  y  z  2
 1  y  z  1
2 xz  2 xz  2

So R is not transitive.

Equivalence classes:

Definition: let R be an equivalence relation on a set A. The set of all elements that are
related to an element a of A is called the equivalence class of a (denoted by [a]R ).
aR  s | (a, s)  R

## Remark: in other words, if R is an equivalence relation on a set A, the equivalence

class of the element a is

## If b  aR , then b is called a representative of this equivalence class.

Do example8.

16
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Example: what are the equivalence classes of 0 and 1 for congruence modulo 4?

Solution:

*The equivalence class of 0 contains all integers a such that a  o(mod 4) . The
integers in this class are divisible by 4. so 04  ....,8,4,0,4,8,....

## *The equivalence class of 1 contains all integers a such that a  o(mod 4)

The integers in this class are those that have a remainder 1 when divided by 4.

So 14  ....,7,3,1,5,9,....

## Remark: The congruence classes of an integer a modulo m is denoted by

am  ......, a  2m, a  m, a, a  m, a  2m,...
Refer to last example. Find 24 and 34

24  ....,6,2,2,6,10,...
34  ....,5,1,3,7,11,...

17
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## Definition: A relation R on a set S is called a partial ordering or partial order if it is

reflexive, anti symmetric and transitive.

A set S together with R is called a partially ordered set, or poset and is denoted by
(S,R), members of S are called elements of the poset.

Example1: (page566)

Show that the “greater than or equal” relation (≥)is the partial ordering on the set of
integers.

Solution:

## 3) transitive: if a ≥ b and b ≥ c then a ≥ b ≥ c. Hence a ≥ c so ≥ is transitive. It follows

that ≥ is a partial ordering on the set of integers and (Z, ≥) is a poset.

## Solution: 1) reflexive: since a|a for every positive integer a. | is reflexive.

2) Anti symmetric: if a|b and b|a then a=b. Hence | is anti symmetric.

## 3) transitive: Suppose a|b and b|c then b=ka and c=lb

C=lb=l(ka)=(lk)a→a|c so | is transitive

It follows that | is a partial ordering on the set of positive integers and and ( Z  , |)
is a poset.

Example: show that the inclusion relation  is a partial ordering on the power set of a
set S.

## *Transitive: suppose A  B and B  C then A  B  C→A  C Hence  is

transitive

Therefore  is a partial ordering on the power set of a set S; and (p(s),  ) is a poset.

18
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## Example: page 567

Let R be the relation on the set of people such that xRy if x and y are people and x is
older than y. Show that R is not a partial ordering.

Solution: R is not reflexive because no person is older than himself or herself. That is
xRx for all people x it follows that R is not partial ordering.

(S,R).

## The elements a and b of a poset (S,  ) are called comparable if either a  b or b  a.

Example: In the poset ( Z  , |) are the integers 3 and 9 comparable? Are 5 and 7
comparable?

Solution: because 3|9, the integers 3 and 9 are comparable. Because 5 | 7, the integers
5 and 7 are in comparable.

Remark: when every two elements in the set are comparable, the relation is called
a total ordering.

## Definition: if S ,  is a poset and every 2 elements of S are comparable, S is called a

totally ordered or linearly ordered set, and  is called a total order or a linear order.
A totally ordered set is also called a chain.

Example:page 568:

the poset (Z,≤) is totally ordered, because a≤b or b≤a whenever a and b are integers.

Example: the poset ( Z  , |) is not totally ordered because it contains elements that are
in comparable, such as 5 and 7.

## Lexicographic order: consider the 2 posets  A1 , 1 and  A2 , 2  . The lexicographic

ordering ≤ on A1×A2 is defined by:
a1 , a2 is less than b1 , b2 that is a1 , a2   b1 , b2 
either if a1 1 b1 or if both a1  b1 and a2  2 b2

19
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

## whether (4,9)  (4,11) in the poset  where is the lexicographic ordering

constructed from the usual ≤ relation on Z.

Solution: because 3<4 it follows that (3,5)  (4,8) and that (3,8)  (4,5), we have
(4,9)  (4,11), because the first entries of (4,9) and (4,11) are the same but 9<11.

Examplepage 569:

note that (1,2,3,5)  (1,2,4,3), because the entries in the first 2 positions of these 4-
tuples agree, but in the third position the entry in the first 4-tuples,3 is less than 4 (
here the ordering on 4-tuples is the lexicographic ordering that comes from the usual
“less than or equals” relation on the set of integers).

## Hasse diagrams: (finite set)

The Hasse Diagram for the partial ordering relation is obtained from the associated
diagrams by deleting all the loops and all the edges that occur from transitivity

1) Starts with the directed graphs for the given relation (partial ordering set)

## 2) Remove the loops (since it is reflexive)

3) Remove the edges that must be in-the partial ordering because of the presence
of other edges and transitivity. E.g if (a,b) and (b,c) are in the partial ordering
remove (a,c)

4) Finally arrange each edge so that its initial vertex is below its terminal vertex.

Example: Draw the Hasse Diagram representing the partial ordering {(a,b):a≤b} on
the set {1,2,3,4}

Solution: R{(1,1),(2,2),(3,3),(4,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)}

21
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam

Example: Draw the Hasse Diagram representing the partial ordering {(a,b):a|b} on
{1,2,3,4,6,8,12}