Presentation is loading. Please wait.

Presentation is loading. Please wait.

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,

Similar presentations


Presentation on theme: "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,"— Presentation transcript:

1

2 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, 6, 7, 8, 9 }, D = { 1, 3, 5, 7, 9 }, E = { 2, 4, 6, 8 }, F = { 1, 5, 9 }. Determine: A  C A  B A  F (C  D)  E (F – C) – A

3 Chapter 2 Sets Solution to 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, 6, 7, 8, 9 }, D = { 1, 3, 5, 7, 9 }, E = { 2, 4, 6, 8 }, F = { 1, 5, 9 }. Determine: A  C = { 1,2,3,4,5,6,7,8,9 } = U A  B = { 4,5 } A  F = { 6,7,8,9 }  { 1,5,9 } = { 9 } (C  D)  E = { 1,3,6,8 }  { 2,4,6,8 } = { 1,2,3,4 } (F – C) – A = { 1 } – { 1,2,3,4,5 } = 

4 Cardinality of the Set Union
Chapter 2 Sets Cardinality of the Set Union For any sets A and B, the following set equation apply: A  B = A + B – A  B A  B = A + B – 2A  B A  B A  B

5 Example 1: Cardinality of the Set Union
Chapter 2 Sets Example 1: Cardinality of the Set Union Example: In a poll among 40 students, it comes out that 32 of them prefer Internet Explorer, 18 students like Mozilla Firefox more, and 2 students do not like either of the browsers. Determine: The number of students who like Internet Explorer or Mozilla Firefox. The number of students who like Internet Explorer or Mozilla Firefox, but not both of them. Solution: Define U = { The number of students participating in the poll} A = { The number of students who like Internet Explorer } B = { The number of students who like Mozilla Firefox } Then U= 40, A= 32, B= 18, A  B= 2

6 Example 1: Cardinality of the Set Union
Chapter 2 Sets Example 1: Cardinality of the Set Union The number of students who like Internet Explorer or Mozilla Firefox. A  B = U – A  B = 40 – 2 = 38 The number of students who like Internet Explorer or Mozilla Firefox, but not both of them. A  B = A + B – A  B = – 38 = 12 A  B = A + B – 2A  B= – 212 = 26 | | | |

7 Cardinality of the Set Union
Chapter 2 Sets Cardinality of the Set Union For any sets A, B, and C the following set equation apply: A  B  C = A + B + C – A  B – A  C – B  C + A  B  C

8 Example 2: Cardinality of the Set Union
Chapter 2 Sets Example 2: Cardinality of the Set Union Example: Among integers between (and including) 101 and 600, how many numbers are not divisible by 4 and not also by 5 or divisible by 4 and 5? Solution: Define U = { The number of integers between (and including) 101 and 600 } A = { Members of U, divisible by 4 } B = { Members of U, divisible by 5 } Then U= 500 A= 500/4 = 125 B= 500/5 = 100 A  B = 500/20 = 25

9 Example 2: Cardinality of the Set Union
Chapter 2 Sets Example 2: Cardinality of the Set Union Then U= 500 A= 500/4 = 125 B= 500/5 = 100 A  B = 500/20 = 25 A  B = A + B – 2A  B = – 225 = 175 A  B = U – A  B = 500 – 175 = 325 |

10 Chapter 3 Relation and Function Relations A relation R from set A to set B is a subset of the Cartesian product A  B. Notation: R  (A  B) a R b is the notation for (a,b)  R, with the meaning “relation R relates a with b.” a R b is the notation for (a,b)  R, with the meaning “relation R does not relate a with b.” Set A is denoted as the domain of R. Set B is denoted as the range of R.

11 Chapter 3 Relation and Function Relations Example: Given A = { Amir, Budi, Cora } B = { Discrete Mathematics (DM), Data Structure and Algorithm (DSA), State Philosophy (SP), English III (E3) } A  B = { (Amir,DM), (Amir, DSA), (Amir,SP), (Amir,E3), (Budi,DM), (Budi, DSA), (Budi,SP), (Budi,E3), (Cora,DM), (Cora, DSA), (Cora,SP), (Cora,E3) } Suppose R is a relation that describes the subjects taken by a student in a certain semester, where: R = { (Amir,DM), (Amir, SP), (Budi,DM), (Budi,E3), (Cora,SP) } It can be seen that: R  (A  B) A is the domain of R, B is the range of R (Amir,DM)  R or Amir R DM (Amir,DSA)  R or Amir R DSA

12 Relations Example: Take P = { 2,3,4 } Q = { 2,4,8,9,15 }
Chapter 3 Relation and Function Relations Example: Take P = { 2,3,4 } Q = { 2,4,8,9,15 } If the relation R from P to Q is defined as: (p,q)  R if p is the factor of q, then the followings can be obtained: R = { (2,2),(2,4),(2,8),(3,9),(3,15),(4,4),(4,8) }.

13 Representation of Relations
Chapter 3 Relation and Function Representation of Relations Arrow Diagrams

