Chapter8 Relations 8.1: Relations and their properties.

Slides:



Advertisements
Similar presentations
Relations Relations on a Set. Properties of Relations.
Advertisements

CSE115/ENGR160 Discrete Mathematics 04/26/12 Ming-Hsuan Yang UC Merced 1.
8.3 Representing Relations Connection Matrices Let R be a relation from A = {a 1, a 2,..., a m } to B = {b 1, b 2,..., b n }. Definition: A n m  n connection.
Chapter 3 Relations. Section 3.1 Relations and Digraphs.
Chap6 Relations Def 1: Let A and B be sets. A binary relation from A
Representing Relations Using Matrices
5/16/20151 You Never Escape Your… Relations. 5/16/20152Relations If we want to describe a relationship between elements of two sets A and B, we can use.
Discrete Mathematics Lecture # 16 Inverse of Relations.
8.4 Closures of Relations. Intro Consider the following example (telephone line, bus route,…) abc d Is R, defined above on the set A={a, b, c, d}, transitive?
Discrete Mathematics Lecture#11.
1 Section 7.1 Relations and their properties. 2 Binary relation A binary relation is a set of ordered pairs that expresses a relationship between elements.
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Applied Discrete Mathematics Week 10: Equivalence Relations
Exam 2 Review 8.2, 8.5, 8.6, Thm. 1 for 2 roots, Thm. 2 for 1 root Theorem 1: Let c 1, c 2 be elements of the real numbers. Suppose r 2 -c 1.
Exam 2 Review 7.5, 7.6, |A1  A2  A3| =∑|Ai| - ∑|Ai ∩ Aj| + |A1∩ A2 ∩ A3| |A1  A2  A3  A4| =∑|Ai| - ∑|Ai ∩ Aj| + ∑ |Ai∩ Aj ∩ Ak| - |A1∩
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.
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 Structures1 You Never Escape Your… Relations.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Rosen, Section 8.5 Equivalence Relations
Relations and their Properties
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
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.
Discrete Structures – CNS2300
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.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
Chapter Relations and Their Properties
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.
8.4 Closures of Relations Definition: The closure of a relation R with respect to property P is the relation obtained by adding the minimum number of.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
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.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Representing Relations Using Digraphs
Discrete Mathematical
Relations and Their Properties
Citra Noviyasari, S.Si, MT
Chapter 5 Relations and Operations
Relations.
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 
Equivalence Relations
Relations Chapter 9.
Lecture # 14 Types of Relations
Representing Relations
Dr. Ameria Eldosoky Discrete mathematics
CSE115/ENGR160 Discrete Mathematics 04/28/11
CS 173: Discrete Mathematical Structures
CSNB 143 Discrete Mathematical Structures
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 9 Relations Slides are adopted from.
Chapter 2 Sets Homework 3 Given U = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } as a set universe and the sets : A = { 1, 2, 3, 4, 5 }, B = { 4, 5, 6, 7 }, C = { 5,
Applied Discrete Mathematics Week 10: Equivalence Relations
8.5 Equivalence Relations
Relations and Their Properties
8.1 Relations and Their Properties
Relations.
Relations and Digraphs
9.5 Equivalence Relations
Relations.
Chapter 8 (Part 2): Relations
Agenda Lecture Content: Relations (Relasi)
Representing Relations Using Matrices
Lecture # 16 Inverse of Relations
Relations 12/7/2019.
Presentation transcript:

Chapter8 Relations 8.1: Relations and their properties. Definition1: Let A and B be sets. A binary relation from A to B is a subset of AXB. Example: let A={0,1,2} and B={a,b}. Then {(0,a),(0,b),(1,a),(2,b)} is a relation from A to B Definition2: A relation on the set A is a relation from A to A. That is a relation on a set A is a subset of AXA Example: let A be the set {1,2,3,4}. Which ordered pairs are in the relation R={(a,b)| a divides b} Solution: 1|1, 2|2, 3|3, 4|4 1|2, 1|3, 1|4, 2|4 So R={(1,1),(1,2),(1,3),(1,4),(2,2),(3,3),(4,4),(2,4)} ______________________________________________________________________ Example5: consider these relations on the set of integers.

Example: Which of these relations contain each of the pairs (1,1), (1,2), (2,1), (1,-1) and (2,2)? Solution: Remark: 1) The number of relations on a set with n elements is Properties of relations: Definition3: A relation R on a set A is called reflexive if (a,a) € R for every element a € R. Remark: The relation R on a set A is reflexive if a ((a,a)€R) where the domain is the set of all elements in A. Example7: Which of these relation is reflexive where the set is {1,2,3,4}

Solution: The relations which are reflexive are because both of them contain (1,1), (2,2), (3,3) and (4,4). ______________________________________________________________________ Do example8 page522 Example9: Is the “divide” relation on the set of positive integers reflexive? Solution: yes it is reflexive because a|a for every positive integer a. Remark: is the divide relation on the set of integer reflexive Solution: no because 0 which 0 doesn’t divide 0 (i.e 0X0)

Definition4: A relation R on a set A is called symmetric if (b,a) €R, whenever (a,b)€R, for all a,b€A Remark: 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 anti symmetric Example10: which of the relation from example5 are symmetric and which are anti symmetric. Solution: The relations which are symmetric: The relations which are anti symmetric: Example12: Is the “divide” relation on the set of positive integers symmetric? Is it anti symmetric? Solution: “divide” relation is not symm. Because 1|2 but 2X1 “Divide” relation is anti symmetric because if a|b and b|a then a=b Definition5: A relation R on set A is called transitive if when ever (a,b)€R and (b,c)€R, then (a,c)€R for all a,b,c€A. Example13: Which of the relations in example 7 is transitive? Solution: The relations which are transitive: Example14: Which of the relation in ex5 are transitive Solution: The relations: are transitive.

Example15: Is “divide” relation on the set of positive integer transitive? Solution: Remark: 1- Read Ex.16 page 525 2- The number of reflexive relation on a set of n elements is reflexive relation. Combining relations: Ex17: let A={1,2,3} and B={1,2,3,4} The relations ={(1,1), (2,2), (3,3)} and ={(1,1), (1,2), (1,3), (1,4)} can be combined to obtain.

Example19: Set: set of all real numbers. What are Solution: Definition6: let R: A→B and S: B→C The composite of R and S denoted by so R is the relation consisting of ordered pairs (a,c) where a€A, c€C and for which an element b€B such that (a,b)€R and (b,c)€S Example: R:{1,2,3}→{1,2,3,4} With R={(1,1),(1,4),(2,3),(3,1),(3,4)} S:{1,2,3,4}→{0,1,2} with S={(1,0),(2,0),(3,1),(3,2),(4,1)} So R= {(1,0),(1,1),(2,1),(2,2),(3,0),(3,1)}

Remark: let R be a relation on the set A. The powers Example22: let R={(1,1),(2,1),(3,2),(4,3)} Find the powers .n = 2,3,4 Solution: R={(1,1),(2,1),(3,2),(4,3)} R={(1,1),(2,1),(3,2),(4,3)}

Theorem1: the relation R on a set A is transitive if and only if for n = 1,2,3……

Section8.3: Representing Relations Ways to represent a relation: To list its ordered pairs (section8.1) using tables to represent relation (section8.1) Using 0-1 number and matrices (section8.2) Using pictorial representation (section8.2) Representing relations using matrices Suppose that The relation R can be represented by the matrix Example: suppose A={1,2,3} and B={1,2} Let R: A→B such that (a,b)€R if a€R if a€A, b€B and a>b. What is the matrix representing R.

Solution: R={(2,1), (3,1),(3,2)} The matrix Example2: Which ordered pairs are in the relation R represented by the matrix: Solution: Remark: 1) The relation R is reflexive if all the elements on the main diagonal of Are equal to 1 (note that is a square matrix)

2) The relation R is symmetric if and only if for all pairs of integers I ang j with I = 1,2,…..,n and j = 1,2,…….n Note that R is symmetric iff 3) The relation R is anti symmetric if and only if (a,b)€R and (b,a)€R → a=b. The matrix of anti symmetric relation has the property that if Example: suppose that the relation R on a set is represented by the matrix Is R reflexive, symm, and or anti symm. Solution: 1) R is reflexive since the entries on the main diagonal are equal to one. 2) R is symm. Since is symm 3) R is not anti symm. Remark:

Example4 page539: Suppose that the relation on a set A are represented by the matrices What are the matrices representing and Solution:

Representing Relations Using Digraphs (directed graph) There is another way of representing a relation using a pictorial representation. Each element of the set is represented by a point and each ordered pair is represented using an arc with its direction indicated by an arrow. Definition1: A directed graph on diagram, consists of a set V of vertices (or nodes) together with a set E of ordered pairs of elements of V called edges (or arcs). The vertex a is called the initial vertex of the edge (a,b), and the vertex b is called the terminal vertex of this edge Example: List the vertices and the edges. Answer: Vertices are a,b,c, and d Edges are (a,b), (b,b), (c,b), (a,d), (b,d), (d,b), and (c,a).

Example8: Draw a diagraph of the relation R={(1,1),(1,3),(2,1),(2,3),(2,4),(3,1),(3,2),(4,1)} on the set {1,2,3,4} Solution: Example9: What are the ordered pairs in the relation R represented by the following directed graph.

Solution: R={(1,3),(1,4),(2,1),(2,3),(3,1),(3,3),(4,1),(4,3)} Example10: Determine whether the relation for the following directed graph are reflexive, symmetric , anti symmetric, and or transitive. Solution: 1) because there are loops at every vertex R is reflexive. (a,a), (b,b), (c,c) R is not symmetric since there are (a,b) but not (b,a). R is not anti symmetric R is not transitive because (a,b), and (b,c) belongs to S, but (a,c) doesn’t belong.

Section8.4: Closures of Relations Let R be a relation on a set A. R may or may not have same property p, such as reflexity symmetry or transitivity. If there is a relation S with property p containing R such that S is a subset of every relation with property p containing R, then S is called the closet closure of R with respect to p. Closure. 1- Reflexive closure: Given a relation R on a set A, the reflexive closure of R can be found by adding to R all pairs of the form (a,a) with a€R, not already in R. The addition of these pairs produces a new relation that is reflexive, contains R, and is contained within any reflexive relation containing R. The reflexive closure of R equals RUΔ where Δ={(a,a): a€A} is the diagonal relation on A. Example1: What is the reflexive closure of the relation R={(a,b):a<b} on the set of integers? Solution: RUΔ={ (a,b): a<b} U { (a,a): a€Z} = { (a,b): a≤b}. Remark: If the relation R is not symmetric; How we can produce a symmetric relation that is as small as possible and contains R? by adding all ordered pairs of the form (b,a), where (a,b)€R and (b,a) not in R. Definition: A symmetric relation that is as small as possible and contains R is called the symmetric closure of R. Remark: Sym closure can be formed by taking the union of R with its inverse

Example2: What is the symmetric closure of the relation {(a,b)|a>b} on the set of positive integers? Solution: the symmetric closure of R is Remark: how can we produce a transitive relation that contains R such that this new relation is contained with in any transitive relation that contains R? Paths in directed graphs. Representing relations by directed graphs helps in the construction of transitive closure. A path in a directed graph is obtained by traversing along edges (In the same direction as indicated by the arrow on the edge) Definition: A path from a to b in the directed graph G is a sequence of edges in G, where n is a nonnegative integer and is a path of length n. Example: which of the following are paths in the directed graph shown in the right 1- a,b,e,d 2- a,e,c,d,b 3- b,a,c,b,a,a,b 4- d,c 5- c,b,a 6- e,b,a,b,a,b,e?

Solution: 1) a→b→e→d yes Solution: 1) a→b→e→d yes. Because each of (a,b), (b,e), (e,d) is an edges a,b,e,d is a path of length 3. 2) a→e→c→d (c,d) is not an edge so a,e,c,d is not path. 3) b→a→c→b→a→a→b is a path because (b,a),(a,c),(c,b),(b,a),(a,a), and (a,b) are all edges so b,a,c,b,a,a,b is path of length 6. 4) d→c is a path because (d,c) is an edge so d,c is a path of length 1. 5) c→b→a yes path ( (c,b),(b,a)) of length 2. 6) e→b→a→b→a→b→e is a path of length 6. Theorem1: let R be a relation on a set A. There is a path of length n, where n is a positive integer, from a to b if and only if (a,b)€ Transitive closures: Definition2: let R be a relation on a set A. The connectivity relation R* consists of the pairs (a,b) such that there is a path of length at least one from a to b in R. Remark: Because consists of the pairs (a,b) such that there is a path of length n from a to b, it follows that R* is the union of all sets so Read example4 Example5: let R be the relation on the set of all subway stops in New York City that contains (a,b) if it is possible to travel from stop a to stop b with out changing trains. What is when n is a positive integer? What R*

