Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

DM 5 Sets

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

1

Sets
Course Code: CSC 1204 Course Title: Discrete Mathematics

Dept. of Computer Science


Faculty of Science and Technology

Lecturer No: 7 Week No: 4 Semester:


Lecturer: Name & email
2

Lecture Outline

2.1 Sets
• Definition of Set
• Representation of a Set
• Different Types of Sets
• Standard Numerical Sets
• -Notation
• Venn diagram
• Equal Set, Subset, Proper Subset, Cardinality of a Set, Super
Set, Power Set, Ordered n-tuples, Cartesian Product of Sets
4

Sets

• Definition1: A set is an unordered collection of objects.


• Definition2: Objects in a set are called elements, or
members of the set. A Set is said to contain its
elements.
• Capital letters (e.g. A, B, C, O, N) are ordinarily used to
denote sets and lowercase letters (e.g., a, b, c, e) are
used to denote elements of a sets.
• Elements of a Set may NOT be the same type always!
5

Sets

 A set is defined only by the elements which it


contains. Thus, repeating an element, or changing the
ordering of elements in the description of the set,
does NOT change the set itself.
• A = {1, 2, 4} = { 1, 1, 1, 2, 2, 4, 4, 4, 4} = {2, 4,1}

 Sets can have other sets as member.


• B = { a, {a, b}, {{x}}, y }
6

Representation of a Set

Basically, there are two ways of representing a set:


1) List notation/form: All elements of the set are listed, the
elements being separated by commas(,) and are enclosed by
curly braces “{“ and “}”
Example: B = { a, e, i, o, u}
A = { 2, 4, 6, 8}
2) Set builder notation/form, or, Rule method, : A set is defined
by specifying a property that elements of the set have in
common.
Example: B = { x| x is a vowel in the English alphabets}
A = { x| x is an even integer between 1 and 8}
7

Different Types of Sets


• Empty set/ Null set: A set with no member is called empty/null set. Empty set
is denoted by . Empty set is also denoted by { }.
Examples: B = { }, A = { x is a multiple of 4 | x is odd }
Note:   {}
• Singleton set: A set with one element is called a singleton set.
Examples: B = {4} , S = {a}
• Finite set : A set with finite number of elements in it, is called a finite set.
Example: A = { 1, 3, 4,77}
• Infinite set : An infinite set is a set which contains infinite number of
elements.
Examples: N = { 0, 1, 2, 3, ……….}
B = { 1, 1/3, 1/9, 1/27, ………..}
8

Some Examples of Sets

 {1, 2, 3} is the set containing elements “1” and “2” and “3.”
 {1, 1, 2, 3, 3} = {1, 2, 3} since repetition is irrelevant.
 {1, 2, 3} = {3, 2, 1} since sets are unordered (order of elements
does NOT matter)
 {0,1, 2, 3, …} is a way we denote an infinite set (in this case, the
natural numbers).
  = {} is the empty set, or the set containing no elements.
 A = { a, 2, Fred, New York } ==> Although elements are usually
same type, but they may be of different types
9

Sets: More examples

• Example 1 : The set V of all vowels in the English


alphabet cab be written as V = { a, e, i, o, u }.

• Example 2: The set O of odd positive integers less than


10 can be denoted by { 1, 3, 5, 7, 9 }.

• Example 4 : The set of positive integers less than 100


can be denoted by { 1, 2, 3, ………..,99 }.
10

Standard Numerical Sets

N = {0, 1, 2, 3, …}, natural numbers


Z = {…,-2, -1, 0, 1, 2, …}, integers
Z+ = {1, 2, 3, …}, positive integers
Q = {p/q|pZ, qZ, and q0}, rational numbers
R = real numbers
• The real numbers: R ==> contains any decimal number of
arbitrary precision
• The rational numbers: Q ==> these are decimal numbers whose
decimal expansion repeats
Standard Numerical Sets
Standard Numerical Sets
13

-Notation

• The Greek letter “” (epsilon) is used to denote that an object is an element of
a set. When crossed out “” denotes that the object is not an element.”
Example: 3  S reads: “3 is an element of the set S ”.
3  S reads: “3 is not an element of the set S ”.
• Q: Which of the following are true:
1. 3  R
2. -3  N
3. -3  R
4. 0  Z+
5.  x, xR  x2 = - 5
14

-Notation