14 Representation of Relations
Chapter 3 Relation and Function Representation of Relations Tables

15 Representation of Relations
Chapter 3 Relation and Function Representation of Relations Matrices Suppose R is a relation between A = { a1,a2, …,am } and B = { b1,b2, …,bn }, then the relation R can be presented by the matrix M = [mij]. where:

16 Representation of Relations
Chapter 3 Relation and Function Representation of Relations Matrices a1 = Amir, a2 = Budi, a3 = Cora, and b1 = DM, b2 = DSA, b3 = SP, b4 = E3 p1 = 2, p2 = 3, p3 = 4, and q1 = 2, q2 = 4, q3 = 8, q4 = 9, q5 = 15 a1 = 2, a2 = 3, a3 = 4, a4 = 8, a5 = 9

17 Representation of Relations
Chapter 3 Relation and Function Representation of Relations Directed Graph (Digraph) Relation on one single set can be represented graphically by using a directed graph or digraph. Digraphs are not defined to represent a relation from one set to another set. Each member of the set is marked as a vertex (node), and each relation is denoted as an arc (bow). If (a,b)  R, then an arc should be drawn from vertex a to vertex b. Vertex a is called initial vertex while vertex b terminal vertex. The pair of relation (a,a) is denoted with an arch from vertex a to vertex a itself. This kind of arc is called a loop.

18 Representation of Relations
Chapter 3 Relation and Function Representation of Relations Directed Graph (Digraph) Example: Suppose R = { (a,a),(a,b),(b,a),(b,c),(b,d),(c,a),(c,d),(d,b) } is a relation on a set { a,b,c,d }, then R can be represented by the following digraph:

19 Chapter 3 Relation and Function Binary Relations The relations on one set (from one member to another member in the same set) is also called binary relation. A binary relation may have one or more of the following properties: Reflexive and Irreflexive Transitive Symmetric Anti-symmetric

20 Binary Relations Reflexive and Irreflexive
Chapter 3 Relation and Function Binary Relations Reflexive and Irreflexive Relation R on set A is reflexive if (a,a)  R for each a  A. Relation R on set A is not reflexive if there exists a  A such that (a,a)  R. Relation R on set A is irreflexive if (a,a)  R for each a  A. Relation R on set A is not irreflexive if there exists a  A such that (a,a)  R. Example: Suppose set A = { 1,2,3,4 }, and a relation R is defined on A, then: R = { (1,1),(1,3),(2,1),(2,2),(3,3),(4,2),(4,3),(4,4) } is reflexive because there exist members of the relation with the form (a,a) for each possible a, namely (1,1), (2,2), (3,3), and (4,4). R = { (1,1),(2,2),(2,3),(4,2),(4,3),(4,4) } is not reflexive since (3,3)  R, and also not irreflexive because (1,1), (2,2), and (3,3)  R.

21 Chapter 3 Relation and Function Binary Relations If a relation is reflexive, then the digraph is characterized by the loop on each vertex.

22 Chapter 3 Relation and Function Binary Relations Example: Given a relation “divide without remainder” for a set of positive integers, is the relation reflexive or not? Each positive integer can divide itself without remainder  (a,a)  R for each a  A  the relation is reflexive Example: Given two relations on a set of positive integers N: S : x + y = 4, T : 3x + y = 10 Are S and T reflexive or not? Irreflexive or not? S is not reflexive, because although (2,2) is a member of S, there exist (a,a)  S for a  N, such as (1,1), (3,3), .... S is not irreflexive because (2,2) is a member of S. T is not reflexive because there is even no single pair (a,a)  T that can fulfill the relation. T is thus irreflexive.

23 Binary Relations Transitive
Chapter 3 Relation and Function Binary Relations Transitive Relation R on set A is transitive if (a,b)  R and (b,c)  R, then (a,c)  R for all a, b, c  A.

24 Chapter 3 Relation and Function Binary Relations Example: Suppose A = { 1, 2, 3, 4 }, and a relation R is defined on set A, then: R = { (2,1),(3,1),(3,2),(4,1),(4,2),(4,3) } is transitive. R = { (1,1),(2,3),(2,4),(4,2) } is not transitive because (2,4) and (4,2)  R, but (2,2)  R, also (4,2) and (2,3)  R, but (4,3)  R. R = { (1,2), (3,4) } is transitive because there is no violation against the rule { (a,b)  R and (b,c)  R }  (a,c)  R. Table for part a.

25 Chapter 3 Relation and Function Binary Relations Example: Is the relation “divide without remainder” on a set of positive integers transitive or not? It is transitive. Suppose that a divides b without remainder and b divides c without remainder, then certainly a divides c without remainder. { a R b  b R c }  a R c Example: Given two relations on a set of positive integers N: S : x + y = 4, T : 3x + y = 10 Are S and T transitive or not? S is not transitive, because i.e., (3,1) and (1,3) are members of S, but (3,3) and (1,1) are not members of S. T = { (1,7),(2,4),(3,1) }  not transitive because (3,7)  R.

