Upload
ashrafdzulkefly
View
226
Download
2
Embed Size (px)
Citation preview
1
SETS, RELATIONS AND FUNCTIONS
DCS5028: DISCRETE STRUCTURE
CHAPTER 2(PART 1)
LEARNING OBJECTIVES The students should be able to describe the
concepts of Sets. The students should be able to differentiate
and write the Set Operations and its relations.
The students should be able to understand, differentiate and write the Relations and the properties of a set.
The students should be able to understand the concepts of Functions.
2
SETIntroduction Set, Element Equality, Cardinality Universal Set, Subset, Proper Subset, Power
Set Cartesian Product
Set Operations Union, Intersection, Disjoint, Difference,
Complement3
DEFINITION Set
A set is defined to be an unordered collection of objects (or sometimes referred to as elements or members)
How to express a set? Method to express a set is to enclose inside curly braces
a variable standing for a typical element of the set, followed by a description of what conditions the variable must satisfy in order to be in the set.
4
DESCRIPTION OF SET If a set is finite and not too long list all
its elements.
55
Example 1: W is the set of all integers from 1 to 5
W = {1, 2, 3, 4, 5} or W =
{1,3,2,5,4}
6
DESCRIPTION OF SET If a set is large finite set or infinite set
list a property necessary for its membership. Example 1:
R is the set of all positive and odd integers R = { x | x is a +ve, odd integer}
Read R equals the set of all x such that x is positive and odd integer
Example 2:W is the set of all integers from 1 to 12 W = {1, 2, 3 … 11, 12}
R consists of the integers 1,3,,5 and so on.
DESCRIPTION OF SET (CONT.)
7
Example 3:
The set of odd integer numbers and 0< x < 30 S = {x | x is an odd integer and 0< x < 30}The set of all x such that x is an odd integer numbers
and 0< x < 30.
Example 4: If U is the set of all alphabets.
U= {a, b, c, …, y,z}
x S (“x is an element of S”) is the proposition that object x is an element or a member of the set S.
Examples: 3 N if N = {0, 1, 2, 3, 4, …} a T if T = {x | x is a letter of the English alphabets}
Exercise: Decide whethera) {4} {x | x is an odd number} T/Fb) e { x | x is a vowel} T/Fc) cat { x | x is an animal} T/F
8
Element
N = {0, 1, 2, 3, 4, 5, …} Set of natural numbers
Z = {…, 2, 1, 0, 1, 2, …} Set of integers
Z+ = {1, 2, 3, …} Set of positive integers
Q = {p/q | p Z, q Z, q ≠0} Set of rational numbers
R = {all real numbers} Set of real numbers
Examples of real numbers:-12.66547, 100000000.02, 244.0,
Another namefor rational number is fraction
2
Sets of numbers that occur frequently in mathematics.
9
10
Set EqualityTwo sets X and Y are equal if:i) For every x, if x X , then x Yii) For every x, if x Y, then x X.
Example: X = {1,2,3,4,5,6,7} and Y = {1,2,3,4,5,6,7}
∴ X=Y
Hence,two sets are equal if and only if they have the same members.It does not matter how the set is defined or denoted!
11
Question 1: Given M1 = {x | x is an integer where x>0 and x<5 } M2 = {x | x is a positive integer whose square is >0 and <25}Verify whether M1 = M2
Question 2: Given A= {1,3,2} and B = {2,3,2,1}, Verify whether A = B.
Question 3:Given A= {1,2,3} and B = {2,4}. Verify whether A = B.
CARDINALITY Cardinality of a set
the number of element in a set
If a set S has n distinct elements for some natural number n, n is the cardinality (size) of S and S is a finite set. The cardinality of S is denoted by |S|.
Example : The cardinality of the set {2,4,6,8,10} is 5.
12
|M| (sometimes also written as #M) denotes the number of elements in M
13
EXERCISE Question:
i) |{cat,rabbit,parrot}| = ___ ii) A= {a,b}, |A| = ___iii) |{ x | x is even and 0 < x < 11}| = ___
EMPTY SET The empty set ({ } )is the set
that has no elements at all. It is denoted by
If |T|=0 then we also write T = (empty set)
Thus, = { }
14
UNIVERSAL SET
A set which has all the elements in the universe of discourse is called a universal set. More formally, a universal set, denoted by U
Example: U = {alphabet}
15
Let X and Y be sets. If every element of X is an element of Y, then we say that X is a subset of Y . X Y
Example 1 : X = {a,b,c,d,e,f,g} and Y = {a,b,c,d,e,f,g}
Example 2: X = {a,b,c,d,e} and Y = {a,b,c,d,e,f,g}
16
Subset
A subset of a set contains any or all of the elements of the set.
PROPER SUBSET
If set X is a subset of the set Y but that X Y
write X Y and say that X is a proper subset of
Y (contain some but not all).
Example: X = {a, b, c} and Y = {a, b, c, e}
17
A proper subset contains any of the elements of the set but not all of them (or except itself)
The set of all subsets of a set is called the power set of, denoted by or P(S).
If a set has n elements, then its power set has 2n subsets.
Example 1: If X = {a, b}, then P(X) = {, {a}, {b}, {a,b}}.Number of subsets = 22 = 4
Example 2: If X = {a, b, c}, then P(X) = { , {a}, {b}, {c}, {a, b}, {a, c}, {b,
c}, {a, b, c}}.Number of subsets = 23 = 8
18
Power Set
Sometimes we do want to take order into account. An ordered pair of elements (a,b) is considered distinct from the
ordered pair (b,a).
Let X and Y be sets. The Cartesian product of X and Y is denoted by X x Y, is the set of all ordered pairs (x, y) where x X and y Y.
Example: X = {a,b} Y = {1,2,3}X x Y = {(a,1), (a,2), (a,3), (b,1), (b,2), (b,3) }Y x X = {(1,a), (2,a), (3,a), (1,b), (2,b), (3,b)}
In general, X x Y ≠ Y x X
19
Cartesian Product
QUESTIONS(a) Let A be the set of odd integers less than
20 and more than 0. Find the cardinality of A?
(b) If X = { 1, 2 },i. list the members of power set of X,
P(X).ii. How many members (subsets) does X
have?20
1. Union2. Intersection3. Disjoint4. Difference5. Complement
21
Set Operations
UNION
Example: Let Set A is animals = {Tiger, Monkey, Shark, Bear, Zebra, Spider, Grasshopper, Dolphins, Snake} and
Set B is an animal with neither leg nor hand = {Shark, Dolphins, Whale, Snake, Starfish, Clown Fish }. List the element of A U B.
22
The union of the sets A and B, denoted by A U B, is the set that contains those elements that are either in A or in B, or in both
U
A B
Venn DiagramA U B is shaded
23
The intersection of the sets A and B, denoted by A B, is the set that contains those elements in both A and B.
A B is shaded
n
A B
Intersection
Example: Let Set A is animals = {Tiger, Monkey, Shark, Bear, Zebra, Spider, Grasshopper, Dolphins, Snake} and
Set B is an animal with neither leg nor hand = {Shark, Dolphins, Whale, Snake, Starfish, Clown Fish }. List the element of A B.
Example: Let Set A is an animals that lives on land = {Tiger, Monkey, Bear, Zebra, Spider,
Grasshopper} and
Set B is an animal that lives in water = {Shark, Dolphins, Whale, Starfish, Clown Fish
}. List the element that lives on both land and
water .
24
2 sets are disjoint if their intersection is an empty set
n
A B
Disjoint
Two sets are "disjoint" if they have no objects in common.
Example:Let Set A= {1,3,5} and Set B
={1,2,3}A - B ={1,3,5} - {1,2,3} ={5}
25
• 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 that are not in B. • The difference of A and B is also called the relative complement of B with
respect to A.
Difference
Example:Let A= {a,e,i,o,u} andUniversal set is the set of letters ofEnglish Alphabet.
Then, = {b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,v,w,x,y,z}.
26
• Given a universal set U and a subset A of U,• The set U – A is called the complement of A and written as
Complement
A
A
QUESTION 1:
Let the universe be the set U = {a,b,c,d,…,x,y,z}.
Let A = {a,e,i,o,u}, B = {a,c,f, i, m, p,t, w,x }, and
C = {a,d,e,h,l,n,q,u,w}. List the elements of :
27
28
QUESTION 2: There is a group of 191 students, of which 10 are taking
French, business and music; 36 are taking French and Business; 20 are taking French and music; 18 are taking business and music; 65 are taking French; 76 are taking business; and 63 are taking music.
i. How many are taking French and music but not business?ii. How many are taking business and neither French nor
music?iii. How many are taking music or French (or both) but not
business?iv. How many are taking none of the three subjects?
SUMMARYIntroduction Set, Elements Equal, Cardinality Power Set, Cartesian ProductSet Operations Union, Intersection, Difference,
Complement
29
1. List the members of these sets: { x | x is a positive integer such that x3
< 100} { x | x is the square of a positive
integer and x < 11}
2. Find the power set of each of these sets:
Y = { a, b, c } Z = {1, 2, 3, 4 }
30
Review Questions
3. Let A= {k, m, n, p} and B= {2, 3, 7}. Find: A x B.
4. Let the Universal Set, U = {x | 0 < x < 20}.Let A= {4, 6, 8, 9, 11, 12}, B= {1, 4, 9, 13}
and C= {6, 12, 13, 18}. Find (a)
(b)
31
Review Questions
CBA )(
)( BAC