Chapter 5 Relations and Operations

Slides:



Advertisements
Similar presentations
Partial Orderings Section 8.6.
Advertisements

Relations Relations on a Set. Properties of Relations.
CSE115/ENGR160 Discrete Mathematics 04/26/12 Ming-Hsuan Yang UC Merced 1.
Representing Relations Using Matrices
Chapter 7 Relations : the second time around
1 Relations: The Second Time Around Chapter 7 Equivalence Classes.
Theory and Applications
Discrete Mathematics Lecture#11.
Section 7.6: Partial Orderings Def: A relation R on a set S is called a partial ordering (or partial order) if it is reflexive, antisymmetric, and transitive.
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Partially Ordered Sets (POSets)
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Chapter 6. Order Relations and Structure
Applied Discrete Mathematics Week 10: Equivalence Relations
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
2.6 Equivalence Relation §1.Equivalence relation §Definition 2.18: A relation R on a set A is called an equivalence relation if it is reflexive, symmetric,
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Relations and their Properties
Sets, Relations, and Lattices
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
DISCRETE COMPUTATIONAL STRUCTURES
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Problem Statement How do we represent relationship between two related elements ?
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Chapter8 Relations 8.1: Relations and their properties.
Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation is a relation on.
Representing Relations Using Digraphs
Discrete Mathematical
Relations and Their Properties
Citra Noviyasari, S.Si, MT
Relations.
CSE 2813 Discrete Structures
Unit-III Algebraic Structures
Partial Orderings CSE 2813 Discrete Structures.
Partial Orders (POSETs)
CSE15 Discrete Mathematics 05/03/17
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Learn about relations and their basic properties
Equivalence Relations
Relations Chapter 9.
Partial Orderings.
Relations and Digraphs
RELATION KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS )
Dr. Ameria Eldosoky Discrete mathematics
CS201: Data Structures and Discrete Mathematics I
Applied Discrete Mathematics Week 10: Equivalence Relations
CS2210 Discrete Structures Relations
Discrete Math (2) Haiming Chen Associate Professor, PhD
Applied Discrete Mathematics Week 6: Relations/Digraphs
MCS680: Foundations Of Computer Science
Relations.
Combining relations via relational composition
교환 학생 프로그램 내년 1월 중순부터 6월 초 현재 학부 2,3 학년?
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Relations: The Second Time Around
Foundations of Discrete Mathematics
Presentation transcript:

Chapter 5 Relations and Operations Discrete Mathematics: A Concept-based Approach

Concept of Relations The concept and theory of relations is introduced by Augustus De Morgan. We deal with relational operators, namely, ≤ , < , > ,  , ≠ , and = are commonly used defining the relations. In the design of database management systems, a popular data model is relational model and the software packages built around are called relational database management systems (RDBMS). Relational methods can be found at various places in computer science, namely, relational semantics of concurrency, analysis of rewriting systems, and modern programming language design, algorithms analysis and the course on discrete mathematics taught to computer scientists. In set theory, the concept subset represents the relationship between the two sets. Discrete Mathematics: A Concept-based Approach

Cartesian product Let A and B be two sets. The ordered pairs of the type (a, b) are obtained in the new set by taking Cartesian product of the given two sets. A x B = { (a, b) | a  A and b  B} Example . Consider A = { 1, 2, 3} and B = { x , y}. Obtain the Cartesian product set A x B. A x B = { (1, x), (1, y), (2, x), (2, y), (3, x), (3,y) }. Discrete Mathematics: A Concept-based Approach

Identity Relation It is also called Equality relation, wherein every element of the set is related to itself. If A is the set, then the identity relation IA is given as under: IA = { (a, a) | for all a  A } Given a set A = { 1,2,3} the relation IA is {(1,1), (2,2), (3,3)}. Discrete Mathematics: A Concept-based Approach

Void Relation Given a set A and its cross product AxA, we know that both empty relation (Ø) and universal relation AxA both are the subsets of AxA. The empty relation is also called void relation . Consider a computer program having input set A and output set B. Let A and B be related by the relation R if and only if b  B is the output for a  A is the input. This relation gives all possible outputs for all possible inputs to the program, which depicts the universal relation. Also, when there is no input, there is no output, which depicts the void relation. Discrete Mathematics: A Concept-based Approach

Inverse Relation Let R be a relation from set A to set B, R: A B. The inverse relation of R is denoted as and represents the relation B to A. It is defined as under. = { (b, a )| (a, b)  R} This is equivalent to saying that ( a R b ) if and only if (b R -1 a ). It is also equivalent to saying that (a, b)  R  (b, a)  R -1. The domain of R is identical to the range of R -1 and vice versa. Consider a set A = { 1,2,3} and the relation R = {(1,2), (2,3), (3,3)}. The relation = {(2,1), (3,2), (3,3)}. Discrete Mathematics: A Concept-based Approach

