Upload
others
View
6
Download
0
Embed Size (px)
Citation preview
CSE20: Discrete Mathematics for Computer Science
Lecture Unit 8: Elementary Set Theory
Definition: Subset and proper subset
Definition: Set intersection and union
Set operations: Basic definitions
A �� B �� �x, such that x� A and x �� B
A � B �� (A � B) ���x� B such that x �� A
�
A � B =�
x : x� A and x� B
�
A � B =�
x : x� A or x� B
�
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 2
A � B �� �x, if x� A then x� B
A B
Definition: Set equalityA = B �� (A � B) � (B � A)
A B
A B
Set operations: Basic definitions
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 3
Definition: Set difference and symmetric differenceA� B = A \ B =
�x : x� A and x �� B
�
A� B =�
x : (x� A � x �� B) or (x� B � x �� A)�
A BA B
A� B = (A� B) � (B� A)Note:
A� B =�(x, y) : x� A and y� B
�Definition: Cartesian product of sets
A
k =�(x1, x2, . . . , x
k
) : x1, x2, . . . , x
k
� A
�
k
�i=1
A
i
=�(x1, x2, . . . , x
k
) : x1 � A1, x2 � A2, . . . , x
k
� A
k
�More generally:
More generally:
Algebraic rules for sets
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 4
P �Q = Q � P P �Q = Q � P
(P �Q) �R = P � (Q �R) (P �Q) �R = P � (Q �R)
(P �Q) � (P �R) = P � (Q �R)(P �Q) � (P �R) = P � (Q �R)(P �Q) � (P �R) = P � (Q �R)(P �Q) � (P �R) = P � (Q �R)
P � P = P P � P = P
P � (P �Q) = P P � (P �Q) = P
�P �Q
�c = P c �Qc�P �Q
�c = P c �Qc
Commutative Rule
Associative Rule
Distributive Rule
Idempotent Rule
Absorption Rule
DeMorgan Rule
In the table below P, Q, and R are arbitrary subsets of the same univer- sal set U; all the complements are with respect to U.
Venn diagrams
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 5
Venn diagrams for sets are similar to truth tables in propositional logic. They describe all possible intersections between several sets.
Q
R
P
PQ
P Q
PQcPcQ
PcQRPQcR
PQRc
PQR
PcQRcPQcRc
PcQcR
In general, a Venn diagram for n sets will have 2n distinct regions, similar to minterms in logic. For. example:.
PQ c
R
c =�
x � U : (x� P) � (x�Q c) � (x� R
c)�
Venn diagrams for 4 and 5 sets
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 6
Venn diagrams for sets are similar to truth tables in propositional logic. They describe all possible intersections between several sets.
A BC D
Beyond five sets, Venn diagrams become rather unwieldy.
BE
A
CD
Example: Prove that Q∩ (P∩R)c = Q∩ (P∩Q∩R)c Venn diagrams: Proving set identities
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 7
Q
R
P
1
2
3
4
8
6
7 5
(P∩Q∩R)c = { }1 2 3 4 5 6 7
P∩Q∩R = { }8
Q = { }2 5 6 8
(P∩R)c = { }1 2 3 4 5 6
2 5 6Q∩ (P∩Q∩R)c = { }Therefore:
7P∩R = { }8 Now:
Q = { }2 5 6 8
2 5 6Q∩ (P∩R)c = { } = Q∩ (P∩Q∩R)cTherefore:
Pascal Triangle Pascal triangle is a table and method to systematically compute the binomial coefficients for all n and k.(n
k)
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 1
�00
�=
�n0
�=
�nn
�= 1
Initialization:
�nk
�=
�n�1k�1
�+
�n�1
k
�Recursion:
k0 1 2 3 4 5 6 7 8
0 11 1 12 1 2 13 1 3 3 14 1 4 6 4 15 1 5 10 10 5 16 1 6 15 20 15 6 17 1 7 21 35 35 21 7 18 1 8 28 56 70 56 28 8 1
n
This triangle was described by Blaise Pascal in his Traité du Triangle Arith-métique (1653), though it was known to ancient Hindus, Greeks,and Chinese many centuries earlier (2-nd century BC).
Set partitionsLet A be an arbitrary set. A set partition of A is a set Ω ⊂ P(A) with the following properties:
Example: A = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
� =�{1}, {2}, {3, 5}, {4, 7}, {6, 8, 10}, {9, 11, 12}
�
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 9
X �Y = �
A =�
X��X
X �= �For all X∈Ω, we have1
For all X,Y∈Ω, either X =Y or2
The union of all X∈Ω is A itself: 3
The elements of a partition Ω ⊂ P(A) are called blocks. Note that blocks are themselves sets;. they are subsets of the original set A.
Example:
Counting partitions: Bell numbers The total number of different partitions of a set of size n is known as the Bell number B(n), defined as follows:
The Bell numbers B(n) and the Stirling numbers S(n,k) can be compu-ted recursively, in a manner similar to the Pascal triangle.
B(n) = S(n, 1) + S(n, 2) + · · · + S(n, n�1) + S(n, n)
Lecture Unit 8 CSE 20: Discrete Mathematics for Computer Science 10
k1 2 3 4 5 6 B(n)
1 1 12 1 1 23 1 3 1 54 1 7 6 1 155 1 15 25 10 1 526 1 31 90 65 15 1 203
n
S(n, 1) = S(n, n) = 1
Initialization:
S(n, k) =S(n�1, k�1) + kS(n�1, k)
Recursion: