Basics of Set Theory: Discrete Structures & Algorithms
Basics of Set Theory: Discrete Structures & Algorithms
Some examples
Note: {} 2
Definitions and notation
A Venn
Diagram
B
3
Definitions and notation
iff, A B and B A
iff, A B and A B
iff, x ((x A) (x B)).
4
Definitions and notation
A
B
5
Definitions and notation
Quick examples:
• {1,2,3} {1,2,3,4,5}
• {1,2,3} {1,2,3,4,5}
6
Definitions and notation
Quiz Time
Is {x} {x}? No
7
How to specify sets
If S = {1,2,3}, |S| = 3.
If S = {3,3,3,3,3}, |S| = 1.
If S = , |S| = 0.
If S = { , {}, {,{}} }, |S| = 3.
If S = {0,1,2,3,…}, |S| is infinite. (more on this later)
10
Power sets
11
Cartesian product
B A
13
Operators
B A
14
Operators
If A = {x : x is a US president}, and B =
{x : x is deceased}, then
A B = {x : x is a deceased US president}
B A
15
Operators
If A = {x : x is a US president}, and B =
{x : x is in this room}, then
A B = {x : x is a US president in this room} =
Sets whose
B A intersection is empty
are called disjoint
sets
16
Operators
Ac = { x : x A}
are needed to see this picture.
If A = {x : x is bored}, then
A = {x : x is not bored} =
U
A
c = U
and
Uc =
17
Operators
U
A
B
A-B={x:xAxB}
A - B = A Bc
18
Operators
like “exclusive
= (A - B) U (B - A) or”
U
A
B
19
Operators
A B = { x : (x A x B) v (x B x A)}
= (A - B) U (B - A)
Proof: { x : (x A x B) v (x B x A)}
= { x : (x A - B) v (x B - A)}
= { x : x ((A - B) U (B - A))}
= (A - B) U (B - A)
20
Famous identities
They’re in Rosen,
Sec. 2.2
21
Identities
• Identity AU=A
AU=A
• Domination AUU=U
A=
• Idempotent
AUA=A
AA=A
22
Identities
• Uniqueness AA=
• Double complement
A=A
23
Identities
• Associativity (A U B) U C = A U (B U C)
(A B) C = A (B C)
• Distributivity A U (B C) = (A U B) (A U C)
A (B U C) = (A B) U (A C)
24
Identities
Hand waving is
good for intuition,
p q but we aim for a
more formal proof.
25
Proving identities
26
Proving identities (1)
27
Proving identities (2)
(A U B) = A U B
=AB
=AB
29
Proving identities (4)
= {x : (x Ac) (x Bc)}
= Ac Bc
30
A proof to do
(X Y) - (X Z) = (X Y) (X Z)’
= (X Y) (X’ U Z’)
= (X Y X’) U (X Y Z’)
= U (X Y Z’)
= (X Y Z’)
31
Another proof to do
AB=
Prove that if (A - B) U (B - A) = (A U B) then ______
a) AUB=
b) A=B
Suppose to the contrary, that A B , and that x A B. c) AB=
d) A-B = B-A =
33