 Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built.

Presentation on theme: "Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built."— Presentation transcript:

Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built out of sets. We have been using sets on an informal basis when we talked about universes of discourse. We will now define what a set is and start working with sets more formally.

Def: A set is an unordered collection of objects. We use the notation {ob 1, ob 2, … } to denote a set where the ob i are the objects in the set. Ex: {a, -1, Finland, fork} is a set. The objects in this set are the letter a, the integer -1, the country Finland, and the utensil fork. Ex: {1, 2} is a set. The objects in this set the first 2 positive integers. Ex: V = {a, e, i, o, u} is a set. The objects in V are the vowels. Ex: The set of all odd positive integers less than 10 is {1, 3, 5, 7, 9} Ex: The set of all positive integers is Z + = {1, 2, 3,...} Ex: The set of all positive integers less than 100 is {1, 2, …, 99} Def: The objects in a set are called the elements or members of the set. We say that a set contains its elements.

Note that we never attempted to define what an object is. We never placed any restrictions on what can be in a set. So a set could perhaps contain another set. Ex: {1, {2}, 3, {4}} is a set. The objects in this set are the integer 1, the set containing the integer 2, the integer 3, and the set containing 4. Ex: What are the members of the set { {1}, {{1}, {2}} }? The members of this set are the set containing 1, and the set containing the set containing 1 and the set containing 2. That a set is defined in such general terms can cause problems. It leads to various logical paradoxes such as Russell’s Paradox. For this reason, this is called Naïve Set Theory.

Some useful sets The Set of Natural Numbers: N = {0, 1, 2, …} –Note that there is some debate on 0. The Set of Integers: Z = {…, -2, -1, 0, 1, 2, …} The Set of Positive Integers: Z + = {1, 2, 3, …} The Set of Rational Numbers: Q = {p/q | p and q are integers and q  0} The Set of Real Numbers: R

Def: Two sets are equal if and only if they have the same elements. Ex: The sets {1, 3, 5} and {5, 1, 3} are equal since they have the same elements. Due to the definition of equal, it also does not matter if an element is repeated in a set. Ex: The sets {1, 3, 5} and {1, 1, 3, 3, 5, 5, 5} are equal since they have the same elements 1, 3, and 5. So order doesn’t matter and repetition doesn’t matter. An element is a member of a set if it is listed in the set. Ex: The sets {1, 2, 5, 4, 3} and {5, 1, 3, 2, 4} are equal since they have the same elements.

We often specify a set using set builder notation instead of listing the elements in the set. Ex: The set of positive integers less than 10 can be specified as {x  Z | x > 0  x < 10} instead of {1, 2, 3, 4, 5, 6, 7, 8, 9}. We use the symbol  to indicate set membership. If x is a member of the set A, we say x  A. On the other hand, if x is not a member of A, we say x  A. An element x is either a member of a set or not. Ex:5  Z1.6  Z1  {1, 2} 3  {1, 2} 1  {{1, 2}, {3, 4}}{1, 2}  {{1, 2}, {3, 4}} We can use set builder notation to restrict the members of a set. Ex: {x  Z | x > 5} = { 6, 7, 8, 9, …}

Ex: What are the members of {x  Z | x = x + 1}? There are no members! So {x  Z | x = x + 1} = {}. This is called the empty set. We also use the symbol  to denote the empty set. The empty set has no members. We can denote it as {} or . Think of  as just a symbolic abbreviation for {}. {  } does not denote the empty set! What does it denote? {  } is the set containing the empty set. This is very different from the empty set. {  } = {{}}. This set has one member, namely the empty set. The empty set , however, has no members. {  }  

Def: The set A is called a subset of the set B if and only if every element of A is also an element of B. We use the notation A  B to indicate that A is a subset of B. Restated: A  B iff  x( x  A  x  B ) Ex: {1, 3, 5}  {1, 2, 3, 4, 5} since every element in the first set is also a member of the second set. Ex: {6, 2, 4}  {4, 6, 2}. [In fact the two sets are equal.] Ex: N  Z. Note that two sets A and B are equal if and only if A  B and B  A. That is, when every member of A is also a member of B and when every member of B is also a member of A, then A and B have the same members. This is a very important technique that we use to prove that two sets are equal: show A  B and show B  A.

Theorem: For any set S, (I)   Sand(II) S  S Proof: Let S be a set. [State our assumptions.] (proof of (I)) We wish to show that   S. By using the definition of subset, what we must show is that every member of  is also a member of S. That is, we wish to show  x( x    x  S). [How?] [Vacuous Proof] Since  has no members, then x   is always false. So the implication x    x  S is always true no matter what x is. So   S. (proof of (II)) We wish to show that S  S. By using the definition of subset, what we must show is that every member of S is also a member of S. [Direct Proof] So let x  S. Then it follows that x  S! So S  S. 

Def: The set A is called a proper subset of the set B if A  B and A  B. We use the notation A  B to indicate that A is a proper subset of B. Note that this usage (like the usage of N) differs from text to text. Some texts, for historical reasons, use A  B to indicate A is a subset of B and they have not special notation to indicate that A is a proper subset of B. Ex: {1, 3, 5}  {1, 2, 3, 4, 5} since every element in the first set is also a member of the second set but the sets are not equal. Ex: {6, 2, 4}  {4, 6, 2} because these sets are equal. But it is a subset. Ex: N  Z. Of course, if A  B then it follows that A  B as well. But the converse does not hold. Ex: {1, 2}  {1, 2, 3, 4} Ex: {1, 2}  {{1, 2}, {3, 4}}{1, 2}  {{1, 2}, {3, 4}} or {{1, 2}}  {{1, 2}, {3, 4}}

Def: Let S be a set. If there are exactly n distinct elements in S where n is a nonnegative integer, we say that S is a finite set and that the cardinality of S is n. The cardinality of S is denoted |S|. A set that is not finite is said to be an infinite set. Ex: Let S be the set of odd positive integers less than 10. So S = {1, 3, 5, 7, 9}. S is a finite set with cardinality 5. That is |S| = 5. Ex: Let L be the set of letters in the English alphabet. Then |L| = 26. Ex: |  | = 0. Note that  is the only set with cardinality 0. Ex: The set of integer, Z, is infinite. Ex: The set of real numbers, R, is infinite. Ex: |{  }| = 1. Remember that this is not the empty set! Ex: |{{1, 2, 3}, {4}}| = 2. It contains 2 sets! Ex: |{Z}| = 1. [{Z} = {{1, 2, 3, … }}]. Care with notation is crucial!

Def: Let S be a set. The power set of S is the set of all subsets of S. The power set of S is denoted P(S). That is P(S) = {X | X  S}. Ex: Let S = {1, 2}. Then P(S) = { , {1}, {2}, {1, 2}}. Ex: Let S = {a}. Then P(S) = { , {a}}. Ex: If S = {Joe, John, James}, then P(S) = { , {Joe}, {John}, {James}, {Joe, John}, {Joe, James}, {John, James}, {Joe, John, James}}. Ex: Let S = . Then P(S) = {  }. Ex: Let S be a finite set with cardinality n. Can you guess |P(S)|? Note that due to our previous theorem, it seems that P(S) has at least two elements in it regardless of S. [Which two?] [But this is not quite true] |P(S)| = 2 n. This can be shown in a number of different ways. [bit]

The order of elements in a collection is sometimes important. Recall that sets are unordered collections. If we care about ordered collections we will need to introduce a different discrete structure. For this purpose, we introduce ordered n-tuples. Def: The ordered n-tuple (a 1, a 2, …, a n ) is the ordered collection that has a 1 as its first element, a 2 as its second element, …, and a n as its nth element. Two ordered n-tuples are equal if and only if their first elements are equal, their second elements are equal, …, and their nth elements are equal. Ex: (1, 5, 7) and (2, 5, 7) are two ordered 3-tuples. These ordered 3-tuples are not equal since their first elements differ. Ex: (2, 4) and (4, 2) are two ordered 2-tuples. Ordered 2-tuples are called ordered pairs. These ordered pairs are not equal since their first and second elements differ.

Def: Let A and B be sets. The Cartesian product of A and B, denoted by A  B is the set of all ordered pairs (a, b) where a  A and b  B. That is: A  B = {(a, b) | a  A  b  B}. Ex: What is the Cartesian product of A = {1, 2} and B = {a, b, c}? A  B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)} Def: The Cartesian product of the sets A 1, A 2, …, A n, denoted by A 1  A 2  …  A n, is the set of all ordered n-tuples (a 1, a 2,... a n ), where a i  A i for i = 1, 2, …, n. That is: A 1  A 2  …  A n = {(a 1, a 2,... a n ) | a i  A i for i = 1, 2, …, n}. Ex: The Cartesian product of A = {1, 2}, B = {a, b}, and C = {b, c} is {(1, a, b), (1, a, c), (1, b, b), (1, b, c), (2, a, b), (2, a, c), (2, b, b), (2, b, c)}

Homework problems from Section 1.6 Problems 1, 4, 5, 6, 7, 11, 13, 14, 15, 19, and 22 from section 1.6 are included on homework 4.

Download ppt "Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built."

Similar presentations