Properties of Binary Relations In computer science, most often we deal with relations on a given set rather than the relation across two sets. These relations satisfy certain properties. The properties include Reflexivity, Irreflexivity, Symmetry, Anti-symmetry and Transitivity. Reflexivity and Irreflexivity The relation R on a set A is said to be reflexive if a is related to a (a R a) for all a  A. Similarly, the relation R on a set A is said to be irreflexive if a is not related to a (a R a) for all a  A. Discrete Mathematics: A Concept-based Approach

Symmetry, not symmetric and asymmetry A relation R on a set A is said to be symmetric, whenever a R b then b R a. The relation R is said to be not symmetric whenever we have some a and b belonging to A and (aRb) but b is not related to a, i.e., (bRa) is not true. The relation R is said to be asymmetric, whenever aRb for all a,b  A, b is not related to a. These are defined as under. (a, b)  R  (b, a )  R for a, b  A, the relation is symmetric (a, b)  R and (b, a ) R for a, b  A, the relation is not symmetric (a, b)  R  (b, a )  R for a, b  A, the relation is asymmetric Discrete Mathematics: A Concept-based Approach

A relation R is said to be transitive, if (aRb) and (bRc ) implies that (aRc). In other words, the relation is said to be not transitive if (aRb) and (bRc ) but (aRc). Example : Consider the sets A, B and C and the relation subset defined over an universal set. If A  B and B  C then A  C. Therefore, the relation  is transitive. Example : Consider the relation parallel defined over a set of lines. If line A is parallel to line B and line B is parallel to C then the line A is parallel to C. Therefore, the relation parallel is transitive. The same is not true for the relation perpendicular. Discrete Mathematics: A Concept-based Approach

Equivalence Relation and Partitions A given relation is said to be an Equivalence relation when it is reflexive, symmetric and transitive. Example : Consider the set of triangles in a plane. The relation similarity of triangles is an equivalence relation. Let A,B and C represent the triangles in a plane. From the property of similarity triangles, we can ascertain the following: A, B and C are similar to them selves. Reflexive property If triangle A is similar to triangle B then triangle B is similar to triangle A. symmetric property. If triangle A is similar to triangle B and triangle B is similar to triangle C then triangle A is similar to triangle C. Transitive property. Discrete Mathematics: A Concept-based Approach

Partitions Given a set (A) and an equivalence relation (R ), we define a partition (P ) on A induced by the equivalence relation R and vice versa. Let P1 = { {a}, {b}, {c}} and the set A = {a, b, c}. The equivalence relation induced by P1 is { (a, a), (b, b ), (c, c) }. In a Broad sense we define the partition of a set A is a set of all subsets of A denoted by {A1, A2, A3 … An} such that their union is A and the intersection of Ai and Aj is empty for any distinct Ai and Aj. The partition of a set A is division of A into disjoint subsets Discrete Mathematics: A Concept-based Approach

Some Operations on Relations: As binary relations are sets of ordered pairs, all set operations can be done on relations. The resulting sets are ordered pairs and hence are relations. Let R and S denote two relations. i) The intersection of R and S denoted by , is defined by . ii) The union of R and S denoted by , is defined by iii) The difference of R and S, denoted by R – S , is defined by a(R - S)b. iv) The complement of R, denoted by , is defined by .   Discrete Mathematics: A Concept-based Approach

Example: Let A={x,y,z}, B={1,2,3}, C={x,y} and D={2,3} Let R be the relation from A to b defined by R={(x,1),(x,2),(y,3)} and S be a relation from C to D defined by S={(x,2),(y,3)}, then Discrete Mathematics: A Concept-based Approach

Composition of Relations If R is a relation from set A to set B and S is a relation From set B to set C, viz R is subset of A x B and S is a subset of B x C then the composition of R and S is defined by R • S is defined by a(R • S)c , if for some b Є B, we have aRb and bRc. Example: Let R={(1,1),(1,3),(3,2),(3,4),(4,2)} and S={(2,1),(3,3),(3,4),(4,1)}. Then R •S = {(1,3),(1,4),(3,1),(4,1)}, S•R = {(2,1),(2,3),(3,2),(3,4), R • R = {(1,1),(1,3),(1,2),1,4),(3,2)}, S •S = {(3,3),(3,4),(3,1)} (R •S) •R = {(1,2),(1,4),(3,1),(3,3),(4,1),(4,3)} R •(S •R) = {(1,2),(1,4),(3,1),(3,3),(4,1),(4,3)} R •R •R=(R • R) • R=R •(R • R)= {(1,1),(1,3),(1,2),(1,4)} = Discrete Mathematics: A Concept-based Approach

Matrix representation of relations The relations are also represented alternately by zero-one matrices. Let R be the given relation on a set A. Let MR denote its matrix representation. The entry MR[i, j] is 1 if the tuple (i, j ) is in R, otherwise the entry is 0. Thus, MR is zero-one matrix. Example: Let R= {(a, a), (a, b), (b, d), (c, c), (c, d)}, given in Example. Its matrix representation is given as under. Discrete Mathematics: A Concept-based Approach

