Discrete-Chapter 01 Sets

728 views
638 views

Published on

1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
728
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
39
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Discrete-Chapter 01 Sets

  1. 1. Sets - 01 CSC1001 Discrete Mathematics 1 CHAPTER เซต 1 (Sets) 1 Introduction to Sets1. 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 andlinked list. Definition 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.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.มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  2. 2. 2 CSC1001 Discrete Mathematics 01 - Sets Another way to describe a set is to use set builder notation. We characterize all those elements in theset by stating the property or properties they must have to be members. For instance, the set O of all oddpositive 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, qis member of odd negative integers, and q is not equal 0.มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  3. 3. Sets - 01 CSC1001 Discrete Mathematics 32. Equality of Sets Because many mathematical statements assert that two differently specified collections of objects are reallythe same set, we need to understand what it means for two sets to be equal. Definition 2 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.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, andis denoted by . The empty set can also be denoted by { }. Often, a set of elements with certain propertiesturns 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 JohnVenn, who introduced their use in 1881. In Venn diagrams the universal set U, which contains all the objectsunder consideration, is represented by a rectangle. (Note that the universal set varies depending on whichobjects 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 toindicate the relationships between sets. We show how a Venn diagram can be used in an example.มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  4. 4. 4 CSC1001 Discrete Mathematics 01 - SetsExample of Venn diagrams U U 1 1 11 11 2 6 10 2 6 10 4 Or 4 3 7 9 3 7 9 5 8 5 8 Figure: Venn Diagram of Set {1, 2, 3, … , 11}Example 15 (2 points) Draw a Venn diagram that Example 16 (2 points) Draw a Venn diagram thatrepresents V, the set of vowels in the English represents Z, the set of odd positive integers lessalphabet. than 10.4. Subsets It is common to encounter situations where the elements of one set are also the elements of a secondset. We now introduce some terminology and notation to express such relationships between sets. Definition 3 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. We see that A  B if and only if the quantification  x(x  A  x  B) is true. Note that to show that Ais not a subset of B we need only find one element x  A with x  B. Such an x is a counterexample to theclaim that x  A implies x  B. We have these useful rules for determining whether one set is a subset ofanother:  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.มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  5. 5. Sets - 01 CSC1001 Discrete Mathematics 5 Theorem 1 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. Figure Venn Diagram Showing that A Is a Subset of BExample 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 102) The set of rational numbers is a subset of the set of real numbers3) The set of natural number (counting number) is a subset of positive integers4) 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 school6) The set of all computer science majors at your school is a subset of the set of all students at your school7) 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 integers9) 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 school10) 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 schoolExample 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?มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  6. 6. 6 CSC1001 Discrete Mathematics 01 - Sets5. Size of Set (Cardinality of Set) Definition 4 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|Example 19 (5 points) Find a cardinality of set1) 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 Definition 5 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)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 {{ }}มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  7. 7. Sets - 01 CSC1001 Discrete Mathematics 7 Definition 6 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.Example 25 (5 points) Find an element of power set1) 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 Definition 7 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 8 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}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}มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  8. 8. 8 CSC1001 Discrete Mathematics 01 - Sets Definition 9 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}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} 2 Set Operations1. Operations of Sets Two, or more, sets can be combined in many different ways. For example, union of the sets, intersectionof the sets, difference of the sets and complement of the set Definition 1 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. Figure: Venn Diagram of the Union of A and Bมหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  9. 9. Sets - 01 CSC1001 Discrete Mathematics 9Example 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} Definition 2 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. Figure: Venn Diagram of the Intersection of A and BExample 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} Theorem 1 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|Example 37 (2 points) Let A = {-1, 1, 11, 21, 31} and B = {-2, 0, 2, 10, 12, 22, 32}. Find |A  B|มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  10. 10. 10 CSC1001 Discrete Mathematics 01 - Sets Definition 3 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. Figure: Venn Diagram for the Difference of A and BExample 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} Definition 4 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. Figure: Venn Diagram for the Complement of the set AExample 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มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  11. 11. Sets - 01 CSC1001 Discrete Mathematics 11Example 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 setof all positive integers. Find the complement of the set A.2. Appying Set OperationsExample 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 sets1) ( A  B)  (C  D)2) AC  B3) A  (B  C)  D4) A B C  D5) A  ( B  D)  Cมหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  12. 12. 12 CSC1001 Discrete Mathematics 01 - Sets3. Set Identities Identity Name / Laws A  U = A Identity laws Identity laws A =A A  U=U Domination laws A = A  A=A Idempotent laws A  A=A ( A) = A Complementation laws A  B=B  A Commutative laws A  B=B  A A  (B  C) = (A  B)  C Associative laws A  (B  C) = (A  B)  C A  (B  C) = (A  B)  (A  C) Distributive laws A  (B  C) = (A  B)  (A  C) A B=A  B De Morgan’s laws A B=A  B A  (A  B) = A Absorption laws A  (A  B) = A A  A=U Complement laws A  A=Example 44 (10 points) Let A, B, and C be sets. Prove that B  A  A BExample 45 (10 points) Let A, B, and C be sets. Prove that A  ( B  A)  C  A  Cมหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  13. 13. Sets - 01 CSC1001 Discrete Mathematics 13Example 46 (10 points) Let A, B, and C be sets. Prove that ( A  B)  ( A  C )  (C  B )  AExample 47 (10 points) Let A, B, and C be sets. Prove that ( A  B)  C  (C  A)  BExample 48 (10 points) Let A, B, and C be sets. Prove that A  ( B  C )  (C  B )  AExample 49 (10 points) Let A, B, and C be sets. Prove that ( B  A)  (C  A)  A  ( B  C )มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี

×