Rela%ons and Their Proper%es. Slides by A. Bloomfield

Size: px
Start display at page:

Download "Rela%ons and Their Proper%es. Slides by A. Bloomfield"

Transcription

1 Rela%ons and Their Proper%es Slides by A. Bloomfield

2 What is a rela%on Let A and B be sets. A binary rela%on R is a subset of A B Example Let A be the students in a the CS major A = {Alice, Bob, Claire, Dan} Let B be the courses the department offers B = {CS, CS2, CS22} We specify rela%on R = A B as the set that lists all students a A enrolled in class b B R = { (Alice, CS), (Bob, CS2), (Bob, CS22), (Dan, CS2), (Dan, CS22) } 2

3 More rela%on examples Another rela%on example: Let A be the ci%es in the US Let B be the states in the US We define R to mean a is a city in state b Thus, the following are in our rela%on: (C ville, VA) (Philadelphia, PA) (Portland, MA) (Portland, OR) etc Most rela%ons we will see deal with ordered pairs of integers 3

4 Represen%ng rela%ons We can represent relations graphically: We can represent relations in a table: Alice Bob Claire Dan CS CS2 CS22 Alice CS CS2 CS22 X Bob X X Claire Dan X X Not valid functions! 4

5 Rela%ons vs. func%ons Not all rela%ons are func%ons But consider the following func%on: a b c d All func%ons are rela%ons! 5

6 When to use which? A func%on is used when you need to obtain a SINGLE result for any element in the domain Example: sin, cos, tan A rela%on is when there are mul%ple mappings between the domain and the co- domain Example: students enrolled in mul%ple courses 6

7 Rela%ons on a set A rela%on on the set A is a rela%on from A to A In other words, the domain and co- domain are the same set We will generally be studying rela%ons of this type 7

8 Rela%ons on a set Let A be the set {, 2, 3, 4 } Which ordered pairs are in the rela%on R = { (a,b) a divides b } R = { (,), (,2), (,3), (,4), (2,2), (2,4), (3,3), (4,4) } R X X X X 2 X X X X 8

9 More examples Consider some rela%ons on the set Z Are the following ordered pairs in the rela%on? R = { (a,b) a b } R 2 = { (a,b) a>b } R 3 = { (a,b) a= b } R 4 = { (a,b) a=b } R 5 = { (a,b) a=b+ } R 6 = { (a,b) a+b 3 } (,) (,2) (2,) (,- ) (2,2) X X X X X X X X X X X X X X X 9

10 Rela%on proper%es Six proper%es of rela%ons we will study: Reflexive Irreflexive Symmetric Asymmetric An%symmetric Transi%ve

11 Reflexivity A rela%on is reflexive if every element is related to itself Or, (a,a) R Examples of reflexive rela%ons: =,, Examples of rela%ons that are not reflexive: <, >

12 Irreflexivity A rela%on is irreflexive if every element is not related to itself Or, (a,a) R Irreflexivity is the opposite of reflexivity Examples of irreflexive rela%ons: <, > Examples of rela%ons that are not irreflexive: =,, 2

13 Reflexivity vs. Irreflexivity A rela%on can be neither reflexive nor irreflexive Some elements are related to themselves, others are not We will see an example of this later on 3

14 Symmetry A rela%on is symmetric if, for every (a,b) R, then (b,a) R Examples of symmetric rela%ons: =, istwinof() Examples of rela%ons that are not symmetric: <, >,, 4

15 Asymmetry A rela%on is asymmetric if, for every (a,b) R, then (b,a) R Asymmetry is the opposite of symmetry Examples of asymmetric rela%ons: <, > Examples of rela%ons that are not asymmetric: =, istwinof(),, 5

16 An%symmetry A rela%on is an%symmetric if, for every (a,b) R, then (b,a) R is true only when a=b An%symmetry is not the opposite of symmetry Examples of an%symmetric rela%ons: =,, Examples of rela%ons that are not an%symmetric: <, >, istwinof() 6

17 Notes on *symmetric rela%ons A rela%on can be neither symmetric or asymmetric R = { (a,b) a= b } This is not symmetric - 4 is not related to itself This is not asymmetric 4 is related to itself Note that it is an%symmetric 7

18 Transi%vity A rela%on is transi%ve if, for every (a,b) R and (b,c) R, then (a,c) R If a < b and b < c, then a < c Thus, < is transi%ve If a = b and b = c, then a = c Thus, = is transi%ve 8

19 Transi%vity examples Consider isancestorof() Let Alice be Bob s parent, and Bob be Claire s parent Thus, Alice is an ancestor of Bob, and Bob is an ancestor of Claire Thus, Alice is an ancestor of Claire Thus, isancestorof() is a transi%ve rela%on Consider isparentof() Let Alice be Bob s parent, and Bob be Claire s parent Thus, Alice is a parent of Bob, and Bob is a parent of Claire However, Alice is not a parent of Claire Thus, isparentof() is not a transi%ve rela%on 9

20 Rela%ons of rela%ons summary = < > Reflexive X X X Irreflexive X X Symmetric X Asymmetric X X Antisymmetric X X X Transitive X X X X X 2

21 Combining rela%ons There are two ways to combine rela%ons R and R 2 Via Boolean operators Via rela%on composi%on 2

22 Combining rela%ons via Boolean operators Consider two rela%ons R and R We can combine them as follows: R U R = all numbers OR That s all the numbers R R = all numbers AND That s all numbers equal to R R = all numbers or, but not both That s all numbers not equal to R - R = all numbers that are not also That s all numbers strictly greater than R - R = all numbers that are not also That s all numbers strictly less than Note that it s possible the result is the empty set 22

23 Combining rela%ons via rela%onal composi%on Let R be a rela%on from A to B, and S be a rela%on from B to C Let a A, b B, and c C Let (a,b) R, and (b,c) S Then the composite of R and S consists of the ordered pairs (a,c) We denote the rela%on by S R Note that S comes first when wri%ng the composi%on! 23

24 Combining rela%ons via rela%onal composi%on Let M be the rela%on is mother of Let F be the rela%on is father of What is M F? If (a,b) F, then a is the father of b If (b,c) M, then b is the mother of c Thus, M F denotes the rela%on maternal grandfather What is F M? If (a,b) M, then a is the mother of b If (b,c) F, then b is the father of c Thus, F M denotes the rela%on paternal grandmother What is M M? If (a,b) M, then a is the mother of b If (b,c) M, then b is the mother of c Thus, M M denotes the rela%on maternal grandmother Note that M and F are not transi%ve rela%ons!!! 24

25 Combining rela%ons via rela%onal composi%on Given rela%on R R R can be denoted by R 2 R 2 R = (R R) R = R 3 Example: M 3 is your mother s mother s mother 25

26 Represen%ng Rela%ons Slides by A. Bloomfield 26

27 In this slide set Matrix review Two ways to represent rela%ons Via matrices Via directed graphs 27

28 28 Matrix review This is from Rosen, page 2 and 22 We will only be dealing with zero- one matrices Each element in the matrix is either a or a These matrices will be used for Boolean opera%ons is true, is false

29 29 Matrix transposi%on Given a matrix M, the transposi%on of M, denoted M t, is the matrix obtained by switching the columns and rows of M In a square matrix, the main diagonal stays unchanged = M = M = t M = t M

30 3 Matrix join A join of two matrices performs a Boolean OR on each rela%ve entry of the matrices Matrices must be the same size Denoted by the or symbol: =

