Basic Discrete Structure : Set
Lecture 2
1
Problem
Let A = {a, b, c}, B = {x, y}, and C = {0, 1}.
Find
a)A × B × C.
b) B × B × B.
2
Problem
Let A = {a, b, c}, B = {x, y}, and C = {0, 1}.
Find
a)A × B × C.
b)B × B × B.
A × B = {(a,x), (a,y), (b,x), (b,y), (c,x), (c,y)}
A × B × C= {(a,x,0), {(a,x,1), (a,y,0), (a,y,1),
(b,x,0), {(b,x,1), (b,y,0), (b,y,1),
(c,x,0), {(c,x,1), (c,y,0), (c,y,1) }
3
Problem
Let A = {a, b, c}, B = {x, y}, and C = {0, 1}. Find
a)A × B × C.
b)B × B × B.
B × B = {(x,x), (x,y), (y,x), (y,y)}
B × B × B= {(x,x,x), {(x,x,y), (x,y,x), (x,y,y), (y,x,x),
{(y,x,y), (y,y,x), (y,y,y)}
4
Problem
Use a Venn diagram to illustrate the relationships
A ⊂ B and A ⊂ C.
5
Problem
Use a Venn diagram to illustrate the relationships
A ⊂ B and A ⊂ C.
6
Problem
Let A = {0, 2, 4, 6, 8, 10}, B = {0, 1, 2, 3, 4, 5, 6}, and
C = {4, 5, 6, 7, 8, 9, 10}.
Find
a) A ∩ B ∩ C.
b) A ∪ B ∪ C.
c) (A ∪ B) ∩ C.
d) (A ∩ B) ∪ C.
7
Problem
Let A = {0, 2, 4, 6, 8, 10}, B = {0, 1, 2, 3, 4, 5, 6}, and
C = {4, 5, 6, 7, 8, 9, 10}.
Find
a) A ∩ B ∩ C.
b) A ∪ B ∪ C.
c) (A ∪ B) ∩ C.
d) (A ∩ B) ∪ C.
a) A ∩ B ∩ C. ={4, 6}
8
Problem
Let A = {0, 2, 4, 6, 8, 10}, B = {0, 1, 2, 3, 4, 5, 6}, and
C = {4, 5, 6, 7, 8, 9, 10}.
Find
a) A ∩ B ∩ C.
b) A ∪ B ∪ C.
c) (A ∪ B) ∩ C.
d) (A ∩ B) ∪ C.
a) A ∩ B ∩ C. ={4,6}
b) A ∪ B ∪ C={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
9
Problem
Let A = {0, 2, 4, 6, 8, 10}, B = {0, 1, 2, 3, 4, 5, 6}, and
C = {4, 5, 6, 7, 8, 9, 10}.
Find
a) A ∩ B ∩ C.
b) A ∪ B ∪ C.
c) (A ∪ B) ∩ C.
d) (A ∩ B) ∪ C.
a) A ∩ B ∩ C. ={4,6}
b) A ∪ B ∪ C={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
c) (A ∪ B) ∩ C = {4, 5, 6, 8, 10}
10
Problem
Let A = {0, 2, 4, 6, 8, 10}, B = {0, 1, 2, 3, 4, 5, 6}, and
C = {4, 5, 6, 7, 8, 9, 10}.
Find
a) A ∩ B ∩ C.
b) A ∪ B ∪ C.
c) (A ∪ B) ∩ C.
d) (A ∩ B) ∪ C.
a) A ∩ B ∩ C. ={4, 6}
b) A ∪ B ∪ C={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
c) (A ∪ B) ∩ C = {4, 5, 6, 8, 10}
d) (A ∩ B) ∪ C = {0, 2, 4, 5, 6, 7, 8, 9, 10} 11
Problem
What can you say about the sets A and B if we know that
a) A ∪ B = A?
b) A ∩ B = A?
c) A − B = A?
12
Problem
What can you say about the sets A and B if we know that
a) A ∪ B = A?
b) A ∩ B = A?
c) A − B = A?
a) B A
13
Problem
What can you say about the sets A and B if we know that
a) A ∪ B = A?
b) A ∩ B = A?
c) A − B = A?
a) B A
b) A B
14
Problem
What can you say about the sets A and B if we know that
a) A ∪ B = A?
b) A ∩ B = A?
c) A − B = A?
a) B A
b) A B
c) A B
15
Problem
Let A be the set of English words that contains x, and B be the set of
English words that contain the letter q. Express each of these sets as
a combination of A and B.
i. The set of English words that do not contain the letter x.
ii. The set of English words that contain an x but not a q.
iii. The set of English words that do not contain either an x or a q.
16
Problem
Let A be the set of English words that contains x, and B be the set of
English words that contain the letter q. Express each of these sets as
a combination of A and B.
i. The set of English words that do not contain the letter x.
ii. The set of English words that contain an x but not a q.
iii. The set of English words that do not contain either an x or a q.
i. U–A
17
Problem
Let A be the set of English words that contains x, and B be the set of
English words that contain the letter q. Express each of these sets as
a combination of A and B.
i. The set of English words that do not contain the letter x.
ii. The set of English words that contain an x but not a q.
iii. The set of English words that do not contain either an x or a q.
i. U–A
ii. A –B
18
Problem
Let A be the set of English words that contains x, and B be the set of
English words that contain the letter q. Express each of these sets as
a combination of A and B.
i. The set of English words that do not contain the letter x.
ii. The set of English words that contain an x but not a q.
iii. The set of English words that do not contain either an x or a q.
i. U–A
ii. A –B
iii. U – (A U B)
19
Definitions and notation
Check these:
Is {x} {x}? Yes
Is {x} {x,{x}}? Yes
Is {x} {x,{x}}? Yes
Is {x} {x}? No
20
Operators
like
“exclusive
or”
The symmetric difference, A B, is:
A B = { x : (x A x B) v (x B x A)}
= (A - B) U (B - A)
U
A
B
21
Operators
Proof: { x : (x A x B) v (x B x A)}
= (A - B) U (B - A)
A B = { 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)
22
Famous Identities
AU=A
• Identity AU=A
AUU=U
• Domination A=
AUA=A
• Idempotent
AA=A
23
Famous Identities
• Excluded Middle AUA=U
• Uniqueness AA=
• Double complement A=A
24
Famous Identities
AUB= BUA
• Commutativity
AB= BA
(A U B) U C = A U (B U C)
• Associativity
(A B) C = A (B C)
A U (B C) = (A U B) (A U C)
• Distributivity
A (B U C) = (A B) U (A C)
25
Famous Identities
• DeMorgan’s I (A U B) = A B
• DeMorgan’s II (A B) = A U B
26
Inclusion/Exclusion
Example:
How many people are wearing a watch?
How many people are wearing sneakers?
How many people are wearing
a watch OR sneakers?
What’s wrong?
|A B| = |A| + |B| 7
B A
|A B| = |A| + |B| - |A B| 6
27
Inclusion/Exclusion
Example:
There are 217 cs majors. 217
157 are taking cs125. 59 98
47
145 are taking cs173.
98 are taking both.
How many are taking neither?
217 - (157 + 145 - 98) = 13
28
Generalized Inclusion/Exclusion
Suppose we have:
A = {0, 2, 4, 6, 8},
A B B = {0, 1, 2, 3, 4},
C = {0, 3, 6, 9}.
And I want to know |A U B U C|
|A U B U C| = |A| + |B| + |C|
- |A B| - |A C| - |B C|
+ |A B C|
|A ∪ B ∪ C| = 5+5+4-3-2-2+1 ≡ 8 ≡{0, 1, 2, 3, 4, 6, 8, 9}. 29
Thank You
30