Answers:
1. 3  R. True: 3 is a real number.
2. 3  N. False: natural numbers don’t contain
negatives.
3. 3  R. True: 3 is a real number.
4. 0  Z+. True: 0 is NOT a positive integer.
5. x xR  x2 = 5 . False: square of a real number is
non-negative, so can’t be 5.
15

Venn diagram
• Sets can be represented graphically using Venn diagrams.
• In Venn diagrams, the universal set U, which contains all the
objects under consideration, is represented by a rectangle.
Note: the universal set varies depending on which objects are of interest
• Inside the 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.
16

FIGURE 1
Venn Diagram for the Set of Vowels
17

Equal Set

• Definition 3: Two sets are equal if and only if they have


the same elements.
A = B iff x(x  A  x  B)
• Two sets A and B are said to be equal if and only if
every element of A is an element of B and consequently
every element of B is an element of A; that is A  B and
B  A and it is written as A = B
• Example 6 (p.113) : The sets { 1, 3, 5} & { 3, 5, 1 } are
equal because they have the same elements.
18

Subset
• Definition 4: 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.
• A  B if and only if the quantification
x(x  A  x  B) is true
• Note: Every non-empty set S is guaranteed to have at
least two subsets, the empty set and the set S itself,
that is   S and S  S
19

Subset
 Theorem 1: For every non-empty set S,
(1)   S, and
(2) S  S
• Note: If AB and BA, then A=B
• Sets may have other sets as members
A = {, {a}, {b}, { a, b} }
B = { x | x is a subset of the set {a ,b } }
Note: These two sets above are equal, that is, A = B
• Note : In the above example, {a}  A, but a  A
20

Proper Subset

• Proper subset: Any subset A is said to be proper subset


of another set B if A is a subset of B, but there is at
least one element of B which does not belong to A,
i.e., if AB but A  B.
x(x  A  x  B)  x(x  B  x  A)
• A  B means “A is a proper subset of B.”
• Example: A = { 1, 5 }, B = { 1, 5, 6}
Here, A is a proper subset of B, i.e., A  B
21

FIGURE 2 Venn Diagram Showing that


A is a Subset of B
22

Cardinality of a Set

• Definition: If there are exactly n distinct members in the set S (n


is a nonnegative integer), we say that S is a finite set and that n is
the cardinality of S.
• The cardinality of a set is the number of distinct elements in the
set.
• |S| denotes the cardinality of set S that has n number of
elements; i.e., |S|= n
• Examples:
||= 0
| { 1, 5, 7, 8}|= 4
23

Cardinality of a Set

• Question: Compute cardinality of each of the sets.


1. {1, -13, 4, -13, 1}
2. {3, {1,2,3,4}, }
3. {}
4. { {}, {{}}, {{{}}} }
• Hint: After eliminating the repetitions/redundancies
just count the number of top level commas and add 1
(except for the empty set).
24

Answers

1. |{1, -13, 4, -13, 1}| = |{1, -13, 4}| = 3


