170 likes | 311 Views
Chapter 8.1 Relations. Fall 2014 COMP 2300 Discrete Structures for Computation. Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University. Let A and B be sets. A relation R from A to B is a subset .
E N D
Chapter 8.1 Relations Fall 2014COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and PhysicsNorth Carolina Central University
Let A and B be sets. A relation R from A to B is a subset . • Given an ordered pair , x is related to y by R, written if and only if . The set A is called the domain of R and the set B is called its co-domain. • Ex. Relation (from Chap 1.3)
Define a relation L from R to R as follows: For all real numbers x and y, • Is • Is • Is • Is Less-than Relation for Real Numbers
Define a relation L from R to R as follows: For all real numbers x and y, • Is No, since 57 > 53. • Is Yes, since -17 < -14. • Is No, since 143 = 143. • Is Yes, since -35 < 1. Less-than Relation for Real Numbers
Define a relation L from R to R as follows: For all real numbers x and y, • Draw the graph of L as a subset of the Cartesian plane Less-than Relation for Real Numbers
Define a relation L from R to R as follows: For all real numbers x and y, • Draw the graph of L as a subset of the Cartesian plane A: For each value of x, all the points (x, y) with y>x are on the graph. So the graph consists of all the points above the line x = y. Less-than Relation for Real Numbers
Let X={a, b, c}. Then, Define a relation S from P(X)to Z as follows: For all sets A and B in P(X) (i.e., for all subsets A and B of X), • Is • Is • Is • Is A Relation on a Power Set
Let X={a, b, c}. Then, Define a relation S from P(X)to Z as follows: For all sets A and B in P(X) (i.e., for all subsets A and B of X), • Is Yes, both sets have two elements. • Is Yes, has one element and has zero elements, and • Is No, {b, c} has two elements and {a, b, c} has three elements and 2 < 3. • Is Yes, both sets have one element. A Relation on a Power Set
Let R be a relation from A to B. Define the inverse relation from B to A as follows: • The definition can be written operationally as follows: The Inverse of a Relation
Let A = {2, 3, 4} and B = {2, 6, 8} and let R be the “divides” relation from A to B: For all • State explicitly which ordered pairs are in and , and draw arrow diagrams for and . • Describe in words. The Inverse of a Finite Relation
Let A = {2, 3, 4} and B = {2, 6, 8} and let R be the “divides” relation from A to B: For all • State explicitly which ordered pairs are in and , and draw arrow diagrams for and . 2 2 2 2 2 2 The Inverse of a Finite Relation 3 3 6 6 6 3 4 4 8 8 8 4
Let A = {2, 3, 4} and B = {2, 6, 8} and let R be the “divides” relation from A to B: For all • Describe in words. For all , The Inverse of a Finite Relation
Define a relation R from R to R as follows: For allDraw the graphs of and in the Cartesian plane. Is a function? The Inverse of an Infinite Relation
A relation on a set Ais a relation from A to A. • Let A = {3, 4, 5, 6, 7, 8} and define a relation R on A as follows: For all Directed Graph of Relation
A more formal way to refer to the kind of relation defined in Section 1.3 is to call it a binary relation because it is a subset of a Cartesian product of two sets. • An n-ary relation to be a subset of a Cartesian product of n sets, where n is any integer grater than or equal to two. n-ary Relation
A more formal way to refer to the kind of relation defined in Section 1.3 is to call it a binary relation because it is a subset of a Cartesian product of two sets. • Roughly, an n-ary relation to be a subset of a Cartesian product of n sets, where n is any integer greater than or equal to two. n-ary Relation
Given sets , an n-ary relation R on is a subset of . The special cases of 2-ary, 3-ary, and 4-ary relations are called binary, ternary, and quaternary relations, respectively. • Example: Patient Database at a Hospital • (Patient_ID, Patient_Name, Admission_Date, Diagnosis) • (011985, John Schmidt, 020710, asthema) • (574329, Tak Kurosawa, 0114910, penumonia) n-ary Relations and Relational Databases