Set Operations

175 Views

Download Presentation
## Set Operations

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Set Operations**• Union • Intersection • Relative Complement • Absolute Complement Likened to Logical Or and Logical And Likened to logical Negation**Set Operations: Union of Sets**• The union of two sets is the set that contains elements belonging to either of the two sets • Equivalent to the Boolean operation “or” • Written as: • Examples: A = {a, b, c, d} B = {c, d, e, f} A B = {a, b, c, d, e, f} Note that the set could have been described as {a, b, c, d, c, d, e, f}**Union of Sets: Venn Diagrams**A = {a, b, c, d} B = {c, d, e, f} A B = {a, b, c, d, e, f} A = {a, b, c, d} B = {x, y, z} A B = {a, b, c, d, x, y, z} Sets overlap Sets are disjoint**Set Operations: Set Intersection**• The intersection of two sets is the set of all elements common to both sets • The intersection of disjoint sets is the empty set • Equivalent to the Boolean operation “and” • written as: • Examples: A = {a, b, c, d} A = {a, b, c, d} B = {a, b} B = {x, y, z} A B = {a, b}A B = **Set Intersection : Venn Diagrams**A = {a, b, c, d} B = {a, b} A B = {a, b} A = {a, b, c, d} B = {x, y, z} A B = **Set Operations: Relative Complement**• The relative complement (difference) of two sets is the set of elements contained in one, but not both, of the sets • Related to the Boolean “Exclusive Or” • Written as: — • Examples:Given:A = {a, b, c, d} and B = {a, c, f, g} A — B = {b, d} B — A = {f, g}**Relative Complement of Sets:Venn Diagrams**A = {a, b, c, d} B = {a, c, f, g} A — B = {b, d} B — A = {f, g}**Absolute Set Complement**• The absolute complement of a set is the set of elements which do not belong to the set being complemented’ • Equivalent to the Boolean operation “not” • Written as a superscripted ‘c’ • Example: U = {a, b, c, d, e, u, v, w, x, y, z} A = {a, b, c, x, y, z} and B = {a, b, c, d, e} Ac= {d, e, u, v, w} Bc = {u, v, w, x, y, z}**Absolute Complement of Sets:Venn Diagrams**U = {a, b, c, d, e, u, v, w, x, y, z} A = {a, b, c, x, y, z} B = {d, e, y, z} Ac = {d, e, u, v, w}**Classic Boolean Model**• Illustrates the 8 possible relations be-tween Sets, A, B and C**Membership Tables**• Shows whether an arbitrary element x be- longs in any of the indicated sets.**Laws of the Algebra of Sets**• Idempotent Laws A A = A A A = A • Associative Laws (A B) C = A (B C) (A B) C = A (B C) • Commutative Laws A B = B A A B = B A**… Laws of the Algebra of Sets**• Distributive Laws A (B C) = (A B) (A C) A (B C) = (A B) (A C) • Identity Laws A = A A U = U A U = A A = **…Laws of the Algebra of Sets**• Complement LawsA Ac = U Uc = A Ac = c = U • De Morgan’s Laws (A B)c = Ac Bc(A B)c = Ac Bc