### Similar presentations

Sets

Sets Sets and Elements A set is a collection of items, referred to as the elements of the set. Visualizing a Set

Sets Quick Examples We usually use a capital letter to name a set and braces to enclose the elements of a set. x  A means that x is an element of the set A. If x is not an element of A, we write x  A. W = {Amazon, eBay, Apple} N = {1, 2, 3, . . .} Amazon  W (W as above) Microsoft  W 2  N

Sets Quick Examples B = A means that A and B have the same elements. The order in which the elements are listed does not matter. B  A means that B is a subset of A; every element of B is also an element of A. {5, –9, 1, 3} = {–9, 1, 3, 5} {1, 2, 3, 4} ≠ {1, 2, 3, 6} {eBay, Apple}  W {1, 2, 3, 4}  {1, 2, 3, 4}

Sets Quick Examples B  A means that B is a proper subset of A: B  A, but B ≠ A. ∅ is the empty set, the set containing no elements. It is a subset of every set. A finite set has finitely many elements. An infinite set does not have finitely many elements. {eBay, Apple}  W {1, 2, 3}  {1, 2, 3, 4} {1, 2, 3}  N (N as above) ∅  W ∅  W W = {Amazon, eBay, Apple} is a finite set. N = {1, 2, 3, . . .} is an infinite set.

Sets One type of set we’ll use often is the set of outcomes of some activity or experiment. For example, if we toss a coin and observe which side faces up, there are two possible outcomes, heads (H) and tails (T). The set of outcomes of tossing a coin once can be written S = {H, T}.

Sets As another example, suppose we roll a die that has faces numbered 1 through 6, as usual, and observe which number faces up. The set of outcomes could be represented as However, we can much more easily write S = {1, 2, 3, 4, 5, 6}.

Example 1 – Two Dice: Distinguishable vs. Indistinguishable
a. Suppose we have two dice that we can distinguish in some way—say, one is green and one is red. If we roll both dice, what is the set of outcomes? b. Describe the set of outcomes if the dice are indistinguishable.

Example 1(a) – Solution A systematic way of laying out the set of outcomes for a distinguishable pair of dice is shown in Figure 1. Figure 1

Example 1(a) – Solution cont’d In the first row all the green dice show a 1, in the second row a 2, in the third row a 3, and so on. Similarly, in the first column all the red dice show a 1, in the second column a 2, and so on. The diagonal pairs (top left to bottom right) show all the “doubles.”

Example 1(a) – Solution cont’d Using the picture as a guide, we can write the set of 36 outcomes as follows. (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6) Distinguishable dice S =

Example 1(a) – Solution cont’d Notice that S is also the set of outcomes if we roll a single die twice, if we take the first number in each pair to be the outcome of the first roll and the second number the outcome of the second roll.

Example 1(b) – Solution cont’d If the dice are truly indistinguishable, we will have no way of knowing which die is which once they are rolled. Think of placing two identical dice in a closed box and then shaking the box. When we look inside afterward, there is no way to tell which die is which. (If we make a small marking on one of the dice or somehow keep track of it as it bounces around, we are distinguishing the dice.) We regard two dice as indistinguishable if we make no attempt to distinguish them.

Example 1(b) – Solution cont’d Thus, for example, the two different outcomes (1,3) and (3,1) from part (a) would represent the same outcome in part (b) (one die shows a 3 and the other a 1). Because the set of outcomes should contain each outcome only once, we can remove (3,1).

