Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter8 Relations 8.1: Relations and their properties.

Similar presentations


Presentation on theme: "Chapter8 Relations 8.1: Relations and their properties."— Presentation transcript:

1 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.

2 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}

3 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)

4 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.

5 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.

6 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)}

7 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)}

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

9 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.

10 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)

11 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:

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

13 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).

14 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.

15 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.

16 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

17 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?

18 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*

19 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

20 Solution: from theorem 3,

21 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

22 Answer: Reflexive closure symmetric closure

23 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.

24 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.

25 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.

26 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


Download ppt "Chapter8 Relations 8.1: Relations and their properties."

Similar presentations


Ads by Google