0% found this document useful (0 votes)
15 views36 pages

relation slides

The document discusses the concept of relations in discrete structures, including Cartesian products, binary relations, and their properties such as reflexivity, symmetry, and transitivity. It explains how relations can be represented in various forms, including set-builder notation and matrices, and introduces the concept of equivalence relations. Additionally, it covers the combination of relations and their applications in solving problems and data structures in computer science.

Uploaded by

baigzain498
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)
15 views36 pages

relation slides

The document discusses the concept of relations in discrete structures, including Cartesian products, binary relations, and their properties such as reflexivity, symmetry, and transitivity. It explains how relations can be represented in various forms, including set-builder notation and matrices, and introduces the concept of equivalence relations. Additionally, it covers the combination of relations and their applications in solving problems and data structures in computer science.

Uploaded by

baigzain498
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/ 36

Discrete Structure

Relation

ALLPPT.com _ Free PowerPointTemplates, Diagrams and Charts


Relations

• Cartesian Product, Relations, Equivalence


Relations, and Logical Properties of
Relations.
Representation

 Statement (or Descriptive) Form


 Set of apple, orange, pear, and banana  Roster (or List) Form
 N: Set of all natural numbers
 Z: Set of all integers
 Q: Set of all rational numbers
 R: Set of all real numbers
 Z+: Set of all positive integers

 Set-builder notation
 𝐵 = {𝑥: 𝐹𝑟𝑢𝑖𝑡𝑠 | 𝑥 = 𝑎𝑝𝑝𝑙𝑒, 𝑥 = 𝑜𝑟𝑎𝑛𝑔𝑒, 𝑥 = 𝑝𝑒𝑎𝑟, 𝑥 = 𝑏𝑎𝑛𝑎𝑛𝑎}
 ℕ = {𝑥: 𝑥 ≥ 1} 𝑜𝑟 ℕ = 𝑥: ℤ 𝑥 ≥ 1}
 ℚ = 𝑝/𝑞 𝑝, 𝑞 ∈ ℤ, 𝑞 ≠ 0}
Construction
• Cartesian Product
• Purpose of Cartesian Product
– All possible ways to take things from multiple sets
• Example: I have an apple, and orange, and a pear. The TA has a pencil, a pen, a
n eraser, and a book. You take one thing from each of us.”
• You are selecting one element from each set. What are the possible selections
you can make? How many possibilities are there?
• Symbolic Notation: 𝐴 × 𝐵
• Definition: 𝐴 × 𝐵 = 𝑎, 𝑏 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵}
– Example: A standard deck of playing cards is basically the Cartesian Product

{♠, ♣, ♥, ♦} × {𝐴, 2,3,4,5,6,7,8,9, 𝐽, 𝑄, 𝐾}

Important Property
𝐴 × 𝐵 ≠ 𝐵 × 𝐴 (commutative property does not hold)
Cardinality
𝐴 × 𝐵 = 𝐴 . 𝐵 = 𝑚𝑛
Other representations
Matrices
𝑅𝑜𝑤𝑠 × 𝐶𝑜𝑙𝑢𝑚𝑛𝑠
Graphs
Vertices, Edges
Adjacency Matrix
Relations
Let A and B be sets. A binary relation from A to B is a subset of A × B.
We use the notation aRb to denote that (a, b) ∈ R and a R b to denote that (a,
b) /∈ R. Moreover, when (a, b) belongs to R, a is said to be related to b by R.
Relationships between elements of sets occur in many contexts.
The most direct way to express a relationship betwe
en elements of two sets is to use ordered pairs mad
e up of two related elements. For this reason, sets o n-ary relations, which expres
f ordered pairs are called binary relations. s relationships among eleme
nts of more than two sets
A binary relation from A to B is a set R of ordered
pairs where the first element of each ordered pair c
omes from A and the second element comes from
B.
Relationships between elements of sets are represented using the structure called a
relation, which is just a subset of the Cartesian product of the sets. Relations can be
used to solve problems such as determining which pairs of cities are linked by airline
flights in a network, finding a viable order for the different phases of a complicated
project, or producing a useful way to store information in computer databases
Relations
 A binary relation 𝑅 from set 𝐴 to 𝐵 is a subset of 𝐴 × 𝐵
 𝐴 = {1, 2, 3, 4} and 𝐵 = {𝑎, 𝑏, 𝑐} then 𝑅 ⊆ 𝐴 × 𝐵
 All possible relations = 212
 𝑅 = { 1, 𝑎 , 1, 𝑐 , 2, 𝑏 , 3, 𝑏 }
 We would say that 1, 𝑐 has this relation, of that 1 is related to 𝑐 by 𝑅.
 Or, “1𝑅𝑐” indicates that two elements 1 and 𝑐 are related, or “2℟𝑐” indicates that two elements 2 and
𝑐 are not related.
 Relational operators: (<, ≤, >, ≥)
 < = 𝑖, 𝑗 𝑖, 𝑗 ∈ ℝ, 𝑖 < 𝑗}
 “divides” is a relation on the integers such as
 𝑎, 𝑏 𝑎, 𝑏 ∈ ℤ, 𝑏 = 𝑎𝑐 𝑓𝑜𝑟 𝑎𝑛 𝑖𝑛𝑡𝑒𝑔𝑒𝑟 𝑐}
 Mathematical and Programming Functions as a particular kind of relation.