Solution: The relation contains (a,b) if it is possible to travel from stop a to stop b by making n-1 changes of trains. The relation R* consists of the ordered pairs (a,b) where it is possible to travel from stop a to stop b making as many changes of train as necessary. Example8: let R be the relation on the set of all states in the United States that contains (a,b) if state a and state b have a common border. What is , where n is a positive integer? What is R*? Solution: consists of the pairs (a,b), where it is possible to go from state a to state b by crossing exactly n state borders. R* consists of the ordered pairs (a,b), where it is possible to go from state a to state b crossing as many borders as necessary. Theorem2: The transitive closure of a relation R equals the connectivity relation R*. Theorem3: let be the zero – one matrix of the relation R on a set with n elements. Then the zero – one matrix of the transitive closure R* is Example: Find the zero-one matrix of the relation R where

Solution: from theorem 3,

Practice: 1) let R be the relation on the set {0,1,2,3} containing the pairs (0,1),(1,1),(1,2),(2,0),(2,2) and (3,0). Find the Reflexive closure of R Symmetric closure of R Answer: a) reflexive closure of R={(0,0),(0,1),(1,1),(1,2),(2,0),(2,2),(3,0),(3,3)} b) Symmetric closure of R={(0,1),(0,2),(0,3),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2),(3,0)} ______________________________________________________________________ 2) Let R be the relation {(a,b)| a divides b} on the set of integers. What is the symmetric closure of R? Solution: Symm. Closure of R={(a,b)| a divides b or b divides A} 3) Draw the directed graph of the reflexive closure and the symm. Closure of the relation with the directed graph shown

Answer: Reflexive closure symmetric closure

Equivalence Relations Section 8.5 Equivalence Relations Definition: A relation on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive Definition2: Two elements a and b are related by an equivalence relation are called equivalent. The notation a~b is often used to denote that a and b are equivalent elements with respect to a particular equivalence relation. Example: let R be the relation on the set of real numbers such that aRb if and only if a-b is an integer. Is R an equivalence relation? Solution: Reflexive: because a-a = 0 is an integer for all real numbers a, aRa for all real numbers a. Hence R is reflexive. Symmetric: suppose aRb. Then a-b is an integer → b-a is an integer. Hence bRa so R is symmetric Transitive: suppose aRb and bRc → a-b is an integer and b-c is an integer a-c=(a-b)+(b-c) is an integer. Hence aRc so R is transitive Hence R is equivalence relation. Example: let m be a positive integer with m>1. show that the relation R={(a,b)|a b(modm} is an equivalence relation on the set of integers Solution: reflexive: since a-a=0 is divisible by m, because 0=0.m. Hence a a(modm) so congruence modulo m is reflexive.

Symmetric: suppose Transitive: suppose Hence the relation is transitive. Therefore R is equivalence relation. Read example 4 and 5 page 557 Example6: show that “divides” relation on the set of positive integers is not an equivalence relation. Solution: reflexive: since a|a for all positive integers →aRa Symmetric: since 2|4 but 4X2 so R is not symmetric so R is not an equivalence relation.

Example7: let R be the relation on the set of real numbers such that x Ry if and only if x and y are real numbers that differ by less than 1. That is |x-y|<1. Show that R is not an equivalence relation. Solution: reflexive since |x-x|=0<1 where ever x€R Ris reflexive. Symmetric: suppose xRy→|x-y|<1 but |x-y|=|y-x|<1→yRx so R is symmetric. Suppose xRy and yRz So R is not transitive. Equivalence classes: Definition: let R be an equivalence relation on a set A. The set of all elements that are related to an element a of A is called the equivalence class of a (denoted by ). Remark: in other words, if R is an equivalence relation on a set A, the equivalence class of the element a is If , then b is called a representative of this equivalence class. Do example8.

Example9: what are the equivalence classes of 0 and 1 for congruence modulo 4? Solution: The equivalence class of 0 contains all integers a such that (mod 4). The integers in this class are divisible by 4. so The equivalence class of 1 contains all integers a such that (mod 4) The integers in this class are those that have a remainder 1 when divided by 4. So Remark: The congruence classes of an integer a modulo m is denoted by Refer to example9. find