0% found this document useful (0 votes)
80 views30 pages

Chapter 5 - Relation

This document discusses binary relations and their properties. It defines binary relations as subsets of Cartesian products and provides examples of relations between sets of students and courses. It then discusses various ways to represent relations, including roaster notation, set builder notation, graphs, and tables. It also defines key properties of relations such as reflexivity, symmetry, antisymmetry, and transitivity. Finally, it discusses representing relations using zero-one matrices and performing operations on relations.

Uploaded by

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

Chapter 5 - Relation

This document discusses binary relations and their properties. It defines binary relations as subsets of Cartesian products and provides examples of relations between sets of students and courses. It then discusses various ways to represent relations, including roaster notation, set builder notation, graphs, and tables. It also defines key properties of relations such as reflexivity, symmetry, antisymmetry, and transitivity. Finally, it discusses representing relations using zero-one matrices and performing operations on relations.

Uploaded by

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

Chapter 5: Relations

8.1 Relations and Their Properties


Binary relations:
• Let A and B be any two sets.

• A binary relation R from A to B, written


R : A  B,
is a subset of the Cartesian product A×B.
• The notation a R b means (a, b)  R.

• The notation a R b means (a, b)  R.


• If a R b we may say that a is related to b (by
relation R ), or a relates to b (under relation R ).
Example

Let R : A  B, and
A = {1, 2, 3} represents students,
B = {a, b} represents courses.
A×B = { (1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}.
If R = {(1, a), (1, b)}, it means that student 1
registered in courses a and b
Relations can be Represented by:
Let A be the set {1, 2, 3, 4} for which ordered pairs
are in the relation
R = {(a, b) | a divides b}

A- Roaster Notation: List of ordered pairs:


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

B- Set builder notation:


R = {(a, b) : a divides b}
Relations can be Represented by:

C- Graph:
R = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 4)}

1 1
2 2
OR 1 2 3 4
3 3
4 4
Domain of R
Relations can be Represented by:

D- Table:
R = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 4)}

R 1 2 3 4

1 × × × ×

2 × ×

3 ×

4 ×
Relations on a Set

• A (binary) relation from a set A to itself is called


a relation on the set A.

e.g. The “<” relation defined as a relation on the


set N of natural numbers:
let < : N  N :≡ {(a, b) | a < b }
If (a, b)  R then a < b means (a, b)  <
e.g. (1, 2)  < .
Relations on a Set

• The identity relation IA on a set A is the set


{(a, a) | a  A}.

e.g. If A = {1, 2, 3, 4},


then IA = {(1, 1), (2, 2), (3, 3), (4, 4)}.
Relations on a Set
Examples:
R1 = {(a, b) | a ≤ b}
R2 = {(a, b) | a = b or a = -b}
R3 = {(a, b) | a + b ≤ 3}
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
Question

How many relations are there on a set with n


elements?

Answer:
1. A relation on set A is a subset from A×A.
2. A has n elements so A×A has n2 elements.
2
n
3. Number of2 subsets for n2 elements is 2 , thus
there are 2 n relations on a set with n elements.

32
e.g. If S = {a, b, c}, there are 2  29  512 relations.
Properties of Relations
1. Reflexivity and Irreflexivity
A relation R on A is reflexive if (a, a)  R for every
element a  A.

e.g. Consider the following relations on {1, 2, 3, 4}


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
Not Reflexive.
R2 = {(1, 1), (2, 1), (2, 2), (3, 3), (3, 4), (4, 4)},
Reflexive.
R3 = {(a, b) | a ≤ b},
Reflexive.
Reflexivity and Irreflexivity

A relation R on A is irreflexive if for every element


a  A, (a, a)  R.

Note: “irreflexive” ≠ “not reflexive”.

e.g. If A = {1, 2}, R = {(1, 2), (2, 1), (1, 1)} is


not reflexive because (2, 2)  R,
not irrflexive because (1, 1)  R.
Example

1 2