The composition of two relation matrices S and R are as M(R)= The composition of two relation matrices S and R are as follows. S={(1,1),(2,2),(2,3),(3,1)(3,3)} and R={(1,1),(1,3),(2,1),(2,2),(2,3),(3,2)} The other operations complement, union, intersection can also be performed. Discrete Mathematics: A Concept-based Approach

Graphical representation of Relations In graphical representation of relations, the elements of the set are denoted by the nodes and the relation between the nodes by the directed edges. It is a diagraph or directed graph. Consider the relation R={ (1, 1), (1, 3), (2, 1), (2,2), (2, 3), (3, 2)}. The element 1R1 is shown by self loop at the node 1. Similarly, we have self loop at node 2 that corresponds to the edge (2, 2). The directed edge from 2 to 1 refers to the edge (2, 1). Similarly, the directed edge from 3 to 2 refers to the edge (3, 2). Discrete Mathematics: A Concept-based Approach

The graphical representation is given as The graphical representation of symmetric relation R = { (3, 1), (1, 2), (2, 1), (2, 3), (3, 2), (1, 3), } defined on the set A = {1, 2, 3} is given below. Discrete Mathematics: A Concept-based Approach

The graphical representation of transitive relation (3, 3)} defined on the set A = {1, 2, 3} is given below. The graphical representation of R1 R2 = { (1, 1), (2, 2), (1, 3), (3, 1), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 3), (3, 4)} is given in the following Figure.   Discrete Mathematics: A Concept-based Approach

Partially Ordered Set (POSET) A relation R on a given set A is said to be a partially ordered, if it is reflexive, antisymmetric and transitive. The set along with the partial order relation R is called partially ordered set, also abbreviated as POSET. It is denoted by (A, R ). Consider the following examples of POSETs. Example . The relation subset and the set of all subsets of a given set A, called power set, is a POSET. It is denoted by ( P(A),  ). Example : Consider the set of positive integers Z+. The relation ≤ together with Z+ is a POSET. Discrete Mathematics: A Concept-based Approach

Graphical Representation of POSET The graphical representation of POSET is called Hasse diagram. In Hasse diagrams, we do not show reflexivity and transitivity explicitly. The transitivity is eliminated by showing the related three elements a,b and c, such that a ≤ b ≤ c are represented showing a at a level lower than b and b lower than c. The elements that are not related are not connected. Discrete Mathematics: A Concept-based Approach

Consider the set A = {1, 2, 3, 4, 12} and the relation as divisibility on A. This means that a ≤ b if and only if a | b, for a, b  A. The POSET is (A, ≤ ) and the Hasse diagram is shown below. Discrete Mathematics: A Concept-based Approach

Maximal and Minimal elements An element a  A is called the maximal element of A if there is no element c in A such that (a < c ). Similarly, an element bA is called minimal element of A if there is no element c in A such that (c < b ). Example : Consider the set R of nonnegative real numbers with the partial order ≤. It is POSET. The set R has 0 as the minimal element. The set does not have maximal element, as the set is infinite. Example : Consider the usual set of integers Z and the partial order ≤ . It is a POSET. The set Z has neither minimal element nor maximal elements. The set Z is bounded in between . Discrete Mathematics: A Concept-based Approach

Example Consider the POSET A whose Hasse diagram is shown Example Consider the POSET A whose Hasse diagram is shown.The elements a1, a2, a3 are the maximal elements of A. The elements b1, b2, b3 are called minimal elements of A. The elements b1 and b2, b1 and b3 and b2 and b3 are incomparable, as there is no line between these elements. Discrete Mathematics: A Concept-based Approach

(a v b) represents the LCM of the two elements a and b. Similarly, Lattice: A lattice is a partial order set ( L, ≤ ) wherein every pair of elements in the set has unique least upper bound and greatest lower bound. Consider a pair {a, b} of the POSET. We shall denote LUB ({a, b}) by ( a v b) and is also called the join of a and b. Similarly, the GLB({a, b}) is denoted by (a ^ b) and is also called the meet of a and b. Lattice is a mathematical structure and often appears in computing. Any chain is a lattice. Example: Consider the set S and its power set P(S). The POSET under the operation  is (P(S),  ), which is a lattice. Let the sets A and B belong to P(S). The (A v B) represents the union of the two sets. Similarly, (A ^ B) represents intersection of the two sets. Example: Consider the set Z+. The POSET under the operation ≤ is (Z+, ≤), which is a lattice. Let the elements a and b belong to Z+. The (a v b) represents the LCM of the two elements a and b. Similarly, (a ^ b) represents GCD of the two elements a and b. Discrete Mathematics: A Concept-based Approach

Summary A relation can be thought of as a structure that is used to solve problems such as producing a useful way to store information in computer databases. Partitions of a given set and the equivalence relation defined over the set are alternate representations. Digraphs and matrices are alternate representations for relations. Partial ordered relations are different from totally ordered relations. Hasse diagrams are pictorial representations for POSETS. Lattices and different types of lattices are useful concepts. Discrete Mathematics: A Concept-based Approach