Relations on a Set
A relation on a set A is a relation from A to A.
let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relati
on R = {(a, b) | a divides b}? Solution: Because (a, b) is in R if an
d only if a and b are positive integers not exceeding 4 such that
a divides b, we see that R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2,
4), (3, 3), (4, 4)}.
Properties of relation
There are several properties that are used to classify relations on a set. We will introduce the most importa
nt of these here. In some relations an element is always related to itself. For instance, let R be the relation
on the set of all people consisting of pairs (x, y) where x and y have the same mother and the same father.
Then xRx for every person x. Consider the following relations on {1, 2, 3, 4}:

A relation R on a set A is called reflexive if


(a, a) ∈ R for every element a ∈ A.
(1, 1), (2, 2), (3, 3), and (4, 4) must contain
all of the pairs
A relation R on a set A is called symmetric if(b, a) ∈ R when
ever(a, b) ∈ R, for all a, b ∈ A. A relation R on a set A such
that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b
is called antisymmetric.
Symmetric contains (2, 1) and (1, 2)
Anit Symmetirc For each of these relations there is no pair of
elements a and b with a = b such that both (a, b) and (b, a)
belong to the relation.
A relation R on a set A is called transitive if whenever (a, b)
∈ R and (b, c) ∈ R, then (a, c) ∈ R, for all a, b, c ∈ A.
Transitive (3, 2) and (2, 1), (4, 2) and (2, 1), (4, 3) and (3, 1),
and (4, 3) and (3, 2) are the only such sets of pairs, and (3, 1
), (4, 1), and (4, 2) belong to R4.
Relations Properties
Relations Properties
Combining Relations
• Because relations from A to B are subsets of A × B, two relations from A to B can
be combined in any way two sets can be combined.

Let A = {1, 2, 3} and B = {1, 2, 3, 4}.


The relations R1 = {(1, 1), (2, 2), (3, 3)} and
R2 = {(1, 1), (1, 2), (1, 3), (1, 4)}
can be combined to obtain
• R1 ∪ R2 = {(1, 1), (1, 2), (1, 3), (1, 4),
• (2, 2), (3, 3)}
• R1 ∩ R2 = {(1, 1)},
• R1 − R2 = {(2, 2), (3, 3)}, • Symmetric difference
• R2 − R1 = {(1, 2), (1, 3), (1, 4)}. • R1 ⊕ R2 =) (R1 ∪ R2).-(R1 ∩ R2.)
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 ordered pairs (a, c), where a ∈ A, c ∈ C, and for which there exists an element b
∈ B such that (a, b) ∈ R and (b, c) ∈ S. We denote the composite of R and S by S ◦R.
Powers of a relation R

• Let R be a relation on the set A.


• The powers Rn, n = 1, 2, 3,..., are defined recursively by
R1 = R and Rn+1 = Rn ◦ R.
2 3 2
The definition shows that R = R ◦ R, R = R ◦ R = (R ◦ R)◦ R, and so on

Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. Find the powers Rn, n = 2, 3, 4,

◦R, we find that R2 = {(1, 1), (2, 1), (3, 1), (4, 2)}. Furthermore, because R3 = R2 ◦R, R
3 = {(1, 1), (2, 1), (3, 1), (4, 1)}. Additional computation shows that R4 is the same as
R3, so R4 = {(1, 1), (2, 1), (3, 1), (4, 1)}. It also follows that Rn = R3 for n = 5, 6, 7,.......

The relation R on a set A is transitive if a


nd only if Rn ⊆ R for n = 1, 2, 3,....
n-ary Relation
Let A1, A2,...,An be sets. An n-ary relation on these sets is a subset of
A1 × A2 ×···× An. The sets A1, A2,...,An are called the domains of the
relation, and n is called its degree.
• Relationships among elements from more than two sets are called n-ary relation

Let R be the relation on N × N × N consisting of triples


(a, b, c), where a, b, and c are integers with a<b
Directed Graphs (diagraphs)
Directed Graphs (diagraphs)
Example 3 (solution)
Explanation Example 3….
Relations as Matrices
Relation as Matrix
Relation as Matrix
Relation as Matrix n-array
Equivalence Relation
 Definition 1: A relation 𝑅 on set 𝐴 is an equivalence relation if it is
reflexive, symmetric, and transitive.
 Example: Suppose 𝐴 = −1,1,2,3,4
 Equivalence relations can be:
equivalence relation

• An equivalence relation on a set is a typ


e of relationship that groups elements to
gether in a way that they are considered
"equivalent" in some sense. For a relation
to be considered an equivalence relation,
it must satisfy three main properties: refl
exivity, symmetry, and transitivity.
• Let's go over each property in simple ter
ms, with an example.
Equivalence Relation
Application

They are also an important data structure


in computer science.

Sequence can be used to represent solutions


to certain counting problems

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy