2.1 Sets and Set Operations Sets A set is a collection of objects or things. The objects or things in the set are called elements (or members). Examples The set of students registered in this class. The set of all months beginning with J. Set Notation “roster notation” “set-building notation” Sets are given capital letters. Often, a letter is used to help us remember what it contains. A set is described by the assigned letter and a list of or a description of the objects is contains inside brackets: {}. S={the set of students in this class} J={the set of months beginning with J}={January, June, July} Equal Sets Two sets are equal if they contain the same elements. The order of the elements doesn’t matter. J={June, July, January}={January, June, July} Also two sets are equal if the element is repeated: {January, June, July, January} = {January, June, July} The size of a set is the number of different elements it contains. The size of S is 35 (35 registered students) and the size of J is 3. Because of this definition, each different element should be listed only once. J={Jan, June, Jan, July} has 3 elements. We say that the size of a set is its cardinal number. The cardinal number of J is 3. The notation for the size is n(J)=3. Comparing Different Sets Consider two sets. An element that is a member of one set may also be the member of the other set. (So both sets contain that element.) The overlap of two sets A and B is called the intersection of the two sets. The symbol is . Consider two sets. It is possible to make a larger set by combining them. The combination of two sets is called the union of the two sets. The symbol is . Example J={months that begin with J}={January, June, July} Y={months that end in y}={January, February, May, July} What is the intersection of the set J and the set Y? JY={January, July} What is the union of the set J and the set Y? JY = {January, June, July, January, February, May, July} = {January, June, July, February, May} Set J Y JY JY Cardinality 3 4 2 5 smaller than both J and Y! larger than both J and Y! The intersection and the union of two sets are also sets themselves! The intersection of two sets tends to be smaller than the two sets (though not always) and the union of two sets tends to be bigger than the two sets (though not always). Class Exercise (1) Write down the set of letters in your first name. (2) With another classmate, find the intersection of your sets. What is the cardinality of the intersection? (3) Find the union of your sets. What is the cardinality of the union? (4) Find a word that only uses letters from the union of the set of letters in your name and the set of letters of the other student. Repeated letters allowed! Bonus point for the longest word. Using this exercise, we can verify the Cardinal Number Formula. Write down: cardinality of your set cardinality of the other student’s set cardinality of the intersection of the two sets cardinality of the union of the two sets + + =? Check that: the last = the first + the second – the third Cardinal Number Formula for the union of sets n(AB)=n(A)+n(B)-n(AB) Example: S={S, A, M} (the letters in Sam’s name) J={J,O,H,N} (the letters in John’s name) SJ={S,A,M,J,O,H,N} SJ={} An empty set! A set that has no elements is called the empty set and is denoted by {} (a set with nothing inside it) or by . Notice that n()=0. If two sets have no overlap (if SJ=) we say that they are mutually exclusive. Subsets If every element of a set B is also a member of a set A, then B is a subset of A. This is written as BA. Example: S={S A M} C={S M} V={A} C is a subset of S. V is a subset of S. CS VS Proper and Improper Subsets Technically, S is a subset of S! The reason for this is that every element of S also belongs to S. So S is a subset of S just by applying the definition. (Really, S=S.) To distinguish this case from the others, we call S an improper subset of S. If a subset of B is smaller than A, we call it a proper subset and can use the special notation BA. BA means BA or B=A. BA proper subset B=A improper subset A=B IFF BA and AB. Example: List all subsets of S={S A M}. {S} {A} {M} {S A} {S M} {A M} {S A M} {} Universal Sets and the Complement The universal set U is the set of all elements that are considered for membership in a set for a particular problem. Example 1: Your name is Ralph. I tell you that A is the set of letters in your name. The universal set in this case is the set of all letters. A={R A L P H} U={A through Z} Example 2: J={months beginning with J}. The universal set is the set of all 12 months. The set of all elements that are not in the set (but still in the universal set) is called the complement of the set. It is denoted by A'. Example 1: Let A={R A L P H}. Since U is the set of all letters, the complement of A is A'={BCDEFGIJKMNOQSTUVWXYZ}. How many letters are in A'? Since there are 26 letters and A only contains 5 letters, we know that A' must contain 21 letters. Cardinal Number Formula For the Complement of a Set n(A')=n(U)-n(A) More Symbols!!! Symbol | Meaning Such that Belongs to Does not belong to For all uniquely There exists If Implies / Only If IFF Shading Venn Diagrams Separate the problem into two components connected by “” or “”. Shade one component with horizontal lines. Shade one component with vertical lines. The area with both lines is the intersection. The areas with any kind of line is in the union. Example 1: A B Example 2: A B Example 3: Bc Ac