Example 1(b) – Solution cont’d Following this approach gives the following smaller set of outcomes: (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (3, 3), (3, 4), (3, 5), (3, 6), (4, 4), (4, 5), (4, 6), (5, 5), (5, 6), (6, 6) Indistinguishable dice S =

Venn Diagrams

Venn Diagrams We can visualize sets and relations between sets using Venn diagrams. In a Venn diagram, we represent a set as a region, often a disk (Figure 2). The elements of A are the points inside the region. Figure 2

Venn Diagrams The following Venn diagrams illustrate the relations.
Venn Diagrams for Set Relations

Example 3 – Customer Interests
NobelBooks.com (a fierce competitor of OHaganBooks.com) maintains a database of customers and the types of books they have purchased. In the company’s database is the set of customers S = {Einstein, Bohr, Millikan, Heisenberg, Schrödinger, Dirac}. A search of the database for customers who have purchased cookbooks yields the subset A = {Einstein, Bohr, Heisenberg, Dirac}.

Example 3 – Customer Interests
cont’d Another search, this time for customers who have purchased mysteries, yields the subset B = {Bohr, Heisenberg, Schrödinger}. NobelBooks.com wants to promote a new combination mystery/cookbook, and wants to target two subsets of customers: those who have purchased either cookbooks or mysteries (or both) and, for additional promotions, those who have purchased both cookbooks and mysteries. Name the customers in each of these subsets.

Example 3 – Solution We can picture the database and the two subsets using the Venn diagram in Figure 3. Figure 3

Example 3 – Solution cont’d The set of customers who have purchased either cookbooks or mysteries (or both) consists of the customers who are in A or B or both: Einstein, Bohr, Heisenberg, Schrödinger, and Dirac. The set of customers who have purchased both cookbooks and mysteries consists of the customers in the overlap of A and B, Bohr and Heisenberg.

Set Operations

Set Operations Set Operations
A  B is the union of A and B, the set of all elements that are either in A or in B (or in both). A  B = {x | x  A or x  B}

Set Operations A  B is the intersection of A and B, the set of all elements that are common to A and B. A  B = {x | x  A and x  B}

Set Operations Logical Equivalents
Union: For an element to be in A  B, it must be in A or in B. Intersection: For an element to be in A  B, it must be in A and in B. Quick Examples If A = {a, b, c, d}, and B = {c, d, e, f } then A  B = {a, b, c, d, e, f } A  B = {c, d}.

Set Operations There is one other operation we use, called the complement of a set A, which, roughly speaking, is the set of things not in A. Complement If S is the universal set and A  S, then A is the complement of A (in S), the set of all elements of S not in A. A = {x  S | x  A} = Green Region Below

Set Operations Logical Equivalent
For an element to be in A, it must be in S but not in A. Quick Example If S = {a, b, c, d, e, f, g} and A = {a, b, c, d} then A = {e, f, g}.

Example 4 – Customer Interests
NobelBooks.com maintains a database of customers and the types of books they have purchased. In the company’s database is the set of customers S = {Einstein, Bohr, Millikan, Heisenberg, Schrödinger, Dirac}. A search of the database for customers who have purchased cookbooks yields the subset A = {Einstein, Bohr, Heisenberg, Dirac}.

Example 4 – Customer Interests
cont’d Another search, this time for customers who have purchased mysteries, yields the subset B = {Bohr, Heisenberg, Schrödinger}. A third search, for customers who had registered with the site but not used their first-time customer discount yields the subset C = {Millikan}.

Example 4 – Customer Interests
cont’d Use set operations to describe the following subsets: a. The subset of customers who have purchased either cookbooks or mysteries b. The subset of customers who have purchased both cookbooks and mysteries c. The subset of customers who have not purchased cookbooks d. The subset of customers who have purchased cookbooks but have not used their first-time customer discount

Example 4 – Solution Figure 4 shows two alternative Venn diagram representations of the database. Although the second version shows C overlapping A and B, the placement of the names inside shows that there are no customers in those overlaps. Figure 4

Example 4 – Solution cont’d a. The subset of customers who have bought either cookbooks or mysteries is A  B = {Einstein, Bohr, Heisenberg, Schrödinger, Dirac}. b. The subset of customers who have bought both cookbooks and mysteries is A  B = {Bohr, Heisenberg}.

Example 4 – Solution cont’d c. The subset of customers who have not bought cookbooks is A = {Millikan, Schrödinger}. Note that, for the universal set, we are using the set S of all customers in the database.

Example 4 – Solution cont’d d. The subset of customers who have bought cookbooks but have not used their first-time purchase discount is the empty set A  C = ∅. When the intersection of two sets is empty, we say that the two sets are disjoint. In a Venn diagram, disjoint sets are drawn as regions that don’t overlap, as in Figure 5. Figure 5

Cartesian Product

Cartesian Product There is one more set operation we need to discuss.
The Cartesian product of two sets, A and B, is the set of all ordered pairs (a, b) with a  A and b  B. A  B = {(a, b) | a  A and b  B} In words, A  B is the set of all ordered pairs whose first component is in A and whose second component is in B.

Cartesian Product Quick Examples
1. If A = {a, b} and B = {1, 2, 3}, then A  B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)}. Visualizing A  B

Cartesian Product 2. If S = {H, T}, then
S  S = {(H, H), (H, T), (T, H), (T, T)}. In other words, if S is the set of outcomes of tossing a coin once, then S  S is the set of outcomes of tossing a coin twice.

Example 5 – Representing Cartesian Products
The manager of an automobile dealership has collected data on the number of pre-owned Acura, Infiniti, Lexus, and Mercedes cars the dealership has from the 2009, 2010, and 2011 model years. In entering this information on a spreadsheet, the manager would like to have each spreadsheet cell represent a particular year and make. Describe this set of cells.

Example 5 – Solution Because each cell represents a year and a make, we can think of the cell as a pair (year, make), as in (2009, Acura). Thus, the set of cells can be thought of as a Cartesian product: Y = {2009, 2010, 2011} M = {Acura, Infiniti, Lexus, Mercedes} Year of car Make of car Cells

Example 5 – Solution cont’d Thus, the manager might arrange the spreadsheet as follows: The highlighting shows the 12 cells to be filled in, representing the numbers of cars of each year and make. For example, in cell B2 should go the number of 2009 Acuras the dealership has.