8/12/2019 CMSC 56 Slide 06 - Set Theory
1/37
Computer Science 56
Discrete Mathematical Structures
in Computer Science I
8/12/2019 CMSC 56 Slide 06 - Set Theory
2/37
Georg Cantor 1845-1918) A Russian-born mathematician who pioneered the
study of set theory and its role in the foundation of
mathematics. He is known Father of Set Theory because of his
work.
8/12/2019 CMSC 56 Slide 06 - Set Theory
3/37
A Set is an unordered collection of objects. The objects in the set are also called the
elements or members of the set. Elements of the set must be:
Distinct a set should not contain duplicates.
Unordered the ordering of elements in the set isinsignificant.
Well-defined one should be able to determine if a
certain element belongs to the set.
8/12/2019 CMSC 56 Slide 06 - Set Theory
4/37
Elements of the set are enclosed in braces {}and each element is separated by comma.
Examples:
1. The set of vowels in English alphabet can be writtenas V = {a, e, i, o, u}
2. The sets {1, 1, 2, 3}, {1, 2, 3, 3}, and {2, 3, 1, 3} cansimply be written as {1, 2, 3}
8/12/2019 CMSC 56 Slide 06 - Set Theory
5/37
A set may be finite or infinite. A set is finite if its elements can be counted or
enumerated.
A set is infinite if its elements cannot be counted orenumerated.
Examples: Tell whether each set is finite or infinite.
1. Set of capital letters in English alphabet
2. Set of real numbers3. {1, 2, 3, }
8/12/2019 CMSC 56 Slide 06 - Set Theory
6/37
Cardinality of a set it is the number of elements in a finite set A
denoted by |A|. Example:
If A = {a, b, c, d, e}, then |A| = 5.
8/12/2019 CMSC 56 Slide 06 - Set Theory
7/37
Roster Method List down or enumerate the elements of the set.
This method can only be used to represent finitesets.
Rule Method give a rule which states the property satisfied by all
of the elements in the set.
It is usually in the form of {x|xhas the property}which reads, the set of all elements xsuch that xhas the property
8/12/2019 CMSC 56 Slide 06 - Set Theory
8/37
Example: Represent the set of all countingnumbers between 1 and 10, inclusive. Let theset be A.
1. Roster Method: A = {1, 2, 3, 4, 5, 6, 7, 8, 9 ,10} A = {1, 2, , 10}
2.
Rule Method: A = { | 1 10 and is a counting number}
8/12/2019 CMSC 56 Slide 06 - Set Theory
9/37
Superscript symbols such as +, -, represent positive, negative, and nonnegativevalues respectively.
Symbol Set DenotedN Set of Natural numbersZ Set of integersQ Set of rational numbersR Set of real numbersC Set of complex numbers
8/12/2019 CMSC 56 Slide 06 - Set Theory
10/37
Universal Set The totality of all elements under consideration.
Denoted by the symbol .
Empty Set set containing no element and is also called a null
set. Denoted by or {}. || = 0
Note {} is notan empty set, but a set containing the empty set.
8/12/2019 CMSC 56 Slide 06 - Set Theory
11/37
The symbol is used to denote setmembership.
A (x is an element of set A) if and onlyif x is an element of set A or x is in A. A if x is not an element of set A.
8/12/2019 CMSC 56 Slide 06 - Set Theory
12/37
Example: Tell whether the each of the ff. is anelement of A = {1, 2, 3, {1}}1. 42. 13. {1}4. {2}
8/12/2019 CMSC 56 Slide 06 - Set Theory
13/37
The symbol is used to denote setcontainment.
A B (set A is a subset of set B) if and onlyif every element of set A is an element of setB.
A B if A is not a subset of B.
8/12/2019 CMSC 56 Slide 06 - Set Theory
14/37
Example: Let A = {1}, B = {{1}}, C = {1, {1}}
A C and B CA B since 1 {{1}}
8/12/2019 CMSC 56 Slide 06 - Set Theory
15/37
Set A is said to be a proper subset of B(denoted by A B) if and only if A B andA B. Thus,
A B A B A B) Example: Let A = {1}, B = {{1}}, C = {1, {1}}
A C and B C A B since A B and A A since A = A
8/12/2019 CMSC 56 Slide 06 - Set Theory
16/37
Set A is equal to set B, denoted by A = B, ifand only if sets A and B have the sameelements.
Example: if A = {1, 3, 2} and B = {1, 2, 3} then A = B Also,
A = B) A B) B A)
8/12/2019 CMSC 56 Slide 06 - Set Theory
17/37
Let A, B and C be any set,
Remark: Every set is a subset of itself but notset is a n element of itself.
1. A The empty set is a subset ofevery set
2. A A Every set is a subset of itself3. A B A B) If A is a proper subset of B,
then A is a subset of B
4. A B) B C) A CTransitive Rules
5. A B) B C) A C
8/12/2019 CMSC 56 Slide 06 - Set Theory
18/37
The implicit definition of sets does not allowa set to be an element of itself since withoutthis restriction, we are led to RussellsParadox. Let R be the set of all sets that are not elements of
themselves:
R = {S | S S}
8/12/2019 CMSC 56 Slide 06 - Set Theory
19/37
To prove that R does no exist:a) Assume R R
By definition, since R is not an element of itself, thenR must be a member of our given set R, that is R R.
Therefore, R R implies R R, which iscontradiction.
b) Assume R R
By definition, since R R, then R must be a set that
is not an element of itself, that is R R. Therefore,
R R implies R R, which is a contradiction.
8/12/2019 CMSC 56 Slide 06 - Set Theory
20/37
We are led to the paradoxical conclusion thatR R if and only if R R. Hence, the set
R = {S | S S} does not exist.
8/12/2019 CMSC 56 Slide 06 - Set Theory
21/37
Analogy:
There was once a barber. Some say that he lived inSeville. Wherever he lived, all of the men in this
town either shaved themselves or were shaved bythe barber. And the barber only shaved the menwho did not shave themselves. Who shaves the
barber?
8/12/2019 CMSC 56 Slide 06 - Set Theory
22/37
A. Represent the set of multiples of 3 between 1 to20 using
1. Roster Method
2. Rule Method
B. Let A = {{x}}, B = {x, {x}}, C = {x, {x, {x}}}
Write T if the statement is true, write F if false.1. x A2. A B3. C A4. B
8/12/2019 CMSC 56 Slide 06 - Set Theory
23/37
Power set of a set The power set of set A, denoted by p(A), is the set
of all subsets of set A. That is,
A) = {x | x A} | A)| = 2|A|
8/12/2019 CMSC 56 Slide 06 - Set Theory
24/37
Example: if A = {1, 2, 3} then
A) = {, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3},{1, 2, 3}}
| A)| = 8
8/12/2019 CMSC 56 Slide 06 - Set Theory
25/37
Operation Set Representation DescriptionComplement of A A' = {x | x U x A} Set of all elementsthat are not in Abut in U
Union of A and B A B = {x | x A x B} Set of all elementsthat are in eithersets A or B
Intersection of Aand B A B = {x | x A x B} Set of all elementsthat are in both setsA and B
Difference of Aand B relativecomplement)A B = {x | x A x B}Can also be expressed as:A B = A B'
Set of all elementsthat are in set A butnot in set B
SymmetricDifference of Aand BA B = {x | (x A x B) (x A x B)}Can also be expressed as:
A B = (A B) (A B)
Set of all elementsthat are in eitherset A or B but not
both
8/12/2019 CMSC 56 Slide 06 - Set Theory
26/37
Example: Let A = {1, 3, 5, 7}, B = {1, 2, 3, 4}and U = {1, 2,, 10}. Determine:1. A B
2. A B
3. A B4. A'
5. B'
6. A B
7. B A
8/12/2019 CMSC 56 Slide 06 - Set Theory
27/37
If A B = , or A and B dont have commonelements, then they are said to be disjoint.Otherwise, A and B are said to be joint sets.
8/12/2019 CMSC 56 Slide 06 - Set Theory
28/37
Consider the ff sets:U = {1, 2,, 10}A = {1, 2, 3, 4, 5} C = {1, 3, 5, 7, 9}B = {2, 4, 6, 8} D = {1, 2, 9, 10}
Determine:1. A B2. D'
3. A (B - C)4. p(D)5. (A B) (A B)'
8/12/2019 CMSC 56 Slide 06 - Set Theory
29/37
John Venn 1834-1923) He presented a systematic development of a
method that uses geometric figures, known as VennDiagrams, in his book Symbolic Logic.
Venn Diagrams are used to analyze logicalarguments and to analyze relationships betweensets.
8/12/2019 CMSC 56 Slide 06 - Set Theory
30/37
Venn Diagram gives a graphicalrepresentation of sets.
Rectangle represents the universal set
Circles or any closed polygons represents thesubsets of universal set.
8/12/2019 CMSC 56 Slide 06 - Set Theory
31/37
Venn diagrams may also include elements orcardinality of the sets.
Example: |A| = 15, |B| = 25, |A B| = 10,
U = 35
What is |(A B)|?
8/12/2019 CMSC 56 Slide 06 - Set Theory
32/37
Example: Illustrate the ff sets given that:1. U = set of all UPLB students
A = set of all sophomores
B = set of all juniors
2. U = set of all UPLB students
C = set of all male students
D = set of all female students
8/12/2019 CMSC 56 Slide 06 - Set Theory
33/37
Venn diagrams can be used to illustrate setconcepts.
Venn diagram for some set concepts:
A
A B
8/12/2019 CMSC 56 Slide 06 - Set Theory
34/37
Example: Draw a Venn Diagram for each ofthe ff:1. A B
2. A B
3. A B
4. A B
8/12/2019 CMSC 56 Slide 06 - Set Theory
35/37
1. (A) = ADouble Negation(Involution Law)
2.(A B) = A B
(A B) = A B
De Morgans Laws
3.A B = B AA B = B A
Commutative Laws
4.A (B C) = (A B) CA (B C) = (A B) C
Associative Laws
5.A (B C) = (A B) (A C)A (B C) = (A B) (A C) Distributive Laws
8/12/2019 CMSC 56 Slide 06 - Set Theory
36/37
6.A A = AA A = A
Idempotency Laws
7.A = A
A U = A
Identity Laws
8.A A = UA A =
Inverse Laws
(Complement Laws)
9.A U = UA =
Domination Laws (Bound
Laws)
10.A (A B) = AA (A B) = A Absorption Laws
8/12/2019 CMSC 56 Slide 06 - Set Theory
37/37
Let A, B U
1. A - B = A B2. A B = (A B) - (A B)3. (A B) A (A B)4. The following statements are equivalent to
each other:
a. A Bb. A B = B
c. A B = Ad. B A
5. If A , B U then A and B are disjoint if andonly if A B = A B.