Date post: | 17-Jan-2016 |
Category: |
Documents |
Upload: | louisa-james |
View: | 218 times |
Download: | 1 times |
Fall 2008/2009
I. Arwa Linjawi & I. Asma’a Ashenkity11
Basic Structure : Sets, Functions, Sequences, and Sums
Sets Operations
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity22
Union Let A and B be sets. The union of the sets A and B, denoted by AB, is the set that contains those elements that are either in A or in B, or in both.
A B is shaded.
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity33
Union An element x belongs to the union of the sets A and B if and only if x belongs to A or x belongs to B. This tells us that
A B = {x | x A x B}
Example : The Union of the sets {1,3,5} and {1,2,3} is {1,2,3,5}
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity44
Intersection Let A and B be sets. The intersection of the sets A and B, denoted by AB, is the set containing those elements in both A and B.
A B is shaded
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity55
Intersection An element x belongs to the intersection of the sets A and B if and only if x belongs to A and x belongs to B. This tells us that
A B = {x | x A x B}
Example :The Union of the sets {1,3,5} and {1,2,3} is {1,3}
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity66
Disjoint Two sets are called disjoint if their intersection is the empty set.Example
A= { 1,3,5,7,9} B={2,4,6,8,10} A B= Cardinality of a union of two finite sets Cardinality of a union of two finite sets |A B| = |A| + |B| − |A B|.This called principle of inclusion -exclusion
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity77
Difference 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.
A – B is shaded
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity88
Difference An element x belongs to the difference of A and B if and only if x A and x B. This tells us that
A − B = {x | x A x B}
Example : The difference of the sets {1,3,5} and {1,2,3} is A − B = {5} B − A = {2}
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity99
Complement Once the universal set U has been specified, the complement of a set can be defined. Let U be the universal set. The complement of the set A, denoted by Ā , is the complement of A with respect to U. In other words, the complement of the set A is U−A.
Ā is shaded.
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1010
Complement An element belongs to Ā if and only if x A. This tells us that
Ā = {x | x A}
Example : Let A be the set of positive integers grater than 10 Ā={1,2,3,4,5,6,7,8,9}
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1111
Exercise
Let A = {1, 2, 3, 4, 5} ,B = {0, 3, 6} and U={x| xZ+ x<10}.
Draw the Venn diagram for the following sets:
ĀA BA BA − BB − A
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1212
Set Identities
Name Identity
Identity laws A= AU=A
Domination laws AU=U A=
Idempotent laws AA=A AA=A
Commutative laws AB=BA AB=BA
A Absorption laws A(AB)=A A(AB)=A
Complement lawsAĀ = AĀ=U
Complementation law (Ā) = A
De Morgan’s laws AB= Ā B AB= Ā B
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1313
Set Identities Associative lawsAssociative laws A(BC)=(AB)C A(BC)=(AB)C Distributive lawsDistributive lawsA(BC)=(AB)(AC)A(BC)=(AB)(A C)∪
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1414
Set Identities Methods to prove set identityMethods to prove set identity
We will prove several of these identities by different approaches to the solution of a problem. The rest will be left as exercise.
One way to show that two sets are equal is to show that each is a subset of the other.
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1515
Exercise Prove A B = Ā B
We have to show that A B Ā B and Ā B A B
Set identities can also be proved using set builder notation and logical equivalences.
We can use Builder notation and logical equivalences to establish A B = Ā B
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1616
Set Identities Methods to prove set identityMethods to prove set identity
Set identities can also be proved using membership tables. We consider each combination of sets that an element can belong to, and verify that elements in the same combinations of sets belong to both the sets in the identity. To indicate that an element is in a set, a 1 is used; to indicate that an element is not in a set, a 0 is used. Note that: there is a similarity between membership tables and truth tables.
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1717
Exercise Use member ship table to show that A (B C)= (A B) (A C)
11111111111 1 11 1 1
11001111111 1 01 1 0
11110011111 0 11 0 1
00000000001 0 01 0 0
00000000110 1 10 1 1
00000000110 1 00 1 0
00000000110 0 10 0 1
00000000000 0 00 0 0
(A B) (A C)
AA CCAA BBAA (B(B C)C)BB CCA B CA B C
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1818
Exercise Prove A (B C) = (C B) A
= A (B C) by first De Morgan law = A (B C) by the second De Morgan law = (B C) A by the commutative law of intersection = (C B) A by the commutative law of unions
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity1919
Generalization Union and Intersection
The Union of collection of sets is the set that contains those elements that are member of at least one set in the collection. A1 A2 … An = n
Ai i =1
Let Ai= { i, i+1, i+2 , ….}
n n
Ai = { i, i+1, i+2 , ….} = {1,2,3,…}i =1 i =1
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity2020
Generalization Union and Intersection
The intersection of collection of sets is the set that contains those elements that are member of all the sets in the collection. A1 A2 … An = n
Ai i =1
Let Ai= { i, i+1, i+2 , ….}
n n
Ai = { i, i+1, i+2 , ….} = {n,n+1,n+2,…}i =1 i =1
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity2121
Generalization Union and Intersection
Example : Suppose Ai={1,2,3,…. ,i} for i=1,2,3,… ф
Ai = {1,2,3,…}=Z+i =1
ф
Ai = {1}i =1
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity2222
Computer Representation of Sets
One method is to store the elements of the set in an unordered fashion. However, if this were done, the operations of computing the union, intersection, or difference of two sets would be time-consuming, because each of these operations would require a large amount of searching for elements.
We will present a method for storing elements using an arbitrary ordering of the elements of the universal set. This method of representing sets makes computing combinations of sets easy.
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity2323
Computer Representation of Sets
Assume that the universal set U is finite (and of reasonable size so that the number of elements of U is not larger than the memory size of the computer being used). First, specify an arbitrary ordering of the elements of U, for instance a1, a2, . . . , an. Represent a subset A of U with the bit string of length n, where the ith bit in this string is 1 if ai belongs to A and is 0 if ai does not belong to A.
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity2424
Computer Representation of Sets
ExampleLet U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, and the ordering of elements of U has the elements in increasing order; that is, ai = i. What bit strings represent the subset of all odd integers in U, the subset of all even integers in U, and the subset of integers not exceeding 5 in U?The set of all odd integers in U is {1, 3, 5, 7, 9}, The bit string is 1010101010The set of all even integers in U is {2, 4, 6, 8, 10}, The bit string is 0101010101 The set of integers not exceeding 5 in U is {1, 2, 3, 4, 5}, The bit string is 1111100000
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity2525
Computer Representation of Sets
Example (complement)The bit string for the set {1, 3, 5, 7, 9} is 1010101010, with universal set {1, 2, 3, 4,5, 6, 7, 8, 9, 10} What is the bit string for the complement of this set? The bit string for the complement of this set is obtained by replacing 0s with 1s and vice versa. This yields the string 0101010101, which corresponds to the set {2, 4, 6, 8, 10}.
Fal
l 200
8/20
09
I. Arwa Linjawi & I. Asma’a Ashenkity2626
Computer Representation of Sets
Example (union and intersection)The bit strings for the sets {1, 2, 3, 4, 5} is 1111100000 {1, 3, 5, 7, 9} is 1010101010,Use bit strings to find the union and intersection of these sets.
The bit string for the union of these sets is1111100000 1010101010 = 1111101010 Which corresponds to the set {1, 2, 3, 4, 5, 7, 9}. The bit string for the intersection of these sets is1111100000 1010101010 = 1010100000 Which corresponds to the set {1, 3, 5}.