Discrete-Chapter 01 Sets

13
1 มหาวิทยาลัยราชภัฏสวนสุนันทา (ภาคการศึกษาที2/2555) เรียบเรียงโดย .วงศ์ยศ เกิดศรี CSC1001 Discrete Mathematics Sets - 01 1. Definition of Sets Sets are used to group objects together. Often, but not always, the objects in a set have similar properties . In computer science , sets are basic data structures which are represented by one dimensional array and linked list . 1) Sets symbol Sets are denoted by using uppercase letters for example A, B, C, D. Elements of sets are denoted by using lowercase letters for example a, b, c, d or 1, 2, 3, 4. Groups of sets are denoted by using bracket "{" and "}" , for example { … }, { … }. Each elements of sets is separated by using comma "," , for example { 1, 2, 3, 4 } … . 2) Example of sets A = { 1, 2, 3, 4 } or B = { a, b, c, d, e } Example 1 (2 points) Write set V which is represented all vowels in the English alphabet. Example 2 (2 points) Write set O which is represented odd positive integers less than 10. Example 3 (2 points) Write set E which is represented even negative integers greater than -10. Example 4 (2 points) Write set Z which is represented positive integers less than or equal 100. CHAPTER 1 เซต (Sets) Introduction to Sets 1 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. Definition 1

Transcript of Discrete-Chapter 01 Sets

Page 1: Discrete-Chapter 01 Sets

1

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Sets - 01

1. Definition of Sets

Sets are used to group objects together. Often, but not always, the objects in a set have similar properties. In computer science, sets are basic data structures which are represented by one dimensional array and linked list. 1) Sets symbol Sets are denoted by using uppercase letters for example A, B, C, D. Elements of sets are denoted by using lowercase letters for example a, b, c, d or 1, 2, 3, 4. Groups of sets are denoted by using bracket "{" and "}", for example { … }, { … }. Each elements of sets is separated by using comma ",", for example { 1, 2, 3, 4 } … .

2) Example of sets A = { 1, 2, 3, 4 } or B = { a, b, c, d, e }

Example 1 (2 points) Write set V which is represented all vowels in the English alphabet.

Example 2 (2 points) Write set O which is represented odd positive integers less than 10.

Example 3 (2 points) Write set E which is represented even negative integers greater than -10.

Example 4 (2 points) Write set Z which is represented positive integers less than or equal 100.

CHAPTER

1

เซต

(Sets)

Introduction to Sets 1

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.

Definition 1

Page 2: Discrete-Chapter 01 Sets

2

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 01 - Sets

Another way to describe a set is to use set builder notation. We characterize all those elements in the set by stating the property or properties they must have to be members. For instance, the set O of all odd positive integers less than 10 can be written as O = { x | x is an odd positive integer less than 10 }

or, specifying the universe as the set of positive integers, as O = { x Z+ | x is odd and x < 10 }

(In computer science we can donated by O = { x Z+ | x % 2 = 0 and x < 10 }) These sets, each denoted using a boldface letter, play an important role in discrete mathematics: N = { 0, 1, 2, 3, … }, the set of natural numbers (counting number) Z = { …, -2, -1, 0, 1, 2, … }, the set of integers Z+ = { 1, 2, 3, … }, the set of positive integers Z- = { -1, -2, -3, … }, the set of negative integers Q = { p/q | p Z, q Z, and q 0 }, the set of rational numbers R, the set of real numbers R+, the set of positive real numbers R-, the set of negative real numbers C, the set of complex numbers.

Example 5 (2 points) Write set A which is represented complex numbers.

Example 6 (2 points) Write set B which is represented negative real numbers but not equal -50.0.

Example 7 (2 points) Write set C which is represented positive integers less than or equal 1000.

Example 8 (2 points) Write set D which is represented even negative integers greater than -50.

Example 9 (2 points) Write set E which is represented rational numbers p/q, p is member of real numbers, q is member of odd negative integers, and q is not equal 0.

Page 3: Discrete-Chapter 01 Sets

3

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Sets - 01

2. Equality of Sets

Because many mathematical statements assert that two differently specified collections of objects are really the same set, we need to understand what it means for two sets to be equal.

Example 10 (2 points) The sets {1, 3, 5} and {3, 5, 1} are equal or not equal, why?

Example 11 (2 points) The sets {1, 3, 3, 3, 5, 5, 5, 5} and {1, 3, 5} are equal or not equal, why?

Example 12 (2 points) The sets {1, 3, 5, 7} and {7, 5, 3, 3} are equal or not equal, why?

The empty set There is a special set that has no elements. This set is called the empty set, or null set, and is denoted by . The empty set can also be denoted by { }. Often, a set of elements with certain properties turns out to be the null set.

Example 13 (2 points) Write set A which is represented negative integers greater than 0.

Example 14 (2 points) How many members are there in set A form Example 13?

3. Venn Diagrams

Sets can be represented graphically using Venn diagrams, named after the English mathematician John Venn, who introduced their use in 1881. In Venn diagrams the universal set U, which contains all the objects under consideration, is represented by a rectangle. (Note that the universal set varies depending on which objects are of interest.) Inside this rectangle, circles or other geometrical figures are used to represent sets. Sometimes points are used to represent the particular elements of the set. Venn diagrams are often used to indicate the relationships between sets. We show how a Venn diagram can be used in an example.

Two sets are equal if and only if they have the same elements. Therefore, if A and B are sets, then A and B are equal if and only if x (x A x B). We write A = B if A and B are equal sets.

Definition 2

Page 4: Discrete-Chapter 01 Sets

4

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 01 - Sets

Example of Venn diagrams

Figure: Venn Diagram of Set {1, 2, 3, … , 11}

Example 15 (2 points) Draw a Venn diagram that represents V, the set of vowels in the English alphabet.

Example 16 (2 points) Draw a Venn diagram that represents Z, the set of odd positive integers less than 10.

4. Subsets

It is common to encounter situations where the elements of one set are also the elements of a second set. We now introduce some terminology and notation to express such relationships between sets.

We see that A B if and only if the quantification x(x A x B) is true. Note that to show that A is not a subset of B we need only find one element x A with x B. Such an x is a counterexample to the claim that x A implies x B. We have these useful rules for determining whether one set is a subset of another: Showing that A is a Subset of B To show that A B, show that if x belongs to A then x also

belongs to B. Showing that A is Not a Subset of B To show that A B, find a single x A such that x B.

The set A is a subset of 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 the set B.

Definition 3

U

2

3

1

4

5

6

7 8

9

10 11

U

2

3

1

4

5

6

7 8

9

10 11

Or

Page 5: Discrete-Chapter 01 Sets

5

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Sets - 01

Figure Venn Diagram Showing that A Is a Subset of B

Example 17 (10 points) Is it true () or false ()? 1) The set of all odd positive integers less than 10 is a subset of the set of all positive integers less

than 10 2) The set of rational numbers is a subset of the set of real numbers 3) The set of natural number (counting number) is a subset of positive integers 4) The set of positive integers is a subset of natural number (counting number) 5) The set of all student in computer science majors at your school is a subset of the set of all

students in mathematics major at your school 6) The set of all computer science majors at your school is a subset of the set of all students at

your school 7) The set of all people in China is a subset of the set of all people in China (it is a subset of itself) 8) The set of positive integers less than 100 is not a subset of the set of negative integers 9) The set of people who have taken calculus course at your school is not a subset of the set of all

computer science majors at your school 10) The set of students who got “A” in discrete mathematics at your school is a subset of students

who got “A” in calculus at your school

Example 17 (2 points) Let A be a set of {1, 2, 3} find all subset of A? Example 18 (2 points) Let B be a set of {0, {1}, {1,2}} find all subset of B?

Every nonempty set S is guaranteed to have at least two subsets, the empty set and the set S itself, that is, S and S S.

Theorem 1

Page 6: Discrete-Chapter 01 Sets

6

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 01 - Sets

5. Size of Set (Cardinality of Set)

Example 19 (5 points) Find a cardinality of set 1) Let A be the set of odd positive integers less than 10. ……………………...……………………………………… 2) Let B be the set of letters in the English alphabet. …………………………..……………………………………… 3) Let C be the empty set. ………………………………………………………….……………………………………… 4) Let D = {x | x Z+ and x < 1000}. ……………………………………………..……………………………………… 5) Let E = {x | x R, x 1 and x 2}. ……………………………………..….………………………………………

6. Power Sets

Example 20 (2 points) Find the power set of the set {0, 1, 2}

Example 21 (2 points) Find the power set of the set {-3, -1, 1, 3}

Example 22 (2 points) Find the power set of the set {{0}, {1}}

Example 23 (2 points) Find the power set of the empty set or { }

Example 24 (2 points) Find the power set of the set of empty set or {{ }}

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 n is the cardinality of S. The cardinality of S is denoted by |S|

Definition 4

Given a set S, the power set of S is the set of all subsets of the set S. The power set of S is denoted by P(S). (Note that empty set is a subset of any set)

Definition 5

Page 7: Discrete-Chapter 01 Sets

7

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Sets - 01

Example 25 (5 points) Find an element of power set 1) Let A be the set of {0, 1, 2}. …………………………………………………..………………………………………… 2) Let B be the empty set. …………………………………………………………………………………………………. 3) Let C be the set of odd positive integers less than 10. ………………….…..……………………………………… 4) Let D be the set of positive integers less than or equals 10. ………………………………………………………. 5) Let E be the set of {0, 1, { }, {1}, {2}, {1,2}, {1,2,3}}. …………………………………………………………………

7. Cartesian Products

Example 26 (2 points) Find the Cartesian product of A B if given A = {1, 2} and B = {a, b, c} Example 27 (2 points) Find the Cartesian product of B A if given A = {1, 2} and B = {a, b, c} Example 28 (2 points) Find the Cartesian product of A B if given A = {1, 2, 3} and B = {4, 5, 6} Example 29 (2 points) Find the Cartesian product of A B if given A = {0, 2, 4, 8} and B = {-1, -2, -3}

If a set has n elements, then its power set has 2n elements. We will demonstrate this fact in several ways in subsequent sections of the text.

Definition 6

The ordered n-tuple, which represented by (a1, a2, . . . , an), is the ordered collection that has a1 as its first element, a2 as its second element, . . . , and an as its nth element.

Definition 7

Let A and B be sets. The Cartesian product of A and B, denoted by A B, is the set of all ordered pairs or ordered 2-tuple (a, b), where a A and b B. Hence, A B = {(a, b) | a A b B}

Definition 8

Page 8: Discrete-Chapter 01 Sets

8

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 01 - Sets

Example 30 (2 points) Find the Cartesian product of A3 if given A = {1, 2} Example 31 (2 points) Find the Cartesian product of A2 B if given A = {2, 4, 8} and B = {a, b} Example 32 (2 points) Find the Cartesian product of A B C if given A = {0, 1}, B = {1, 0} and C = {1, 1}

1. Operations of Sets

Two, or more, sets can be combined in many different ways. For example, union of the sets, intersection of the sets, difference of the sets and complement of the set

Figure: Venn Diagram of the Union of A and B

The Cartesian product of the sets A1, A2, … , An, denoted by A1 A2 … An, is the set of ordered n-tuples (a1, a2, … , an), where ai belongs to Ai for i = 1, 2, … , n. In other words, An = A1 A2 … An = {( a1, a2, … , an) | ai Ai for i = 1, 2, … , n}

Definition 9

Set Operations 2

Let A and B be sets. The union of the sets A and B, denoted by A B, is the set that contains those ele-ments that are either in A or in B, or in both.

Definition 1

Page 9: Discrete-Chapter 01 Sets