31 3 Matrix meet A meet of two matrices performs a Boolean AND on each rela%ve entry of the matrices Matrices must be the same size Denoted by the or symbol: =

32 32 Matrix Boolean product A Boolean product of two matrices is similar to matrix mul%plica%on Instead of the sum of the products, it s the conjunc%on (and) of the disjunc%ons (ors) Denoted by the or symbol: 4,,4 3,,3 2,,2,,, * * * * b a b a b a b a c = 4,,4 3,,3 2,,2,,, b a b a b a b a c = = = =

33 Rela%ons using matrices List the elements of sets A and B in a par%cular order Order doesn t maner, but we ll generally use ascending order Create a matrix M = m ] R [ ij m ij = if if ( a, b i ( a, b i j ) R j ) R 33

34 Rela%ons using matrices Consider the rela%on of who is enrolled in which class Let A = { Alice, Bob, Claire, Dan } Let B = { CS, CS2, CS22 } R = { (a,b) person a is enrolled in course b } CS CS2 CS22 Alice X Bob X X Claire Dan X X M R = 34

35 Rela%ons using matrices What is it good for? It is how computers view rela%ons A 2- dimensional array Very easy to view rela%onship proper%es We will generally consider rela%ons on a single set In other words, the domain and co- domain are the same set And the matrix is square 35

36 36 Reflexivity Consider a reflexive rela%on: One which every element is related to itself Let A = {, 2, 3, 4, 5 } = M If the center (main) diagonal is all s, a relation is reflexive

37 37 Irreflexivity Consider a reflexive rela%on: < One which every element is not related to itself Let A = {, 2, 3, 4, 5 } = M If the center (main) diagonal is all s, a relation is irreflexive

38 38 = M Symmetry Consider an symmetric rela%on R One which if a is related to b then b is related to a for all (a,b) Let A = {, 2, 3, 4, 5 } If, for every value, it is the equal to the value in its transposed position, then the relation is symmetric

39 Asymmetry Consider an asymmetric rela%on: < One which if a is related to b then b is not related to a for all (a,b) Let A = {, 2, 3, 4, 5 } M = If, for every value and t h e v a l u e i n i t s transposed position, if they are not both, then the relation is asymmetric An asymmetric relation must also be irreflexive Thus, the main diagonal must be all s 39

40 An%symmetry Consider an an%symmetric rela%on: One which if a is related to b then b is not related to a unless a=b for all (a,b) Let A = {, 2, 3, 4, 5 } If, for every value and the value in its M = transposed position, if they are not both, then the relation is antisymmetric The center diagonal can have both s and s 4

41 Transi%vity Consider an transi%ve rela%on: One which if a is related to b and b is related to c then a is related to c for all (a,b), (b,c) and (a,c) Let A = {, 2, 3, 4, 5 } M = If, for every spot (a,b) and (b,c) that each have a, there is a at (a,c), then the relation is transitive Matrices don t show this property easily 4

42 42 Combining rela%ons: via Boolean operators Example 4 from Rosen, sec%on 7.3 Let: Join: Meet: = M R = M S = = S R S R M M M = = S R S R M M M

43 43 Combining rela%ons: via rela%on composi%on Example 4 from Rosen, sec%on 7.3 Let: But why is this the case? = M R = M S = = S R R S M M M a b c d e f d e f g h i a b c g h i

44 Represen%ng rela%ons using directed A directed graph consists of: A set V of ver%ces (or nodes) A set E of edges (or arcs) graphs If (a, b) is in the rela%on, then there is an arrow from a to b Will generally use rela%ons on a single set Consider our rela%on R = { (a,b) a divides b } Old way:

45 Reflexivity Consider a reflexive rela%on: One which every element is related to itself Let A = {, 2, 3, 4, 5 } 2 If every node has a loop, a relation is reflexive

46 Irreflexivity Consider a reflexive rela%on: < One which every element is not related to itself Let A = {, 2, 3, 4, 5 } 2 If every node does not have a loop, a relation is irreflexive

47 Symmetry Consider an symmetric rela%on R One which if a is related to b then b is related to a for all (a,b) Let A = {, 2, 3, 4, 5 } If, for every edge, there Called antiparallel pairs Note that this relation is neither reflexive nor irreflexive! is an edge in the other direction, then the relation is symmetric Loops are allowed, and do not need edges in the other direction 47

48 Asymmetry Consider an asymmetric rela%on: < One which if a is related to b then b is not related to a for all (a,b) Let A = {, 2, 3, 4, 5 } A digraph is asymmetric if: If, for every edge, there is not an edge in the other direction, then the relation is asymmetric 2. Loops are not allowed in an asymmetric digraph (recall it must be 48 irreflexive)

49 An%symmetry Consider an an%symmetric rela%on: One which if a is related to b then b is not related to a unless a=b for all (a,b) Let A = {, 2, 3, 4, 5 } 2 If, for every edge, there is not an edge in the other direction, then the relation is antisymmetric Loops are allowed in the digraph 49

50 Transi%vity Consider an transi%ve rela%on: One which if a is related to b and b is related to c then a is related to c for all (a,b), (b,c) and (a,c) Let A = {, 2, 3, 4, 5 } A digraph is transitive if, for there is a edge from a to c when there is a edge from a to b and from b to c 4 5

51 Applica%ons of digraphs: MapQuest Not reflexive Is irreflexive Not symmetric Not asymmetric Not antisymmetric Not transitive End Not reflexive Is irreflexive Is symmetric Not asymmetric Not antisymmetric Not transitive Start 5

52 Rosen, ques%ons 3 & 32, sec%on 7.3 Which of the graphs are reflexive, irreflexive, symmetric, asymmetric, antisymmetric, or transitive Reflexive Y Y Y Irreflexive Y Y Symmetric Asymmetric A n t i - symmetric Transitive Y Y Y Y Y Y 52

53 Rosen, sec%on 7. (sic) ques%on 45 (a) How many symmetric rela%ons are there on a set with n elements? Solu%on guide explana%on is preny poorly worded So instead we ll use matrices 53

54 Rosen, sec%on 7. (sic) ques%on 45 (a) Consider the matrix represen%ng symmetric rela%on R on a set with n elements: The center diagonal can have any values Once the upper triangle is determined, the lower triangle must be the transposed version of the upper one How many ways are there to fill in the center diagonal and the upper triangle? There are n 2 elements in the matrix There are n elements in the center diagonal Thus, there are 2 n ways to fill in s and s in the diagonal Thus, there are (n 2 - n)/2 elements in each triangle Thus, there are ( n 2 n)/2 ways to fill in s and s in the triangle 2 2 *2 2 = 2 n ( n n)/2 ( n + n)/2 Answer: there are possible symmetric rela%ons on a set with n elements 2 54

55 Closures of Rela%ons Slides by A. Bloomfield 55

56 Rela%onal closures Three types we will study Reflexive Easy Symmetric Easy Transi%ve Hard 56

57 Reflexive closure Consider a rela%on R: From our MapQuest example in the last slide set Note that it is not reflexive We want to add edges to make the rela%on reflexive By adding those edges, we have made a non- reflexive rela%on R into a reflexive rela%on This new rela%on is called the reflexive closure of R 57

58 Reflexive closure In order to find the reflexive closure of a rela%on R, we add a loop at each node that does not have one The reflexive closure of R is R U Δ Where Δ = { (a,a) a R } Called the diagonal rela%on With matrices, we set the diagonal to all s 58

59 Rosen, sec%on 7.4, ques%on (a) Let R be a rela%on on the set {,, 2, 3 } containing the ordered pairs (,), (,), (,2), (2,), (2,2), and (3,) What is the reflexive closure of R? We add all pairs of edges (a,a) that do not already exist We add edges: (,), (3,3)

60 Symmetric closure Consider a rela%on R: From our MapQuest example in the last slide set Note that it is not symmetric We want to add edges to make the rela%on symmetric By adding those edges, we have made a non- symmetric rela%on R into a symmetric rela%on This new rela%on is called the symmetric closure of R 6

61 Symmetric closure In order to find the symmetric closure of a rela%on R, we add an edge from a to b, where there is already an edge from b to a The symmetric closure of R is R U R - If R = { (a,b) } Then R - = { (b,a) } 6

62 Rosen, sec%on 7.4, ques%on (b) Let R be a rela%on on the set {,, 2, 3 } containing the ordered pairs (,), (,), (,2), (2,), (2,2), and (3,) What is the symmetric closure of R? We add all pairs of edges (a,b) where (b,a) exists We make all single edges into an%- parallel pairs 3 2 We add edges: (,2), (,3) (,), (2,) 62

63 Paths in directed graphs A path is a sequences of connected edges from vertex a to vertex b No path exists from the noted start loca%on A path that starts and ends at the same vertex is called a circuit or cycle Must have length Start (a) Start (a) End (b) End (b) Start (a) 63

64 More on paths The length of a path is the number of edges in the path, not the number of nodes 64

65 Transi%ve closure The transitive closure would contain edges between all nodes reachable by a path of any length 65

66 Transi%ve closure Informal defini%on: If there is a path from a to b, then there should be an edge from a to b in the transi%ve closure First take of a defini%on: In order to find the transi%ve closure of a rela%on R, we add an edge from a to c, when there are edges from a to b and b to c But there is a path from to 4 with no edge! R = { (,2), (2,3), (3,4) } 4 (,2) & (2,3) (,3) (2,3) & (3,4) (2,4)

67 Transi%ve closure Informal defini%on: If there is a path from a to b, then there should be an edge from a to b in the transi%ve closure Second take of a defini%on: In order to find the transi%ve closure of a rela%on R, we add an edge from a to c, when there are edges from a to b and b to c Repeat this step un%l no new edges are added to the rela%on We will study different algorithms for determining the transi%ve closure red means added on the first repeat teal means added on the second repeat

68 6 degrees of separa%on The idea that everybody in the world is connected by six degrees of separa%on Where degree of separa%on means you know (or have met) somebody else Let R be a rela%on on the set of all people in the world (a,b) R if person a has met person b So six degrees of separa%on for any two people a and g means: (a,b), (b,c), (c,d), (d,e), (e,f), (f,g) are all in R Or, (a,g) R 6 68

69 Connec%vity rela%on R contains edges between all the nodes reachable via edge R R = R 2 contains edges between nodes that are reachable via 2 edges in R R 2 R = R 3 contains edges between nodes that are reachable via 3 edges in R R n = contains edges between nodes that are reachable via n edges in R R* contains edges between nodes that are reachable via any number of edges (i.e. via any path) in R Rephrased: R* contains all the edges between nodes a and b when is a path of length at least between a and b in R R* is the transi%ve closure of R The defini%on of a transi%ve closure is that there are edges between any nodes (a,b) that contain a path between them 69

70 How long are the paths in a transi%ve closure? Let R be a rela%on on set A, and let A be a set with n elements Rephrased: consider a graph G with n nodes and some number of edges Lemma : If there is a path (of length at least ) from a to b in R, then there is a path between a and b of length not exceeding n Proof prepara%on: Suppose there is a path from a to b in R Let the length of that path be m Let the path be edges (x, x ), (x, x 2 ),, (x m-, x m ) That s nodes x, x, x 2,, x m-, x m If a node exists twice in our path, then it s not a shortest path As we made no progress in our path between the two occurrences of the repeated node Thus, each node may exist at most once in the path 7

71 How long are the paths in a transi%ve closure? Proof by contradic%on: Assume there are more than n nodes in the path Thus, m > n Let m = n+ By the pigeonhole principle, there are n+ nodes in the path (pigeons) and they have to fit into the n nodes in the graph (pigeonholes) Thus, there must be at least one pigeonhole that has at least two pigeons Rephrased: there must be at least one node in the graph that has two occurrences in the nodes of the path Not possible, as the path would not be the shortest path Thus, it cannot be the case that m > n If there exists a path from a to b, then there is a path from a to b of at most length n 7

72 Finding the transi%ve closure Let M R be the zero- one matrix of the rela%on R on a set with n elements. Then the zero- one matrix of the transi%ve closure R* is: M R* = M M M M R [2] R [3] R [ n] R Nodes reachable with one application of the relation Nodes reachable with two applications of the relation Nodes reachable with n applications of the relation 72

73 73 Rosen, sec%on 7.4, example 7 Find the zero- one matrix of the transi%ve closure of the rela%on R given by: = M R [3] [2] * R R R R M M M M = = = = [2] R R R M M M = [2] M R

74 74 Rosen, sec%on 7.4, example 7 = = M R* = = = [2] [3] R R R M M M 2 3

75 Transi%ve closure algorithm What we did (or rather, could have done): Compute the next matrix, where [i] i n M R Do a Boolean join with the previously computed matrix For our example: Compute [2] MR = MR MR Join that with to yield Compute M R [3] [2] Join that with MR = MR M from R above M [2] R M R [2] MR M R 75

76 Transi%ve closure algorithm procedure transigve_closure (M R : zero- one n n matrix) A := M R B := A for i := 2 to n begin A := A B := B A M R end { B is the zero- one matrix for R* } 76

77 More transi%ve closure algorithms More efficient algorithms exist, such as Warshall s algorithm We won t be studying it in this class Thus, the material on pages won t be on the test 77

78 Equivalence Rela%ons Slides by A. Bloomfield 78

79 Introduc%on Certain combina%ons of rela%on proper%es are very useful We won t have a chance to see many applica%ons in this course In this set we will study equivalence rela%ons A rela%on that is reflexive, symmetric and transi%ve Next slide set we will study par%al orderings A rela%on that is reflexive, an%symmetric, and transi%ve The difference is whether the rela%on is symmetric or an%symmetric 79

80 Outline What is an equivalence rela%on Equivalence rela%on examples Related items Equivalence class Par%%ons 8

81 Equivalence rela%ons A rela%on on a set A is called an equivalence relagon if it is reflexive, symmetric, and transi%ve This is defini%on in the textbook Consider rela%on R = { (a,b) len(a) = len(b) } Where len(a) means the length of string a It is reflexive: len(a) = len(a) It is symmetric: if len(a) = len(b), then len(b) = len(a) It is transi%ve: if len(a) = len(b) and len(b) = len(c), then len(a) = len(c) Thus, R is a equivalence rela%on 8

82 Equivalence rela%on example Consider the rela%on R = { (a,b) a b (mod m) } Remember that this means that m a- b Called congruence modulo m Is it reflexive: (a,a) R means that m a- a a- a =, which is divisible by m Is it symmetric: if (a,b) R then (b,a) R (a,b) means that m a- b Or that km = a- b. Nega%ng that, we get b- a = - km Thus, m b- a, so (b,a) R Is it transi%ve: if (a,b) R and (b,c) R then (a,c) R (a,b) means that m a- b, or that km = a- b (b,c) means that m b- c, or that lm = b- c (a,c) means that m a- c, or that nm = a- c Adding these two, we get km+lm = (a- b) + (b- c) Or (k+l)m = a- c Thus, m divides a- c, where n = k+l Thus, congruence modulo m is an equivalence rela%on 82

83 Rosen, sec%on 7.5, ques%on Which of these rela%ons on {,, 2, 3} are equivalence rela%ons? Determine the proper%es of an equivalence rela%on that the others lack a) { (,), (,), (2,2), (3,3) } " Has all the proper%es, thus, is an equivalence rela%on b) { (,), (,2), (2,), (2,2), (2,3), (3,2), (3,3) } " Not reflexive: (,) is missing " Not transi%ve: (,2) and (2,3) are in the rela%on, but not (,3) c) { (,), (,), (,2), (2,), (2,2), (3,3) } " Has all the proper%es, thus, is an equivalence rela%on d) { (,), (,), (,3), (2,2), (2,3), (3,), (3,2) (3,3) } " Not transi%ve: (,3) and (3,2) are in the rela%on, but not (,2) e) { (,), (,) (,2), (,), (,), (,2), (2,), (2,2), (3,3) } " Not symmetric: (,2) is present, but not (2,) " Not transi%ve: (2,) and (,) are in the rela%on, but not (2,) 83

