Introduction To Relation01

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Introduction to Relation

Introduction
• Relationships between elements of sets are represented using the
structure called “RELATION.”
• Relationship between a program and its variables….
• Pairs of cities linked by airline flights in a network….
Relation
• The most direct way to express a relationship between elements of
two sets is to use ordered pairs.
• For this reason, sets of ordered pairs are called binary relations.

• Definition:
• Let A and B be sets. A binary relation from A to B is a subset R of
A x B = { (a,b) : a ϵ A, b ϵ B }
Relation
• In other words, for a binary relation R, we have
R AXB. We use the notation aRb to denote that (a,b) ϵ R and aRb
To denote that (a,b) ϵ R

When (a,b) belongs to R, a is said to be related to b by R.


Relations
• Let A and B be sets. A binary relation from A to B is a subset of A X B

• Essentially, a binary relation is a set R of ordered pairs where the first


element of each ordered pair comes from A, and the second element
comes from B.
• Let A = {1,2,3} and B = {a, b, c}
• Then R = {(1, a), (1,b), (2,b), (2,c), (3,a)} is a relation from A to B.

1 a 1Ra
2 b 1Rc
3 c
Recall that a FUNCTION is a relation where each element of B is
mapped to by only one element of A.
Examples
• If Adam takes Discrete Math, Programming and Nutrition, and Kevin
takes Discrete Math and Composition, give the relation from A to B, if
A = {Adam, Kevin} and B = {Discrete Math, Programming, Nutrition,
Composition}
Binary Relation on a set
• A binary relation on a set is a subset of A x A, or a relation from set A
onto itself.

• If A = {1,2,3,4}, then list the ordered pairs in set R if


R = {(a,b) | a divides b}
Examples
• How many relations are there from set A to itself?
Examples
• Consider the relations below. Which contain (1,1), (1,3), (2,4) and
(2,1)?

• R1 = {(a,b) | a=b}
• R2 = {(a,b) | a<=b}
• R3 = {(a,b) | a>b}
• R4 = {(a,b) | a+b<=3}
Properties of Relations
• Reflexive Relations
A relation R is reflexive iff (a,a) ϵ R for every a ϵ A
Tell whether the ff relations are reflexive.
• R1 = {(a,b) | a=b}
• R2 = {(a,b) | a<=b}
• R3 = {(a,b) | a>b}
• R4 = {(a,b) | a+b<=3}
Properties of Relations
• Symmetric Relations
A relation R is reflexive iff (b,a) ϵ R whenever (a,b) ϵ R
Tell whether the ff relations are symmetric.
• R1 = {(a,b) | a=b}
• R2 = {(a,b) | a<=b}
• R3 = {(a,b) | a>b}
• R4 = {(a,b) | a+b<=3}
Properties of Relations
• Anti-symmetric Relations
A relation R on a set A is anti-symmetric if Ɣ a,b ϵ A if (a,b) ϵ R and
(b,a) ϵ R, then a=b
Tell whether the ff relations are symmetric.
• R1 = {(a,b) | a=b}
• R2 = {(a,b) | a<=b}
• R3 = {(a,b) | a>b}
• R4 = {(a,b) | a+b<=3}
Properties of Relations
• Transitive Relations
A relation R on a set A is Transitive if whenever (a,b) ϵ R and (b,c) ϵ
R, then (a,c) ϵ R ….. Ɣa,b,c ϵ R
Tell whether the ff relations are symmetric.
• R1 = {(a,b) | a=b}
• R2 = {(a,b) | a<=b}
• R3 = {(a,b) | a>b}
• R4 = {(a,b) | a+b<=3}
Relations
n-ary Relations and Their Applications
Representing Relations

You might also like