2. |{3, {1,2,3,4}, }| = 3
3. |{}| = || = 0
4. |{ {}, {{}}, {{{}}} }| = |{ , {}, {{}}| = 3
25

Cardinality of a Set: More examples

• Example 9: Let A be the set of odd positive integers less than 10.
Then |A| = 5
• Example 10: Let A be the set of letters in the English alphabet.
Then |A| = 26
• Example 11: Because null set has no elements, it follows that, |
| = 0
• Examples:
• The cardinality of the set {} is 1, i.e., |{}| = 1
• If B = {3,3,3,3,3}, |B| = 1
• If C = { , {}, {,{}} }, | C | = 3.
• If S = {0,1,2,3,…}, |S| is infinite
26

Super Set

• If A is a subset of B, then B is called the super set of A


and written as B  A which is read as “B is a super set
of A”.

• A  V means “A is a superset of V.”

• Example: { 1, 4, 7, 8} is a superset of the set { 4, 7 }


27

Quick Examples

• {1,2,3}  {1,2,3,4,5} Yes/No?


• {1,2,3}  {1,2,3,4,5} Yes/No?

• Is   {1,2,3}? Yes!
• Is   {1,2,3}? No!
• Is   {,1,2,3}? Yes!
• Is   {,1,2,3}? Yes!
28

Empty set in not an element of every set

The empty set is a subset of every set. This is because every element in the
empty set is also in set A. Of course, there are no elements in the empty set,
but every single one of those zero elements is in A.

The empty set is not an element of every set. It may be an element of some
sets; for example, the set 1,2,{},51,2,{},5 has the empty set as one of its
elements. However, the set 1,2,3,51,2,3,5 does not contain the empty set as an
element. In particular, the empty set is not an element of itself, for the simple
reason that the empty set has no elements at all.
29

Quiz: Yes/No?

1. Is {x}  {x}?

2. Is {x}  {x,{x}}?

3. Is {x}  {x,{x}}?

4. Is {x}  {x}?
Answer: 1. Yes 2. Yes 3. Yes 4. No
30

Power Set

• Definition : The power set of S is the set of all subsets of


the set S.
• We say, “P(S) is the set of all subsets of S”
• The power set of S is denoted by P(S)

• Note: If a set has n elements, then its power set has 2n


elements.
31

Power Set: Examples


 Example 13: What is the power set of the set {0,1,2 } ?
• Solution: The power set P ( { 0, 1, 2 } ) is the set of all subsets of
{ 0, 1, 2 } . Hence,
P ( { 0, 1, 2 } ) = {, {0}, {1}, {2}, {0,1}, {0,2}, {1,2}, { 0,1,2}}
 Example 14: What is the power set of empty set? What is the
power set of the set {} ?
• Solution:
P() = {}
P( {} ) = { , {} }
32

Ordered n-tuples

• The order of elements in a collection is often important.


Because sets are unordered, a different structure is
needed to represent ordered collections. This is
provided by ordered n-tuples.
• Definition : The Ordered n-tuple (a1, a2, …, an) is the
ordered collection that has a1 as its first element, a1 as
its second element, ……….and an as its nth element.
33

Ordered n-tuples

• Two ordered n-tuples are equal if and only if each


corresponding pair of their elements is equal.
In other words, (a1, a2 , ….., an) = (b1 , b2 , …….., bn )
if and only if ai = bi for i = 1, 2, ……, n

• 2-tuples are called ordered pairs. The ordered pairs


(a, b) and (c, d) are equal if and only if a = c and b = d
• Note: (a, b) and (b, a ) are not equal unless a = b
34

Ordered n-tuples

• Notationally, n-tuples look like sets except that


curly braces are replaced by parentheses.
• As opposed to sets, repetition and ordering DO
MATTER with n-tuples.
(11, 11, 11, 12, 13)  ( 11, 12, 13 )
But, {11, 11, 11, 12, 13} = {11, 12, 13}
• Note:
• For set, we use { }
• For n-tuples, or ordered pairs, we use ( )
35

Cartesian Product of Sets

• Definition : 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.
A  B = {(a, b)| a  A  b  B}
36

Cartesian Product of Sets: Example

• Example 16: What is the Cartesian product of A = { 1, 2 } and


B = { a, b, c} ?
• Solution:
A X B = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c) }
 Note : A B and B A are not equal, unless A= or B= or A=B
 Note: Cartesian product of more than two sets can be defined
 Note: A subset R of the Cartesian product A X B is called a Relation from
the set A to the set B (Relation will be covered in the final term)
 Practice @ Home: Example 17
37

Example:
Cartesian Product of Three Sets
• Question: If A = {1,2}, B = {3,4}, C = {5,6,7}, what is A B C ?
• Solution:
A B C = { (1,3), (1,4), (2,3),(2,4)}  {5,6,7}
= { (1,3,5), (1,3,6), (1,3,7),(1,4,5), (1,4,6), (1,4,7),
(2,3,5), (2,3,6), (2,3,7), (2,4,5), (2,4,6), (2,4,7) }

• Note: |A B C | = |A|.|B|.|C| = 2.2.3 = 12

• Practice @ Home: Example 18


38

Practice @ Home

• Relevant odd-numbered Exercises from your text book


• Exercises: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 23, 27, 29, 33, 35
Books

1. Discrete Mathematics and its applications with


combinatorics and graph theory (7th edition) by Kenneth H.
Rosen [Indian Adaptation by KAMALA KRITHIVASAN],
published by McGraw-Hill
References

1. Discrete Mathematics, Richard Johnsonbaugh, Pearson education, Inc.


2. Discrete Mathematical Structures, Bernard Kolman, Robert C. Busby,
Sharon Ross, Prentice-Hall, Inc.
3. SCHAUM’S outlines Discrete Mathematics(2nd edition), by Seymour
Lipschutz, Marc Lipson

You might also like