84 Rosen, sec%on 7.5, ques%on 5 Suppose that A is a non- empty set, and f is a func%on that has A as its domain. Let R be the rela%on on A consis%ng of all ordered pairs (x,y) where f(x) = f(y) Meaning that x and y are related if and only if f(x) = f(y) Show that R is an equivalence rela%on on A Reflexivity: f(x) = f(x) True, as given the same input, a func%on always produces the same output Symmetry: if f(x) = f(y) then f(y) = f(x) True, by the defini%on of equality Transi%vity: if f(x) = f(y) and f(y) = f(z) then f(x) = f(z) True, by the defini%on of equality 84

85 Rosen, sec%on 7.5, ques%on 8 Show that the rela%on R, consis%ng of all pairs (x,y) where x and y are bit strings of length three or more that agree except perhaps in their first three bits, is an equivalence rela%on on the set of all bit strings Let f(x) = the bit string formed by the last n- 3 bits of the bit string x (where n is the length of the string) Thus, we want to show: let R be the rela%on on A consis%ng of all ordered pairs (x,y) where f(x) = f(y) This has been shown in ques%on 5 on the previous slide 85

86 Equivalence classes Let R be an equivalence rela%on 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. The equivalence class of a with respect to R is denoted by [a] R When only one rela%on is under considera%on, the subscript is o{en deleted, and [a] is used to denote the equivalence class Note that these classes are disjoint! As the equivalence rela%on is symmetric This is defini%on 2 in the textbook 86

87 More on equivalence classes Consider the rela%on R = { (a,b) a mod 2 = b mod 2 } Thus, all the even numbers are related to each other As are the odd numbers The even numbers form an equivalence class As do the odd numbers The equivalence class for the even numbers is denoted by [2] (or [4], or [784], etc.) [2] = {, - 4, - 2,, 2, 4, } 2 is a representagve of it s equivalence class There are only 2 equivalence classes formed by this equivalence rela%on 87

88 More on equivalence classes Consider the rela%on R = { (a,b) a = b or a = - b } Thus, every number is related to addi%ve inverse The equivalence class for an integer a: [7] = { 7, - 7 } [] = { } [a] = { a, - a } There are an infinite number of equivalence classes formed by this equivalence rela%on 88

89 Par%%ons Consider the rela%on R = { (a,b) a mod 2 = b mod 2 } This splits the integers into two equivalence classes: even numbers and odd numbers Those two sets together form a par%%on of the integers Formally, a par%%on of a set S is a collec%on of non- empty disjoint subsets of S whose union is S In this example, the par%%on is { [], [] } Or { {, - 3, -,, 3, }, {, - 4, - 2,, 2, 4, } } 89

90 Rosen, sec%on 7.5, ques%on 32 Which of the following are par%%ons of the set of integers? a) The set of even integers and the set of odd integers " Yes, it s a valid par%%on b) The set of posi%ve integers and the set of nega%ve integers " No: is in neither set c) The set of integers divisible by 3, the set of integers leaving a remainder of when divided by 3, and the set of integers leaving a remaineder of 2 when divided by 3 " Yes, it s a valid par%%on d) The set of integers less than -, the set of integers with absolute value not exceeding, and the set of integers greater than " Yes, it s a valid par%%on e) The set of integers not divisible by 3, the set of even integers, and the set of integers that leave a remainder of 3 when divided by 6 " The first two sets are not disjoint (2 is in both), so it s not a valid par%%on 9

