WEEK 2-3 SETS 2 Introduction to Sets Introduction to Sets 3 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 A. The notation a A denotes that a is not an element of the set A. Sets are used to group objects together. Often, but not always, the objects in a set have similar properties. For instance, all the students who are currently enrolled in your school make up a set. Likewise, all the students currently taking a course in mathematics at any school make up a set. Introduction to Sets 4 Examples: (This way of describing a set is known as the roster method) 1. Cities in the Pakistan: {Lahore, Karachi, Islamabad, … } 2. Sets can contain non-related elements: {3, a, red, Gilgit} Properties: 1. Order does not matter {1, 2, 3, 4, 5} is equivalent to {3, 5, 2, 4, 1} 2. Sets do not have duplicate elements Capital letters (A, B, S…) for sets Lower-case letters for elements of a set (a, x, y…) Note that 1 ≠ {1} ≠ {{1}} ≠ {{{1}}} They are all different Introduction to Sets 5 Easiest way: list all the elements A = {1, 2, 3, 4, 5}, Not always feasible to list every element! May use ellipsis (…) when the general pattern of the elements is obvious: B = {0, 1, 2, 3, …} May cause confusion. C = {3, 5, 7, …}. What’s next? If the set is all odd integers greater than 2, next element is 9 If the set is all prime numbers greater than 2, next element is 11 Introduction to Sets 6 D = {x | x is prime ˄ x > 2} E = {x | x is odd ˄ x > 2} The vertical bar means “such that” If an element a is a member of a set S, we use the notation a S, i.e. 4 {1, 2, 3, 4} If not, we use the notation a S, i.e. 7 {1, 2, 3, 4} Introduction to Sets 7 N = {1, 2, 3, …} is the set of natural numbers Z = {…, -2, -1, 0, 1, 2, …} is the set of integers Z+ = {1, 2, 3, …} is the set of positive integers Q = {p/q | p Z, q Z, q ≠ 0} is the set of rational numbers Any number that can be expressed as a fraction of two integers (where the denominator is not zero) R is the set of real numbers R+, the set of positive real numbers 8 Types of Sets The Universal Set 9 U is the universal set – the set of all of elements (or the “universe”) from which given any set is drawn For the set {-2, 0.4, 2}, U would be the set of real numbers For the set {0, 1, 2}, U could be the set of whole numbers, Z, R depending on the context For the set of the vowels, U would be all the letters of the alphabet The Empty/Null Set 10 If a set has zero elements, it is called the empty (or null) set Written using the symbol Thus, = { } VERY IMPORTANT It can be a element of other sets { , 1, 2, 3, x } is a valid set ≠{} The first is a set of zero elements The second is a set of 1 element Replace by { }, and you get: { } ≠ {{ }} It’s easier to see that they are not equal that way Equal Sets 11 Two sets are equal if they have the same elements {1, 2, 3, 4, 5} = {5, 4, 3, 2, 1} {1, 2, 3, 2, 4, 3, 2, 1} = {4, 3, 2, 1} Two sets are not equal if they do not have the same elements • {1, 2, 3, 4, 5} ≠ {1, 2, 3, 4} We write A = B if A and B are equal sets. Subset 12 If A and B are two sets then set B is said to be subset of set A if all elements of set of B are also an element of A If B = {2, 4, 6}, A = {1, 2, 3, 4, 5, 6, 7} then B is a subset of A i.e. B A If A ={a ,b ,c}, B={b ,c}, C={a ,b ,c ,d}, D={a ,d} then B⊆A, A⊆C, B⊆C, D⊆C. But D⊈A i.e., D is not a subset of A For any set S, S S i.e. S (S S) For any set S, S i.e. S ( S) Superset, Proper Subset, Improper Subset 13 14 Is {1,2,3}? Does {1,2,3}? Is {,1,2,3}? Does {,1,2,3}? Is {x} {x}? Does {x} {x,{x}}? Is {x} {x,{x}}? Does {x} {x}? 15 Is {1,2,3}? Yes! Does {1,2,3}? No! Is {,1,2,3}? Yes! Does {,1,2,3}? Yes! Is {x} {x}? Yes Does {x} {x,{x}}? Yes Is {x} {x,{x}}? Yes Does {x} {x}? No Set Cardinality 16 The cardinality of a set A is the number of elements in a finite set, written as |A| or n(A) Examples Let 𝑅 = {−2, −3, 0, 1, 2}. Then |𝑅| = 𝑛(𝑅) = 5 || = 0 Let 𝑆 = {, {𝑎}, {𝑏}, {𝑎, 𝑏}}. Then |𝑆| = 4 Let S be the set of letters in the English alphabet. Then |S| = 26. Power Set 17 • • Given 𝑆 = {0, 1}. All the possible subsets of S? (as it is a subset of all sets), {0}, {1}, and {0, 1} The power set of S written as P(S) is the set of all the subsets of S 𝑃(𝑆) = { , {0}, {1}, {0,1} } • Note that |𝑆| = 𝑛(𝑆) = 2 and |𝑃(𝑆)| = 𝑛[𝑃(𝑆)] = 4 • If a set has n elements, then the power set will have 𝟐𝒏 elements. • Let 𝑇 = {0, 1, 2} Then 𝑃(𝑇) = { , {0}, {1}, {2}, {0,1}, {0,2}, {1,2}, {0,1,2} } Note that |𝑇| = 3 and |𝑃(𝑇)| = 8 • 𝑃() = { } Note that || = 0 and |𝑃()| = 1 Equivalent Sets 18 Two sets A and B are said to be equivalent if they have the same cardinality i.e. 𝑛(𝐴) = 𝑛(𝐵). It is denoted by 𝑨~𝑩 . In general, we can say, two sets are equivalent to each other if the number of elements in both the sets is equal. Example: 𝐴 = {𝑎 , 𝑏, 𝑐}, 𝐵 = {1, 2, 3} Both sets have equal number of elements i.e., 𝑨~𝑩 Singleton Set 19 A set with one element is called a singleton set. A common error is to confuse the empty set ∅ with the set {∅}, which is a singleton set. The single element of the set {∅} is the empty set itself! Sets of Sets 20 Sets can contain other sets S = { {1}, {2}, {3} } T = { {1}, {{2}}, {{{3}}} } V = { { {1}, {{2}} }, {{{3}}}, { {1}, {{2}}, {{{3}}} } } • V has only 3 elements! Note that 1 ≠ {1} ≠ {{1}} ≠ {{{1}}} They are all different Ordered Pair 21 An ordered pair is a pair of elements (x,y), written in a particular order. The ordered pair (x,y) is not the same ordered pair as (y,x). where x is the xcoordinate and y is the y-coordinate. Cartesian Product 22 The order of elements in a collection is often important. Because sets are unordered, a different structure is needed to represent ordered collections. • Note that the Cartesian products A×B and B×A are not equal, unless A=B. Cartesian Product 23 24 Set Operations Venn Diagrams 25 Represents sets graphically The box represents the universal set Circles represents the set Consider set S, which is the set of all vowels in the alphabet Union 26 Example 27 Let A = {3, 4, 5, 6}, B = {6, 7, 8} and C = {8, 9, 7}. Then A ∪ B = {3, 4, 5, 6, 7, 8} B ∪ C = {6, 7, 8, 9} A ∪ C = {3, 4, 5, 6, 7, 8, 9} Intersection 28 Example 29 Let A = {3, 4, 5, 6}, B = {5, 6, 7}, C = {7, 8, 9} Then, A ∩ B = {5, 6}, B ∩ C = {7} Union vs Intersection 30 Union vs Intersection 31 Disjoint 32 Examples 33 Further examples {1, 2, 3} and {3, 4, 5} are not disjoint {a, b} and {3, 4} are disjoint {1, 2} and are disjoint • Their intersection is the empty set and are disjoint! • Because their intersection is the empty set Difference 34 Example 35 {1, 2, 3} - {3, 4, 5} = {1, 2} {a, b} - {3, 4} = {a, b} {1, 2} - = {1, 2} The difference of any set S with the empty set will be the set itself Complement 36 Let U be a universal set and A be any subset of U, then the elements of U which are not in A i.e., U - A is the complement of A w.r.t. U is written as A' = U - A = Ac. Examples 37 let U = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} and A = { 1, 2, 4, 6, 9} Then, A' = U - A = {0, 3, 5, 7, 8} 38 39 SET IDENTITES Example 40 Example 41 Example 42 Example 43 Example 44 45 46 47 48 49 50 51 52