Documente Academic
Documente Profesional
Documente Cultură
SET THEORY
Prepared by: Victor A. Estalilla Jr.
Set
o A set
o The elements
o Subsets
o Universal set
Examples
League.
A= 1,2,3,4,5,6
A=Integers x 1 x 6
Notation
equation x 2 1 0
Subset
The sets
A = {3, 4, 6} and B = {6, 3, 4} are
equal because A B and B A.
We write A B
Example - Intersection
If A = {3, 4, 6, 8} and
B = { 1, 2, 3, 5, 6} then
A B = {3, 6}
Example - Intersection
If A is the set of prime numbers and
B is the set of even numbers then
A∩B={2}
If A = {x | x > 5 } and
B = {x | x < 3 } then
A∩B=
Example - Intersection
If A = {x | x < 4 } and
B = {x | x >1 } then
A ∩ B = {x | 1 < x < 4 }
If A = {x | x > 4 } and
B = {x | x >7 } then
A ∩ B = {x | x < 7 }
Venn Diagram - Intersection
A is represented by the red circle and B is
represented by the blue circle.
When B is moved to overlap a
portion of A, the purple
colored region
illustrates the intersection
A∩B
of A and B
Union
We write A B
Example - Union
If A = {3, 4, 6} and
B = { 1, 2, 3, 5, 6} then
A B = {1, 2, 3, 4, 5, 6}.
Example - Union
If A is the set of prime numbers and
B is the set of even numbers then
A B = {x | x is even or x is prime }.
If A = {x | x > 5 } and
B = {x | x < 3 } then
A B = {x | x < 3 or x > 5 }.
Venn Diagram - Union
A is represented by the red circle and B is
represented by the blue circle.
The purple colored region
illustrates the intersection.
The union consists of all
points which are colored
red or blue or purple.
Algebraic Properties
Union and intersection are commutative
operations.
AB=BA
A∩B=B∩A
Algebraic Properties
(A B) C = A (B C)
(A ∩ B) ∩ C = B ∩ (A ∩ C)
Algebraic Properties
A ∩ ( B C )= (A ∩ B) (A ∩ C)
A ( B ∩ C )= (A B) ∩ (A C)
Algebraic Properties
A few other elementary properties of
intersection and union.
A =A A∩=
AA=A A∩A=A
Finite and Infinite Sets
elements.
Notation: A B
A B x x A or x B
A B x x A and x B
A B {2}
Definition: A and B are disjoint if
A B Ø
Complements
o If A is a subset of the universal set U, then the complement of
A is the set
Ac x U x A
o Note: A A
c
; A A c
U
Venn Diagrams
A
Possible Venn Diagrams
for Two Sets
A
UA U
A
U
A
The Complement of a Set
The shaded region represents the complement of the set A
Ac A
The Union of Two Sets
U
The Intersection of Two Sets
A
Boolean Algebra
When dealing with sets, we have operations ∩, ∪ and 0. The
Substitute
{0, 1} for B
AND for • Boolean Product. In CSE 321 this was
OR for + Boolean Sum. In CSE 321 this was
NOT for ‘ Complement. In CSE 321 this was
Definitions
Boolean function
Maps inputs from the set {0,1} to the set {0,1}
Boolean expression
An algebraic statement of Boolean variables and operators
Logic Gates (AND, OR, Not) & Truth
Table
• AND X•Y XY X
0
Y
0
Z
0
0 1 0
1 0 0
1 1 1
• OR X+Y X Y Z
0 0 0
0 1 1
1 0 1
1 1 1
• NOT X X' X Y
0 1
1 0
Logic functions and Boolean algebra
Any logic function that is expressible as a truth table can be written in
Boolean algebra using +, •, and '
Some notation
Priorities: A B+ C = ((A) B) + C
Variables and their complements are sometimes called literals
Two key concepts
Duality (a meta-theorem— a theorem about theorems)
All Boolean expressions have logical duals
Any theorem that can be proved is also proved for its dual
Replace: • with +, + with •, 0 with 1, and 1 with 0
Leave the variables unchanged
de Morgan’s Theorem
Procedure for complementing Boolean functions
Replace: • with +, + with •, 0 with 1, and 1 with 0
Replace all variables with their complements
Useful laws and theorems
Identity: X+0=X Dual: X • 1 = X
Null: X+1=1 Dual: X • 0 = 0
Idempotent: X+X=X Dual: X • X = X
Involution: (X')' = X
Complementarity: X + X' = 1 Dual: X • X' = 0
Commutative: X+Y=Y+X Dual: X • Y = Y • X
Associative: (X+Y)+Z=X+(Y+Z) Dual: (X•Y)•Z=X•(Y•Z)
Distributive: X•(Y+Z)=(X•Y)+(X•Z) Dual: X+(Y•Z)=(X+Y)•(X+Z)
Uniting: X•Y+X•Y'=X Dual: (X+Y)•(X+Y')=X
Useful laws and theorems (con’t)
Absorption: X+X•Y=X Dual: X•(X+Y)=X
Absorption (#2): (X+Y')•Y=X•Y Dual: (X•Y')+Y=X+Y
de Morgan's: (X+Y+...)'=X'•Y'•... Dual: (X•Y•...)'=X'+Y'+...
Duality: (X+Y+...)D=X•Y•... Dual: (X•Y•...)D=X+Y+…
= XY+X'YZ+X'Z
Rearrange terms = XY+X'ZY+X'Z
Use absorption {AB+A=A} with A=X'Z and B=Y
XY+YZ+X'Z = XY+X'Z
De Morgan’s Theorem
Use de Morgan’s Theorem to find complements
Example:
Z = A'BC + AB'C' + AB'C + ABC' + ABC
• Two types:
– Universal
– Existential
Universal quantifiers 1
• Represented by an upside-down A:
– It means “for all”
– Let P(x) = x+1 > x
• x P(x), where 1 ≤ x ≤ 10
• … can be translated as …
• If P(x) is true for all parts of the for loop, then x P(x)
– Consequently, if P(x) is false for any one value of the for loop, then x P(x)
is false
Existential quantification 1
• Represented by an bacwards E:
– It means “there exists”
– Let P(x) = x+1 > x
Three parts:
Base case(s): show it is true
for one element
1 1
Induction example, continued
• Inductive hypothesis: assume true for k
• Thus, we assume that P(k) is true, or that
k
2i
i 1
1 k 2
2i
i 1
1 ( k 1) 2
Induction example, continued
k
• Recall the inductive hypothesis: 2i
i 1
1 k 2
2i
i 1
1 ( k 1) 2
k
2(k 1) 1 2i 1 k 2 2k 1
i 1
2(k 1) 1 k 2 k 2 2k 1
k 2 2k 1 k 2 2k 1
What did we show
• Base case: P(1)
• If P(k) was true, then P(k+1) is true
• i.e., P(k) → P(k+1)
2 2
Inductive hypothesis: Assume
k
P(k ) 2i k 2 k
i 1
i
2i ( k 1) 2
k 1
k1
2(k 1) 2i (k 1) 2 k 1
i 1
2(k 1) k k (k 1) 2 k 1
2
k 2 3k 2 k 2 3k 2
Notes on proofs by induction
• We manipulate the k+1 case to make part of it look like the k case
• We then replace that part with the other side of the k case
k
P(k ) 2i k 2 k
i 1
k 1
2
i
i
k1
( k 1) 2
k 1
2(k 1) 2i (k 1) 2 k 1
i 1
2(k 1) k 2 k (k 1) 2 k 1
k 2 3k 2 k 2 3k 2
Third induction example
• Rosen, question 7: Show n
n(n 1)( 2n 1)
i 1
2
i
6
1
1(1 1)( 2 1)
• Base case: n = 1
i 1
i
2
6
6
1
2
6
11
• Inductive hypothesis: assume
k
k (k 1)( 2k 1)
i 1
i
2
6
Third induction example
• Inductive step: show
k 1
(k 1)(( k 1) 1)( 2(k 1) 1)
i 1
i 2
6
k 1
(k 1)(( k 1) 1)( 2(k 1) 1)
i 1
i 2
6
k
(k 1)( k 2)( 2k 3)
(k 1) i
2 2
i 1 6
k (k 1)( 2k 1) (k 1)( k 2)( 2k 3)
(k 1)
2
6 6
6(k 1) 2 k (k 1)(2k 1) (k 1)(k 2)(2k 3)
2k 3 9k 2 13k 6 2k 3 9k 2 13k 6
k
k (k 1)( 2k 1)
i 1
i
2
6
Third induction again: what if your inductive
hypothesis was wrong?
• Show: n
n(n 1)( 2n 2)
i 1
i
2
6 1
1(1 1)( 2 2)
• Base case: n = 1:
i 2
i 1 6
7
12
6
7
1
6
6
Third induction again: what if your inductive
hypothesis was wrong?
• Inductive step: show k 1
(k 1)(( k 1) 1)( 2(k 1) 2)
i 1
i
2
6
k 1
(k 1)(( k 1) 1)( 2(k 1) 2)
i 1
i
2
6
k
(k 1)( k 2)( 2k 4)
(k 1) 2 i 2
i 1 6
k (k 1)( 2k 2) (k 1)( k 2)( 2k 4)
(k 1)
2
6 6
6(k 1) 2 k (k 1)(2k 2) (k 1)(k 2)(2k 4)
k
k (k 1)( 2k 2)
2k 3 10k 2 14k 6 2k 3 10k 2 16k 8
i 1
i 2
6
Fourth induction example
• Rosen, question 14: show that n! < nn for all n > 1
• Base case: n = 2
2! < 22
2<4
• Inductive hypothesis: assume k! < kk
• Inductive step: show that (k+1)! < (k+1)k+1
• Strong mathematical induction assumes P(1), P(2), …, P(k) are all true,
and uses that to show that P(k+1) is true.