91 Par%al Orderings Slides by A. Bloomfield 9

92 Introduc%on An equivalence rela%on is a rela%on that is reflexive, symmetric, and transi%ve A par%al ordering (or par%al order) is a rela%on that is reflexive, angsymmetric, and transi%ve Recall that an%symmetric means that if (a,b) R, then (b,a) R unless b = a Thus, (a,a) is allowed to be in R But since it s reflexive, all possible (a,a) must be in R A set S with a par%al ordering R is called a pargally ordered set, or poset Denoted by (S,R) 92

93 Par%al ordering examples Show that is a par%al order on the set of integers It is reflexive: a a for all a Z It is an%symmetric: if a b then the only way that b a is when b = a It is transi%ve: if a b and b c, then a c Note that is the par%al ordering on the set of integers (Z, ) is the par%ally ordered set, or poset 93

94 Symbol usage The symbol is used to represent any rela%on when discussing par%al orders Not just the less than or equals to rela%on Can represent,,, etc Thus, a b denotes that (a,b) R The poset is (S, ) 94

95 Comparability The elements a and b of a poset (S, ) are called comparable if either a b or b a. Meaning if (a,b) R or (b,a) R It can t be both because is an%symmetric Unless a = b, of course If neither a b nor b a, then a and b are incomparable Meaning they are not related to each other This is defini%on 2 in the text If all elements in S are comparable, the rela%on is a total ordering 95

96 Comparability examples Let be the divides operator In the poset (Z +, ), are the integers 3 and 9 comparable? Yes, as 3 9 Are 7 and 5 comparable? No, as 7 5 and 5 7 Thus, as there are pairs of elements in Z + that are not comparable, the poset (Z +, ) is a par%al order 96

97 Comparability examples Let be the less than or equals operator In the poset (Z +, ), are the integers 3 and 9 comparable? Yes, as 3 9 Are 7 and 5 comparable? Yes, as 5 7 As all pairs of elements in Z + are comparable, the poset (Z +, ) is a total order a.k.a. totally ordered poset, linear order, chain, etc. 97

98 Well- ordered sets (S, ) is a well- ordered set if: (S, ) is a totally ordered poset Every non- empty subset of S has a least element Example: (Z, ) Is a total ordered poset (every element is comparable to every other element) It has no least element Thus, it is not a well- ordered set Example: (S, ) where S = {, 2, 3, 4, 5 } Is a total ordered poset (every element is comparable to every other element) Has a least element () Thus, it is a well- ordered set 98

