Discrete Mathematics R. Johnsonbaugh SETS
2.1 Sets Set = a collection of distinct unordered objects Members of a set are called elements How to describe a set Listing its elements Example: A = {1,3,5,7} = {7, 5, 3, 1, 3} Listing a property needed for membership Example: B = {x | x = 2k + 1, 0 < k < 30}
Finite and infinite sets Examples: A = {1, 2, 3, 4} B = {x | x is an integer, 1 < x < 4} Infinite sets Z = {integers} = {…, -3, -2, -1, 0, 1, 2, 3,…} B={x| x is a positive, even integer}
Some important sets The empty set = { } has no elements. Also called null set or void set. Universal set: the set of all elements about which we make assertions. Examples: Z = {all Integers} i.e. -3, 0, 2, 145 R = {all real numbers} i.e. -3, -1.766, 0, 4/15, √2, π Q = {rational numbers} i.e. -1/3, 0, 24/15
Cardinality Cardinality of a set A (in symbols |A|) is the number of elements in A Examples: If A = {1, 2, 3} then |A| = 3 If B = {x | x is a natural number and 1< x< 9} then |B| = 9 Infinite cardinality Countable (e.g., natural numbers, integers) Uncountable (e.g., real numbers)
Subsets X is a subset of Y if every element of X is also contained in Y (in symbols X Y) Equality: X = Y if X Y and Y X, i.e., X = Y whenever x X, then x Y, and whenever x X, then x X X is a proper subset of Y if X Y but Y X Observation: is a subset of every set
Power set The power set of X is the set of all subsets of X. In symbols P(X),i.e. P(X)= {A | A X} Example: if X = {1, 2, 3}, then P(X) = {, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} Theorem 2.1.4: If |X| = n, then |P(X)| = 2n. |X| = 3 and |P(X)| = 23 = 8
Set operations: Produce a new set Union and Intersection Given two sets X and Y The union of X and Y is defined as the set X Y = { x | x X or x Y} : All elements belonging to X or Y or both The intersection of X and Y is defined as the set X Y = { x | x X and x Y} : All elements belonging to both X and Y Two sets X and Y are disjoint if X Y =
Complement and Difference Complement: The difference of two sets X – Y = { x | x X and x Y} The difference is also called the relative complement of Y in X Symmetric difference X Δ Y = (X – Y) (Y – X) The set of all elements that belong to X or to Y but not both X and Y. The complement of a set A contained in a universal set U is the set Ac = U – A = Ā
Example If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5} X Y = X Y = X – Y =
Example If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5} X Y = {1, 2, 3, 4, 5, 7, 10} X Y = {1, 4} X – Y = {7, 10} Y – X = {2, 3, 5}
Venn diagrams A Venn diagram provides a graphic view of sets Set union, intersection, difference, symmetric difference and complements can be easily and visually identified VIDEO U C A B
Properties of set operations Theorem 2.1.10: Let U be a universal set, and A, B and C subsets of U. The following properties hold: Associativity: (A B) C = A (B C) (A B) C = A (B C) Commutativity: A B = B A A B = B A
Properties of set operations Distributive laws: A(BC) = (AB)(AC) A(BC) = (AB)(AC) Identity laws: AU=A A = A Complement laws: AAc = U AAc =
Properties of set operations Idempotent laws: AA = A AA = A Bound laws: AU = U A = Absorption laws: A(AB) = A A(AB) = A
Properties of set operations Involution law: (Ac)c = A 0/1 laws: c = U Uc = De Morgan’s laws for sets: (AB)c = AcBc (AB)c = AcBc
Addition Principle A.K.A The Inclusion-Exclusion Principle If A and B are finite sets then, | A B | = |A| + |B| - | A B | U A B A B
Addition Principle for Disjoint Sets | A B C | = |A| + |B| + |C| - |A B| - |B C| - |A C| + |A B C| A = { a, b, c, d, e } B = { a, b, e, g, h } C = { b, d, e, g, h, k, m, n} A company wants to hire 25 programmers to handle systems Programming jobs and 40 programmers for applications programming. Of those hired, ten will be expected to perform jobs of both types. How many programmers must be hired?
One more example A survey was taken on methods of commuter travel. Each respondent was asked to check BUS, TRAIN, or CAR as a major mode of traveling. More than one answer is allowed. The results are: BUS 30 TRAIN 35 CAR 100 BUS and TRAIN 15 BUS and CAR 15 TRAIN and CAR 20 All three modes 5 How many people completed a survey form