relation slides
relation slides
Relation
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
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}:
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,.......