9

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Sets - 01

Example 33 (2 points) Find the union of the sets {1, 3, 5} and {1, 2, 3} Example 34 (2 points) Find the union of the sets {a, b, c, d, e, f} and {a, c, e, g, h, k, m, n}

Figure: Venn Diagram of the Intersection of A and B

Example 35 (2 points) Find the intersection of the sets {1, 3, 5} and {1, 2, 3} Example 36 (2 points) Find the intersection of the sets {a, b, c, d, e, f} and {a, c, e, g, h, k, m, n}

Example 37 (2 points) Let A = {-1, 1, 11, 21, 31} and B = {-2, 0, 2, 10, 12, 22, 32}. Find |A B|

Let A and B be sets. The intersection of the sets A and B, denoted by A B, is the set containing those elements in both A and B.

Definition 2

Two sets are called disjoint if their intersection is the empty set. Let A = {1, 3, 5, 7, 9} and B = {2, 4, 6, 8, 10}. Because A B = , A and B are disjoint. When A and B are disjoint set, the result of |A B| = |A| + |B|

Theorem 1

Page 10: Discrete-Chapter 01 Sets

10

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 01 - Sets

Figure: Venn Diagram for the Difference of A and B

Example 38 (2 points) Find the difference of the sets {1, 3, 5} and {1, 2, 3} Example 39 (2 points) Find the difference of the sets {a, b, c, d, e, f} and {a, c, e, g, h, k, m, n}

Figure: Venn Diagram for the Complement of the set A

Example 40 (2 points) Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} and A = {1, 3, 5, 7, 9, 11, 13}. Find the complement of the set A

Let A and B be sets. The difference of A and B, denoted by A – B, is the set containing those elements that are in A but not in B. The difference of A and B is also called the complement of B with respect to A.

Definition 3

Let U be the universal set. The complement of the set A, denoted by A , is the complement of A with respect to U. Therefore, the complement of the set A is U – A.

Definition 4

Page 11: Discrete-Chapter 01 Sets

11

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Sets - 01

Example 41 (2 points) Let A = {a, e, i, o, u}, where the universal set is the set of letters of the English alpha-bet. Find the complement of the set A. Example 42 (2 points) Let A be the set of positive integers greater than 10, which is the universal set the set of all positive integers. Find the complement of the set A.

2. Appying Set Operations

Example 43 (15 points) Let U = {Z}, A = {1, 3, 5, 7, 9, 11, 13, 15, 17}, B = {-2, -1, 0, 1, 2, 3, 4}, C = {-4, 0, 4} and D = {2, 6, 10, 14, 18, 22, 26, 30, 34, 38}, find the operation of the sets 1) )()( DCBA

2) BCA

3) DCBA )(

4) DCBA

5) CDBA )(

Page 12: Discrete-Chapter 01 Sets

12

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 01 - Sets

3. Set Identities

Identity Name / Laws A U = A Identity laws A = A

Identity laws

A U = U A =

Domination laws

A A = A A A = A

Idempotent laws

)(A = A Complementation laws A B = B A A B = B A

Commutative laws

A (B C) = (A B) C A (B C) = (A B) C

Associative laws

A (B C) = (A B) (A C) A (B C) = (A B) (A C)

Distributive laws

BA = A B BA = A B

De Morgan’s laws

A (A B) = A A (A B) = A

Absorption laws

A A = U A A =

Complement laws

Example 44 (10 points) Let A, B, and C be sets. Prove that BAAB Example 45 (10 points) Let A, B, and C be sets. Prove that CACABA )(

Page 13: Discrete-Chapter 01 Sets

13

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Sets - 01

Example 46 (10 points) Let A, B, and C be sets. Prove that ABCCABA )()()( Example 47 (10 points) Let A, B, and C be sets. Prove that BACCBA )()( Example 48 (10 points) Let A, B, and C be sets. Prove that ABCCBA )()(

Example 49 (10 points) Let A, B, and C be sets. Prove that )()()( CBAACAB