Relations Department of Computer Sciences College of Engineering Florida Tech Fall 2011

Relations Department of Computer Sciences College of Engineering Florida Tech Fall 2011

CSE 1400 Applied Discrete Mathematics Relations Department of Computer Sciences College of Engineering Florida Tech Fall 2011 Relations and Their Graphs 1 A Relation’s Domain, Co-domain, and Range 2 A Sampling of Relations 3 Equality 3 Less than 3 Divides 3 Congruence Modulo n 4 Perpendicular on Lines 5 The Incestuous and Empty Relations 5 A Relation is a Set of Ordered Pairs 6 The Inverse Relation 6 Counting Relations 7 Relational Properties 7 Reflexive Property 7 Symmetric Property 8 Antisymmetric Property 10 Transitive Property 11 Orders and Equivalences 11 Orders 12 Well-Ordered Sets 13 Equivalences 13 Equivalence Relations Partition a Set 14 Stirling Numbers of the Second Kind 16 cse 1400 applied discrete mathematics relations 2 Problems on Relations 18 Abstract A relation ∼ describes how things are connected. That a thing a is related to a thing b can be represented by 1. An ordered pair (a, b). • 2. An directed edge a •b . 3. Or more commonly, simply using relational notation a ∼ b. A relation is 1. A set G of ordered pairs. 2. A directed graph G of nodes and edges. 3. A matrix of True and False values. Higher-dimensional relations among a, b, c or more parameters can be defined. Higher-dimensional relations occur as tables in relational databases and as data in multi-variable problems. Relations and Their Graphs A relation is a set of ordered pairs. A relation can be pictured of as a graph G. •g G = f(x, y) : x ∼ yg = f(x, y) : x is related to y.g h• There are many examples of relations. You are, no doubt, familiar d• c• with relations among people: Mother-Daughter, Father-Son, Parent- Child, Aunt-Nephew. Familial relations often become murky. We study relations that can be precisely defined. A few common rela- •e • f tions are equality, congruence mod n, less than, divides, subset, and •a perpendicular. •b This In this course, relationships will be between two things a and b. graph represents the relation Relationships among 3 or more things are common and useful, but G = f(a, b), (b, c), (c, d), (d, h), (h, f ), ( f , e), (e, a)g these ideas are not within the scope of this course. The course studies binary relations. A Relation’s Domain, Co-domain, and Range The things involved in a relation need names:Call them the things x and y. Write x ∼ y to express the phrase “x is related to y.” cse 1400 applied discrete mathematics relations 3 The value x belongs to a set X called the domain of ∼. The value y belongs to a set Y called the co-domain of ∼. The domain X is the set of elements that appear on the left-hand side of ∼. For this course, you can assume that every element in X appears on the left-hand side of ∼, that is, every relation we en- counter is total, defined on all members of X. A relation ∼ is said to be total when The co-domain Y is the set of elements that can appear on the every x 2 X occurs on on the left-hand side of ∼ for some y 2 Y. right-hand side of ∼. A potentially smaller set is the range of ∼. (8x 2 X)(9y 2 Y)(x ∼ y) The range is the set of elements in Y that actually do appear on the right-hand side of ∼. In general, not every element y in Y occurs If there is an x 2 X such that no y 2 Y is related to x, then ∼ is said to be on the right-hand side of ∼. A relation is into its co-domain and partial. onto its range. That is, the co-domain of a relation, is the set of (9x 2 X)(8y 2 Y)(x 6∼ y) values y that could be related to some x. When a relation is onto its An instance of a partial relation on the co-domain every element in Y is related to some element x in X, real numbers is the pairing (x, 1/x), written which is undefined (has a pole) at x = 0. (8y 2 Y)(9x 2 X)(x ∼ y) A relation maps an element x in the domain X onto zero or more elements y in the range A ⊆ Y. A relation maps its domain into its Consider the graph in figure 1 that depicts a relation from vertices co-domain and onto its range. x0, x1, x2, x3 in domain X to vertices y0, y1, y2, y3 in co-domain Y X Y Figure 1:Domain X = fx0, x1, x2, x3g, Co-Domain Y = fy , y , y , y g, x3 y3 0 1 2 3 Range A = fy0, y1, y3g, x2 y2 x1 y1 x0 y0 Here are some things to notice about figure 1. 1. The relation is total: there is at least one directed edge from each vertex in X. 2. The relation is not onto its co-domain. 3. The relation is non-deterministic: A given input x can be related to many outputs y. For instance, in figure 1 x0 is related to y0 and y1. A relation is partial when a given input x cannot be related to any output y. cse 1400 applied discrete mathematics relations 4 X Y Figure 2: A partial relation: The relation is not defined on x . x3 y3 1 x2 y2 x1 y1 x0 y0 A Sampling of Relations You are familiar with many mathematical relations: Equality, less than, multiple of, and so on. These relations are between two things : a and b, and are called binary relations. Multidimensional relations are common in practice. Equality Equality is the most basic relation. 25 −10 72 5 = = = 5 −2 72 5 equal :: Integer -> Integer -> Bool equal a b = (0 == b - a) The name (5, 25/5, . .) can change, the thing remains the same. Figure 3: Haskell for deciding equality on the integers. Less than lessthan :: Integer -> Integer -> Bool Less than establishes an order on the integers. lessthan a b = (0 < b - a) Figure 4: Haskell for deciding less than ··· < −3 < −2 < −1 < 0 < 1 < 2 < 3 ··· on the integers. Divides 7 divides 35. “b divides a” is written b j a A natural number b divides a natural number a when “b does not divide a” is written there is an quotient q 2 N such a = bq. Divides is a rela- tion on N × N. b - a For instance, 15 divides 60 because “a is a multiple of b” is written a ≡ 0 mod b 60 = 15 · 4 “a is not a multiple of b” is written Stated the other way around, 60 is a multiple of 15. On the other a 6≡ 0 mod b hand, 60 is not a multiple of 8; 8 does not divide 60. 60 divided by 8 leaves a remainder of 4. In general, let a and b be natural numbers. Then b divides a, if there is a natural number q such that a = bq. If b divides a, then a is a multiple of b. cse 1400 applied discrete mathematics relations 5 The natural numbers can be partially ordered by the divides rela- 7 tion. The Hesse graph in figure 5 illustrates this ordering for the first 3 6 9 few natural numbers. Given natural numbers a and b, it is straightforward to write code 1 2 4 8 0 to test if a divides b. 5 10 Congruence Modulo n 11 Figure 5: 1 is the smallest natural number with respect to divides; 1 divides every natural number. 0 is the Congruence mod n has applications in many areas, cryp- largest natural number with respect to tology is just one interesting application that can be divides; every natural number divides 0. named. When natural number n divides the difference a − b, the integers a and b are said to be congruent mod n. For instance, the following pairs are congruent mod 2. (15, 9), (26, 30), (−9, 21), (6, −28), (17, −17) divides :: Nat -> Nat -> Bool while the following pairs are congruent mod 3. divides a b = (a ’div’ b == 0) ( ) ( ) (− ) ( − ) ( − ) Figure 6: Haskell for deciding divides 15, 9 , 26, 29 , 8, 19 , 6, 27 , 17, 16 on the natural numbers. n is called the modulus. Congruence collects pairs of integers based on their remainder when divided by n. Mod 2 collects pairs (a, b) that are both even (2s, 2t) or both odd (2s + 1, 2t + 1). Congruence mod 2 partitions the integers into two If both a and b are even, then their equivalence classes: The even integers and the odd integers. difference is divisible by 2. If both a and b are odd, then their difference is Mod 3 collects pairs (a, b) based on remainders upon division by divisible by 2. 3. There are 3 cases. 1. Both a and b are multiples of three: (3s, 3t) 2. Both have a remainder of 1 when divided by three: (3s + 1, 3t + 1) 3. Both have a remainder of 2 when divided by three: (3s + 2, 3t + 2) Congruence mod 3 partitions the integers into three equivalence classes: Integers that are multiples of 3, integers that are multiples of 3 plus 1, and integers that are multiples of 3 plus 2. In general, two integers a and b are congruent mod n if a − b is a multiple of n. Congruence mod n partitions the integers into n equivalence classes. A convenient notation for these sets of integers is [0], [1], [2],..., [n − 1] where syntatic sugar can be added to denote [r] = fnk + r : k 2 Zg the modulus: [r]n.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    21 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us