99 Lexicographic ordering Consider two posets: (S, ) and (T, 2 ) We can order Cartesian products of these two posets via lexicographic ordering Let s S and s 2 S Let t T and t 2 T (s,t ) (s 2,t 2 ) if either: S s 2 s = s 2 and t 2 t 2 Lexicographic ordering is used to order dic%onaries 99

100 Lexicographic ordering Let S be the set of word strings (i.e. no spaces) Let T bet the set of strings with spaces Both the rela%ons are alphabe%c sor%ng We will formalize alphabe%c sor%ng later Thus, our posets are: (S, ) and (T, ) Order ( run, noun: to ) and ( set, verb: to ) As run set, the run Cartesian product comes before the set one Order ( run, noun: to ) and ( run, verb: to ) Both the first part of the Cartesian products are equal noun is first (alphabe%cally) than verb, so it is ordered first

101 Lexicographic ordering We can do this on more than 2- tuples (,2,3,5) (,2,4,3) When is

102 Lexicographic ordering Consider the two strings a a 2 a 3 a m, and b b 2 b 3 b n Here follows the formal defini%on for lexicographic ordering of strings If m = n (i.e. the strings are equal in length) (a, a 2, a 3,, a m ) (b, b 2, b 3,, b n ) using the comparisons just discussed Example: run set If m n, then let t be the minimum of m and n Then a a 2 a 3 a m, is less than b b 2 b 3 b n if and only if either of the following are true: (a, a 2, a 3,, a t ) (b, b 2, b 3,, b t ) Example: run sets (t = 3) (a, a 2, a 3,, a t ) = (b, b 2, b 3,, b t ) and m < n Example: run running 2

103 Hasse Diagrams Consider the graph for a finite poset ({,2,3,4}, ) When we KNOW it s a poset, we can simplify the graph Called the Hasse diagram

104 Hasse Diagram For the poset ({,2,3,4,6,8,2}, ) 4

105 Maximal and Minimal elements in Posets 5

106 Maximum and Minimum elements 6

107 Not being covered The remainder of 7.6 is not being covered due to lack of %me La ces Topological sor%ng 7

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Definition: A binary relation R from a set A to a set B is a subset R A B. Example: Chapter 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 B = {a,b} {(0, a), (0, b), (1,a), (2, b)} is a relation from A to B.

More information

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Section Summary. Relations and Functions Properties of Relations. Combining Relations Chapter 9 Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations Closures of Relations (not currently included

More information

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y. Relations Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 7.1, 7.3 7.5 of Rosen cse235@cse.unl.edu

More information

Relations Graphical View

Relations Graphical View Introduction Relations Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Recall that a relation between elements of two sets is a subset of their Cartesian

More information

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook) Relations Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations Reading (Epp s textbook) 8.-8.3. Cartesian Products The symbol (a, b) denotes the ordered

More information

Chapter 9: Relations Relations

Chapter 9: Relations Relations Chapter 9: Relations 9.1 - Relations Definition 1 (Relation). Let A and B be sets. A binary relation from A to B is a subset R A B, i.e., R is a set of ordered pairs where the first element from each pair

More information

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Definition: A binary relation R from a set A to a set B is a subset R A B. Example: Section 9.1 Rela%onships Relationships between elements of sets occur in many contexts. Every day we deal with relationships such as those between a business and its telephone number, an employee and his

More information

What are relations? f: A B

What are relations? f: A B What are relations? Ch 9.1 What are relations? Notation Informally, a relation is a set of pairs of objects (or in general, set of n-tuples) that are related to each other by some rule. We will focus first

More information

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples. Relations We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples. Relations use ordered tuples to represent relationships among

More information

CSC Discrete Math I, Spring Relations

CSC Discrete Math I, Spring Relations CSC 125 - Discrete Math I, Spring 2017 Relations Binary Relations Definition: A binary relation R from a set A to a set B is a subset of A B Note that a relation is more general than a function Example:

More information

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018 Relations Alice E. Fischer April, 2018 1 Inverse of a Relation 2 Properties of Relations The Inverse of a Relation Let R be a relation from A to B. Define the inverse relation, R 1 from B to A as follows.

More information

Packet #5: Binary Relations. Applied Discrete Mathematics

Packet #5: Binary Relations. Applied Discrete Mathematics Packet #5: Binary Relations Applied Discrete Mathematics Table of Contents Binary Relations Summary Page 1 Binary Relations Examples Page 2 Properties of Relations Page 3 Examples Pages 4-5 Representations

More information

Today. Binary relations establish a relationship between elements of two sets

Today. Binary relations establish a relationship between elements of two sets Today Relations Binary relations and properties Relationship to functions n-ary relations Definitions Binary relations establish a relationship between elements of two sets Definition: Let A and B be two

More information

COMP 182 Algorithmic Thinking. Relations. Luay Nakhleh Computer Science Rice University

COMP 182 Algorithmic Thinking. Relations. Luay Nakhleh Computer Science Rice University COMP 182 Algorithmic Thinking Relations Luay Nakhleh Computer Science Rice University Chapter 9, Section 1-6 Reading Material When we defined the Sorting Problem, we stated that to sort the list, the elements

More information

Relations. Relations. Definition. Let A and B be sets.

Relations. Relations. Definition. Let A and B be sets. Relations Relations. Definition. Let A and B be sets. A relation R from A to B is a subset R A B. If a A and b B, we write a R b if (a, b) R, and a /R b if (a, b) / R. A relation from A to A is called

More information

MAD 3105 PRACTICE TEST 2 SOLUTIONS

MAD 3105 PRACTICE TEST 2 SOLUTIONS MAD 3105 PRACTICE TEST 2 SOLUTIONS 1. Let R be the relation defined below. Determine which properties, reflexive, irreflexive, symmetric, antisymmetric, transitive, the relation satisfies. Prove each answer.

More information

Relationships between elements of sets occur in many contexts. Every day we deal with

Relationships between elements of sets occur in many contexts. Every day we deal with C H A P T E R 9 Relations 9.1 Relations and Their Properties 9.2 n-ary Relations and Their Applications 9.3 Representing Relations 9.4 Closures of Relations 9.5 Equivalence Relations 9.6 Partial Orderings

More information

Math.3336: Discrete Mathematics. Chapter 9 Relations

Math.3336: Discrete Mathematics. Chapter 9 Relations Math.3336: Discrete Mathematics Chapter 9 Relations Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall 2018

More information

Equivalence relations

Equivalence relations Equivalence relations R A A is an equivalence relation if R is 1. reflexive (a, a) R 2. symmetric, and (a, b) R (b, a) R 3. transitive. (a, b), (b, c) R (a, c) R Example: Let S be a relation on people

More information

MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010

MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010 MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high

More information

Week 4-5: Binary Relations

Week 4-5: Binary Relations 1 Binary Relations Week 4-5: Binary Relations The concept of relation is common in daily life and seems intuitively clear. For instance, let X be the set of all living human females and Y the set of all

More information

Discrete Mathematics. 2. Relations

Discrete Mathematics. 2. Relations Discrete Mathematics 2. Relations Binary Relations Let A, B be any two sets. A binary relation R from A to B is a subset of A B. E.g., Let < : N N : {(n,m) n < m} The notation a R b or arb means (a,b)îr.

More information

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161 Discrete Math at CSU (Rosen book) Sets and Functions (Rosen, Sections 2.1,2.2, 2.3) TOPICS Discrete math Set Definition Set Operations Tuples 1 n CS 160 or CS122 n Sets and Functions n Propositions and