26 Binary Relations Symmetric and Anti-Symmetric
Chapter 3 Relation and Function Binary Relations Symmetric and Anti-Symmetric Relation R on set A is symmetric if (a,b)  R, then (b,a)  R for all a,b  A. Relation R on set A is not symmetric if there exists (a,b)  R such that (b,a)  R. Relation R on set A such that if (a,b)  R and (b,a)  R then a = b for (a,b)  A, is called anti-symmetric. Relation R on set A is not anti-symmetric if there exist different a and b such that (a,b)  R and (b,a)  R. Symmetric Anti-Symmetric

27 Chapter 3 Relation and Function Binary Relations Example: Suppose A = { 1, 2, 3, 4 }, and a relation R is defined on set A, then: R = { (1,1),(1,2),(2,1),(2,2),(2,4),(4,2),(4,4) } is symmetric, because if (a,b)  R then (b,a)  R also. Here, (1,2) and (2,1)  R, as well as (2,4) and (4,2)  R. is not anti-symmetric, because i.e., (1,2)  R and (2,1)  R while 1  2. R = { (1,1),(2,3),(2,4),(4,2) } is not symmetric, because (2,3)  R, but (3,2)  R. is not anti-symmetric, because there exists (2,4)  R and (4,2)  R while 2  4.

28 Chapter 3 Relation and Function Binary Relations Example: Suppose A = { 1, 2, 3, 4 }, and a relation R is defined on set A, then: R = { (1,1),(2,2),(3,3) } is symmetric and anti-symmetric, because (1,1)  R and 1 = 1, (2,2)  R and 2 = 2, and (3,3)  R and 3 = 3. R = { (1,1),(1,2),(2,2),(2,3) } is not symmetric, because (2,3)  R, but (3,2)  R. is anti-symmetric, because (1,1)  R and 1 = 1 and, (2,2)  R and 2 = 2.

29 Chapter 3 Relation and Function Binary Relations Example: Suppose A = { 1, 2, 3, 4 }, and a relation R is defined on set A, then: R = { (1,1),(2,4),(3,3),(4,2) } is symmetric. is not anti-symmetric, because there exist (2,4) and (4,2) as member of R while 2  4. R = { (1,2),(2,3),(1,3) } is not symmetric. is anti-symmetric, because there is no different a and b such that (a,b)  R and (b,a)  R (which will violate the anti-symmetric rule).

30 Chapter 3 Relation and Function Binary Relations Example: Show that the relation R = { (1,1),(2,2),(2,3),(3,2),(4,2),(4,4)} is not symmetric and not anti-symmetric. R is not symmetric, because (4,2)  R but (2,4)  R. R is not anti-symmetric, because (2,3)  R and (3,2)  R but 2  3.

31 Chapter 3 Relation and Function Binary Relations Example: Is the relation “divide without remainder” on a set of positive integers symmetric? Is it anti-symmetric? It is not symmetric, because if a divides b without remainder, then b cannot divide a without remainder, unless if a = b. For example, 2 divides 4 without remainder, but 4 cannot divide 2 without remainder. Therefore, (2,4)  R but (4,2)  R. It is anti-symmetric, because if a divides b without remainder, and b divides a without remainder, then the case is only true for a = b. For example, 3 divides 3 without remainder, then (3,3)  R and 3 = 3.

32 Chapter 3 Relation and Function Binary Relations Example: Given two relations on a set of positive integers N: S : x + y = 4, T : 3x + y = 10 Are S and T symmetric? Are they anti-symmetric? S is symmetric, because take (3,1) and (1,3) are members of S. S is not anti-symmetric, because although there exists (2,2)  R, but there exist also { (3,1),(1,3) }  R while 3  1. T = { (1,7),(2,4),(3,1) }  not symmetric. T = { (1,7),(2,4),(3,1) }  anti-symmetric.

33 Chapter 3 Relation and Function Homework 4 For each of the following relations on set A = { 1,2,3,4 }, check each of them whether they are reflexive, irreflexive, transitive, symmetric, and/or anti-symmetric: R = { (2,2),(2,3),(2,4),(3,2),(3,3),(3,4) } S = { (1,1),(1,2),(2,1),(2,2),(3,3),(4,4) } T = { (1,2),(2,3),(3,4) } Represent the relation R, S, and T using matrices and digraphs.

34 Chapter 3 Relation and Function Homework 4A For each of the following relations on set A = { 1,2,3,4 }, check each of them whether they are reflexive, irreflexive, transitive, symmetric, and/or anti-symmetric: R = { (1,3),(1,4),(2,2),(4,1),(4,3) } S = { (1,1),(1,2),(1,3),(1,4),(2,1),(2,2) } T = { (2,1),(2,2),(3,4),(4,1),(4,4) } For the set B = { h,i,j,k,l }, with at least 4 members of relation, create: A relation V which is reflexive and transitive. A relation W which is irreflexive and symmetric.


Download ppt "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,"

Similar presentations


Ads by Google