3 4
Not Reflexive and Not Irreflexive
Examples

1 2 1 2

3 4 3 4

Irreflexive Reflexive
2. Symmetry and Antisymmetry

• A binary relation R on A is symmetric if


(a, b)  R ↔ (b, a)  R, where a, b  A.

• A binary relation R on A is antisymmetric if


(a, b)  R → (b, a)  R.
That is, if (a, b)  R  (b, a)  R → a = b.
Examples

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},
Not symmetric, antisymmetric.
Examples

Let A = {1, 2, 3}.

Not reflexive, not irreflexive, not


R1 = {(1, 2), (2, 2), (3, 1), (1, 3)}
symmetric, not antisymmetric
Not reflexive, not irreflexive, not
R2 = {(2, 2), (1, 3), (3, 2)}
symmetric, antisymmetric
Reflexive, not irreflexive,
R3 = {(1, 1), (2, 2), (3, 3)}
symmetric, antisymmetric
Not reflexive, irreflexive, not
R4 = {(2, 3)}
symmetric, antisymmetric
3. Transitivity

• A relation R is said to be transitive if and only if


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

e.g. Let A = {1, 2}.

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

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

R3 = {(3, 4)} is transitive.


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)}, then

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

R1 R 2 = {(1, 1)}

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


Composite Relations

• If (a, c) is in R1 and (c, b) is in R2 then (a, b) is in


R2◦R1 .

e.g. 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)}.
S◦R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}.
8.3 Representing Relations

• Some special ways to represent binary relations:


– With a zero-one matrix.
– With a directed graph.
Using Zero-One Matrices

To represent a relation R by a matrix MR = [mij ], let mij = 1


if (ai , bj)  R, otherwise 0.

Let A = {1, 2, 3} , B = {1, 2} , R : A → B such that:

R = {(2, 1), (3, 1), (3, 2)} then the matrix for R is:
1 2

1 0 0  0 0
1 0 M R  1 0
2    
3 1 1 
1 1

Zero-One Reflexive, Symmetric
The terms: Reflexive, non-reflexive, irreflexive,
symmetric and antisymmetric.
– These relation characteristics are very easy to
recognize by inspection of the zero-one
matrix.
1 any-  0 any-   1   0 
 1 thing   0 thing  1 0  1 0 1 

an
      

an
y
th

yt
in

hi
 1   0     1 

ng
 thing
any-   thing
any-     
 1  0  0   0 
Reflexive: Irreflexive: Symmetric: Antisymmetric:
all 1’s on diagonal all 0’s on diagonal all identical all 1’s are across
across diagonal from 0’s
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 meet  can
be used to find the matrices representing the
union and the intersection of two relations

M R1  R2  M R1  M R2
M R1  R2  M R1  M R2
Example
Suppose R1 and R2 are relations on a set A which are
represented by the matrices:
1 0 1  1 0 1 
M R  1 0 0 and M R  0 1 1 
1 2

0 1 0 1 0 0


1 0 1
M R1  R2  M R1  M R2  1 1 1,
1 1 0 
1 0 1 
M R1  R2  M R1  M R2  0 0 0.
0 0 0
Operations

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  M R M S  0 1 1 
0 0 0
Using Directed Graphs

Reflexive ( bcz: (1,1), (2,3),(3,3)  R)


Symmetric ((2,3) ,(3,2) R , (1,3),(3,1)  R)
Not Ant symmetric ((2,3) ,(3,2)  R)
Not Transitive ( (1,3) ,(3,2)  R
but (1,2)  R)
Digraph Reflexive, Symmetric
It is extremely easy to recognize the reflexive,
irreflexive, symmetric, antisymmetric properties by
graph inspection.

 

 
     
Reflexive: Irreflexive: Symmetric: Antisymmetric:
Every node No node Every link is No link is
has a self-loop links to itself bidirectional bidirectional
Not symmetric, non-antisymmetric Non-reflexive, non-irreflexive

You might also like