More information

Section 8.4 Closures of Relations

Section 8.4 Closures of Relations Section 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 ordered pairs to R to obtain property P. In

More information

Week 4-5: Binary Relations

Week 4-5: Binary Relations 1 Binary Relations Week 4-5: Binary Relations The concept of relation is common in daily life and seems intuitively clear. For instance, let X be the set of all living human females and Y the set of all

More information

Math 42, Discrete Mathematics

Math 42, Discrete Mathematics c Fall 2018 last updated 12/05/2018 at 15:47:21 For use by students in this class only; all rights reserved. Note: some prose & some tables are taken directly from Kenneth R. Rosen, and Its Applications,

More information

Relations --- Binary Relations. Debdeep Mukhopadhyay IIT Madras

Relations --- Binary Relations. Debdeep Mukhopadhyay IIT Madras Relations --- Binary Relations Debdeep Mukhopadhyay IIT Madras What is a relation? The mathematical concept of relation is based on the common notion of relationships among objects: One box is heavier

More information

Equivalence, Order, and Inductive Proof

Equivalence, Order, and Inductive Proof 2/ chapter 4 Equivalence, Order, and Inductive Proof Good order is the foundation of all things. Edmund Burke (729 797) Classifying things and ordering things are activities in which we all engage from

More information

CS 161: Design and Analysis of Algorithms

CS 161: Design and Analysis of Algorithms CS 161: Design and Analysis of Algorithms NP- Complete I P, NP Polynomial >me reduc>ons NP- Hard, NP- Complete Sat/ 3- Sat Decision Problem Suppose there is a func>on A that outputs True or False A decision

More information

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion CHAPTER 1 Relations 1. Relations and Their Properties 1.1. Definition of a Relation. Definition 1.1.1. A binary relation from a set A to a set B is a subset R A B. If (a, b) R we say a is Related to b

More information

Reading 11 : Relations and Functions

Reading 11 : Relations and Functions CS/Math 240: Introduction to Discrete Mathematics Fall 2015 Reading 11 : Relations and Functions Instructor: Beck Hasti and Gautam Prakriya In reading 3, we described a correspondence between predicates

More information

5. Partitions and Relations Ch.22 of PJE.

5. Partitions and Relations Ch.22 of PJE. 5. Partitions and Relations Ch. of PJE. We now generalize the ideas of congruence classes of Z to classes of any set X. The properties of congruence classes that we start with here are that they are disjoint

More information

Chapter 2 - Basics Structures

Chapter 2 - Basics Structures Chapter 2 - Basics Structures 2.1 - Sets Definitions and Notation Definition 1 (Set). A set is an of. These are called the or of the set. We ll typically use uppercase letters to denote sets: S, A, B,...

More information

Selected Solutions to Even Problems, Part 3

Selected Solutions to Even Problems, Part 3 Selected Solutions to Even Problems, Part 3 March 14, 005 Page 77 6. If one selects 101 integers from among {1,,..., 00}, then at least two of these numbers must be consecutive, and therefore coprime (which

More information

EQUIVALENCE RELATIONS (NOTES FOR STUDENTS) 1. RELATIONS

EQUIVALENCE RELATIONS (NOTES FOR STUDENTS) 1. RELATIONS EQUIVALENCE RELATIONS (NOTES FOR STUDENTS) LIOR SILBERMAN Version 1.0 compiled September 9, 2015. 1.1. List of examples. 1. RELATIONS Equality of real numbers: for some x,y R we have x = y. For other pairs

More information

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Mathematical Background Mathematical Background Sets Relations Functions Graphs Proof techniques Sets

More information

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics. Section 2.1 Introduction Sets are one of the basic building blocks for the types of objects considered in discrete mathematics. Important for counting. Programming languages have set operations. Set theory

More information

Multiple Choice Questions for Review

Multiple Choice Questions for Review Equivalence and Order Multiple Choice Questions for Review In each case there is one correct answer (given at the end of the problem set). Try to work the problem first without looking at the answer. Understand

More information

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr.

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr. Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr. Radhika Nagpal Quiz 1 Appendix Appendix Contents 1 Induction 2 2 Relations

More information

Discrete Basic Structure: Sets

Discrete Basic Structure: Sets KS091201 MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) Discrete Basic Structure: Sets Discrete Math Team 2 -- KS091201 MD W-07 Outline What is a set? Set properties Specifying a set Often used sets The universal

More information

Notes for Science and Engineering Foundation Discrete Mathematics

Notes for Science and Engineering Foundation Discrete Mathematics Notes for Science and Engineering Foundation Discrete Mathematics by Robin Whitty BSc PhD CMath FIMA 2009/2010 Contents 1 Introduction 1 1.1 The Laws of Arithmetic....................... 2 2 Polynomial

More information

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Problem 1: Specify two different predicates P (x) and

More information

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms REVIEW QUESTIONS Chapter 1: Foundations: Sets, Logic, and Algorithms 1. Why can t a Venn diagram be used to prove a statement about sets? 2. Suppose S is a set with n elements. Explain why the power set

More information

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60 MATH 213 Chapter 2: Basic Structures Dr. Eric Bancroft Fall 2013 Dr. Eric Bancroft MATH 213 Fall 2013 1 / 60 Chapter 2 - Basics Structures 2.1 - Sets 2.2 - Set Operations 2.3 - Functions 2.4 - Sequences

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 1 Course Web Page www3.cs.stonybrook.edu/ cse303 The webpage contains: lectures notes slides; very detailed solutions to

More information

0 Sets and Induction. Sets

0 Sets and Induction. Sets 0 Sets and Induction Sets A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a A to denote that a is an element of the set

More information

W3203 Discrete Mathema1cs. Coun1ng. Spring 2015 Instructor: Ilia Vovsha.

W3203 Discrete Mathema1cs. Coun1ng. Spring 2015 Instructor: Ilia Vovsha. W3203 Discrete Mathema1cs Coun1ng Spring 2015 Instructor: Ilia Vovsha h@p://www.cs.columbia.edu/~vovsha/w3203 Outline Bijec1on rule Sum, product, division rules Permuta1ons and combina1ons Sequences with

More information

Discrete Structures: Sample Questions, Exam 2, SOLUTIONS

Discrete Structures: Sample Questions, Exam 2, SOLUTIONS Discrete Structures: Sample Questions, Exam 2, SOLUTIONS (This is longer than the actual test.) 1. Show that any postage of 8 cents or more can be achieved by using only -cent and 5-cent stamps. We proceed

More information

1 Basic Combinatorics

1 Basic Combinatorics 1 Basic Combinatorics 1.1 Sets and sequences Sets. A set is an unordered collection of distinct objects. The objects are called elements of the set. We use braces to denote a set, for example, the set

More information

Polynomials and Gröbner Bases

Polynomials and Gröbner Bases Alice Feldmann 16th December 2014 ETH Zürich Student Seminar in Combinatorics: Mathema:cal So

More information

Combinatorics Sec/on of Rosen Ques/ons

Combinatorics Sec/on of Rosen Ques/ons Combinatorics Sec/on 5.1 5.6 7.5 7.6 of Rosen Spring 2011 CSCE 235 Introduc5on to Discrete Structures Course web- page: cse.unl.edu/~cse235 Ques/ons: cse235@cse.unl.edu Mo5va5on Combinatorics is the study

More information

W3203 Discrete Mathema1cs. Logic and Proofs. Spring 2015 Instructor: Ilia Vovsha. hcp://www.cs.columbia.edu/~vovsha/w3203

W3203 Discrete Mathema1cs. Logic and Proofs. Spring 2015 Instructor: Ilia Vovsha. hcp://www.cs.columbia.edu/~vovsha/w3203 W3203 Discrete Mathema1cs Logic and Proofs Spring 2015 Instructor: Ilia Vovsha hcp://www.cs.columbia.edu/~vovsha/w3203 1 Outline Proposi1onal Logic Operators Truth Tables Logical Equivalences Laws of Logic

More information

Mathematics 220 Homework 4 - Solutions. Solution: We must prove the two statements: (1) if A = B, then A B = A B, and (2) if A B = A B, then A = B.

Mathematics 220 Homework 4 - Solutions. Solution: We must prove the two statements: (1) if A = B, then A B = A B, and (2) if A B = A B, then A = B. 1. (4.46) Let A and B be sets. Prove that A B = A B if and only if A = B. Solution: We must prove the two statements: (1) if A = B, then A B = A B, and (2) if A B = A B, then A = B. Proof of (1): Suppose

More information

1. To be a grandfather. Objects of our consideration are people; a person a is associated with a person b if a is a grandfather of b.

1. To be a grandfather. Objects of our consideration are people; a person a is associated with a person b if a is a grandfather of b. 20 [161016-1020 ] 3.3 Binary relations In mathematics, as in everyday situations, we often speak about a relationship between objects, which means an idea of two objects being related or associated one

More information

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

DRAFT CONCEPTUAL SOLUTION REPORT DRAFT

DRAFT CONCEPTUAL SOLUTION REPORT DRAFT BASIC STRUCTURAL MODELING PROJECT Joseph J. Simpson Mary J. Simpson 08-12-2013 DRAFT CONCEPTUAL SOLUTION REPORT DRAFT Version 0.11 Page 1 of 18 Table of Contents Introduction Conceptual Solution Context

More information

Mathematics Course 111: Algebra I Part I: Algebraic Structures, Sets and Permutations

Mathematics Course 111: Algebra I Part I: Algebraic Structures, Sets and Permutations Mathematics Course 111: Algebra I Part I: Algebraic Structures, Sets and Permutations D. R. Wilkins Academic Year 1996-7 1 Number Systems and Matrix Algebra Integers The whole numbers 0, ±1, ±2, ±3, ±4,...

More information

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X.

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X. MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X. Notation 2 A set can be described using set-builder notation. That is, a set can be described

More information

Sets and Motivation for Boolean algebra

Sets and Motivation for Boolean algebra SET THEORY Basic concepts Notations Subset Algebra of sets The power set Ordered pairs and Cartesian product Relations on sets Types of relations and their properties Relational matrix and the graph of

More information

Diagnostic quiz for M303: Further Pure Mathematics

Diagnostic quiz for M303: Further Pure Mathematics Diagnostic quiz for M303: Further Pure Mathematics Am I ready to start M303? M303, Further pure mathematics is a fascinating third level module, that builds on topics introduced in our second level module

More information

Preparing for the CS 173 (A) Fall 2018 Midterm 1

Preparing for the CS 173 (A) Fall 2018 Midterm 1 Preparing for the CS 173 (A) Fall 2018 Midterm 1 1 Basic information Midterm 1 is scheduled from 7:15-8:30 PM. We recommend you arrive early so that you can start exactly at 7:15. Exams will be collected

More information

1. SET 10/9/2013. Discrete Mathematics Fajrian Nur Adnan, M.CS

1. SET 10/9/2013. Discrete Mathematics Fajrian Nur Adnan, M.CS 1. SET 10/9/2013 Discrete Mathematics Fajrian Nur Adnan, M.CS 1 Discrete Mathematics 1. Set and Logic 2. Relation 3. Function 4. Induction 5. Boolean Algebra and Number Theory MID 6. Graf dan Tree/Pohon

More information

CS Discrete Mathematics Dr. D. Manivannan (Mani)

CS Discrete Mathematics Dr. D. Manivannan (Mani) CS 275 - Discrete Mathematics Dr. D. Manivannan (Mani) Department of Computer Science University of Kentucky Lexington, KY 40506 Course Website: www.cs.uky.edu/~manivann/cs275 Notes based on Discrete Mathematics

More information

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms Professor Henry Carter Fall 2016 Recap Space-time tradeoffs allow for faster algorithms at the cost of space complexity overhead Dynamic

More information

An Introduction to the Concept of Relations

An Introduction to the Concept of Relations An Introduction to the Concept of Relations Think of your family tree. It consists of your brothers, sisters, cousins, second cousins, aunts uncles, parents grandparents, great grandparents etc. On this

More information

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A.

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A. 1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A. How to specify sets 1. to enumerate all of the elements

More information

Exercises for Discrete Maths

Exercises for Discrete Maths Exercises for Discrete Maths Discrete Maths Rosella Gennari http://www.inf.unibz.it/~gennari gennari@inf.unibz.it Computer Science Free University of Bozen-Bolzano Disclaimer. The course exercises are

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Exam 2. Is g one-to-one? Is g onto? Why? Solution: g is not one-to-one, since for c A, g(b) = g(c) = c. g is not onto, since a / g(a).

Exam 2. Is g one-to-one? Is g onto? Why? Solution: g is not one-to-one, since for c A, g(b) = g(c) = c. g is not onto, since a / g(a). Discrete Structures: Exam 2 Solutions to Sample Questions, 1. Let A = B = {a, b, c}. Consider the relation g = {(a, b), (b, c), (c, c)}. Is g one-to-one? Is g onto? Why? Solution: g is not one-to-one,

More information

Divisor Problems HAROLD B. REITER.

Divisor Problems HAROLD B. REITER. Divisor Problems HAROLD B REITER UNIVERSITY OF NORTH CAROLINA CHARLOTTE http://wwwmathunccedu/~hbreiter The purpose of this note is to find and study a method for determining and counting all the positive

More information

CHAPTER THREE: RELATIONS AND FUNCTIONS

CHAPTER THREE: RELATIONS AND FUNCTIONS CHAPTER THREE: RELATIONS AND FUNCTIONS 1 Relations Intuitively, a relation is the sort of thing that either does or does not hold between certain things, e.g. the love relation holds between Kim and Sandy

More information

MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM

MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM (FP1) The exclusive or operation, denoted by and sometimes known as XOR, is defined so that P Q is true iff P is true or Q is true, but not both. Prove (through

More information

CMPSCI 250: Introduction to Computation. Lecture #11: Equivalence Relations David Mix Barrington 27 September 2013

CMPSCI 250: Introduction to Computation. Lecture #11: Equivalence Relations David Mix Barrington 27 September 2013 CMPSCI 250: Introduction to Computation Lecture #11: Equivalence Relations David Mix Barrington 27 September 2013 Equivalence Relations Definition of Equivalence Relations Two More Examples: Universal

More information

Discrete Mathematics. Chapter 4. Relations and Digraphs Sanguk Noh

Discrete Mathematics. Chapter 4. Relations and Digraphs Sanguk Noh Discrete Mathematics Chapter 4. Relations and Digraphs Sanguk Noh Table Product sets and partitions Relations and digraphs Paths in relations and digraphs Properties of relations Equivalence relations

More information

Just the Factors, Ma am HAROLD B. REITER.

Just the Factors, Ma am HAROLD B. REITER. Just the Factors, Ma am HAROLD B REITER UNIVERSITY OF NORTH CAROLINA CHARLOTTE http://wwwmathunccedu/~hbreiter The purpose of this note is to find and study a method for determining and counting all the

More information

At least one of us is a knave. What are A and B?

At least one of us is a knave. What are A and B? 1. This is a puzzle about an island in which everyone is either a knight or a knave. Knights always tell the truth and knaves always lie. This problem is about two people A and B, each of whom is either

More information

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati Important 1. No questions about the paper will be entertained during

More information

Sets, Functions and Relations

Sets, Functions and Relations Chapter 2 Sets, Functions and Relations A set is any collection of distinct objects. Here is some notation for some special sets of numbers: Z denotes the set of integers (whole numbers), that is, Z =

More information

Chapter 6. Relations. 6.1 Relations

Chapter 6. Relations. 6.1 Relations Chapter 6 Relations Mathematical relations are an extremely general framework for specifying relationships between pairs of objects. This chapter surveys the types of relations that can be constructed

More information

Normaliza)on and Func)onal Dependencies

Normaliza)on and Func)onal Dependencies Normaliza)on and Func)onal Dependencies 1NF and 2NF Redundancy and Anomalies Func)onal Dependencies A9ribute Closure Keys and Super keys 3NF BCNF Minimal Cover Algorithm 3NF Synthesis Algorithm Decomposi)on

More information

Orders and Equivalences

Orders and Equivalences and Equivalences Gazihan Alankuş (Based on original slides by Brahim Hnich et al.) August 9, 2012 Gazihan Alankuş (Based on original slides by Brahim Hnich et al.) and Equivalences Gazihan Alankuş (Based

More information

Set theory. Math 304 Spring 2007

Set theory. Math 304 Spring 2007 Math 304 Spring 2007 Set theory Contents 1. Sets 2 1.1. Objects and set formation 2 1.2. Unions and intersections 3 1.3. Differences 4 1.4. Power sets 4 1.5. Ordered pairs and binary,amscdcartesian products

More information

Name (please print) Mathematics Final Examination December 14, 2005 I. (4)

Name (please print) Mathematics Final Examination December 14, 2005 I. (4) Mathematics 513-00 Final Examination December 14, 005 I Use a direct argument to prove the following implication: The product of two odd integers is odd Let m and n be two odd integers Since they are odd,

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION FORMAL LANGUAGES, AUTOMATA AND COMPUTATION IDENTIFYING NONREGULAR LANGUAGES PUMPING LEMMA Carnegie Mellon University in Qatar (CARNEGIE MELLON UNIVERSITY IN QATAR) SLIDES FOR 15-453 LECTURE 5 SPRING 2011

More information

Notation Index. gcd(a, b) (greatest common divisor) NT-16

Notation Index. gcd(a, b) (greatest common divisor) NT-16 Notation Index (for all) B A (all functions) B A = B A (all functions) SF-18 (n) k (falling factorial) SF-9 a R b (binary relation) C(n,k) = n! k! (n k)! (binomial coefficient) SF-9 n! (n factorial) SF-9

More information

Discrete Structures (2IT50)

Discrete Structures (2IT50) Discrete Structures (2IT50) Rob Hoogerwoord & Hans Zantema August, 2016 1 2 Contents 0.1 Introduction................................. 5 0.2 Basic set theory............................... 5 0.3 The principle

More information

Supplementary Material for MTH 299 Online Edition

Supplementary Material for MTH 299 Online Edition Supplementary Material for MTH 299 Online Edition Abstract This document contains supplementary material, such as definitions, explanations, examples, etc., to complement that of the text, How to Think

More information

MATH 363: Discrete Mathematics

MATH 363: Discrete Mathematics MATH 363: Discrete Mathematics Learning Objectives by topic The levels of learning for this class are classified as follows. 1. Basic Knowledge: To recall and memorize - Assess by direct questions. The

More information

Definitions: A binary relation R on a set X is (a) reflexive if x X : xrx; (f) asymmetric if x, x X : [x Rx xr c x ]

Definitions: A binary relation R on a set X is (a) reflexive if x X : xrx; (f) asymmetric if x, x X : [x Rx xr c x ] Binary Relations Definition: A binary relation between two sets X and Y (or between the elements of X and Y ) is a subset of X Y i.e., is a set of ordered pairs (x, y) X Y. If R is a relation between X

More information

Basic Combinatorics. Math 40210, Section 01 Fall Homework 8 Solutions

Basic Combinatorics. Math 40210, Section 01 Fall Homework 8 Solutions Basic Combinatorics Math 4010, Section 01 Fall 01 Homework 8 Solutions 1.8.1 1: K n has ( n edges, each one of which can be given one of two colors; so Kn has (n -edge-colorings. 1.8.1 3: Let χ : E(K k

More information

Discrete Structures, Final Exam

Discrete Structures, Final Exam Discrete Structures, Final Exam Monday, May 11, 2009 SOLUTIONS 1. (40 pts) Short answer. Put your answer in the box. No partial credit. [ ] 0 1 (a) If A = and B = 1 0 [ ] 0 0 1. 0 1 1 [ 0 1 1 0 0 1 ],

More information

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland Discrete Mathematics W. Ethan Duckworth Fall 2017, Loyola University Maryland Contents 1 Introduction 4 1.1 Statements......................................... 4 1.2 Constructing Direct Proofs................................

More information

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers ALGEBRA CHRISTIAN REMLING 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers by Z = {..., 2, 1, 0, 1,...}. Given a, b Z, we write a b if b = ac for some

More information

ABOUT THE CLASS AND NOTES ON SET THEORY

ABOUT THE CLASS AND NOTES ON SET THEORY ABOUT THE CLASS AND NOTES ON SET THEORY About the Class Evaluation. Final grade will be based 25%, 25%, 25%, 25%, on homework, midterm 1, midterm 2, final exam. Exam dates. Midterm 1: Oct 4. Midterm 2:

More information

Exam in Discrete Mathematics

Exam in Discrete Mathematics Exam in Discrete Mathematics First Year at the Faculty of Engineering and Science and the Technical Faculty of IT and Design June 4th, 018, 9.00-1.00 This exam consists of 11 numbered pages with 14 problems.

More information

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth Sets We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth century. Most students have seen sets before. This is intended

More information

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Ivan Avramidi New Mexico Institute of Mining and Technology Socorro, NM 87801 June 3, 2004 Author: Ivan Avramidi; File: absmath.tex; Date: June 11,

More information

HL Topic. Sets, relations and groups. (Further Mathematics SL Topic 3) Sets Ordered pairs Functions Binary operations Groups Further groups

HL Topic. Sets, relations and groups. (Further Mathematics SL Topic 3) Sets Ordered pairs Functions Binary operations Groups Further groups HL Topic (Further Mathematics SL Topic 3) 9 This topic explores the fundamental nature of algebraic structures and the relationships between them. Included is an extension of the work covered in the Core

More information

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries Harry Lewis September 5, 2013 Reading: Sipser, Chapter 0 Sets Sets are defined by their members A = B means that for every x, x A iff

More information

2 Equivalence Relations

2 Equivalence Relations 2 Equivalence Relations In mathematics, we often investigate relationships between certain objects (numbers, functions, sets, figures, etc.). If an element a of a set A is related to an element b of a

More information