Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
⌧ ⌧
• Readings:
Rosen section 7.5-7.6
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
⌧ ⌧
• How many elements are in the union of finite sets?
A 1 A 2
A 3
|A 1 ∪A 2 ∪A 3 | = |A 1 | + |A 2 | + |A 3 |
- |A 1 ∩A 2 | - |A 2 ∩A 3 | - |A 3 ∩A 1 | + |A 1 ∩A 2 ∩A 3 |
⌧ ⌧
• Let A 1 ,A 2 ,…,A n be finite sets. Then
n n
n k j i
k j i
n j i
j i n
i i n
A A
A A A A
A A A
A A
A
∩
∩
∩
− +
−
∩
∩ +
∩
−
=
∪
∪
∪
+
≤
≤
≤
≤
≤
≤
≤
≤
≤
∑
∑
∑
L L
L
2 1 1 1
1 1
2 1
) 1 (
• Examples:
=
∪
∪
∪ 2 3 4
1 A A A
A
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
⌧ ⌧
• Showing that an element in the union is counted exactly once.
Let x be an element of exactly r sets.
For example, x is an element of A 1 , A 2 , …,A r , But not of A r+1 , A r+2 , …,A n .
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
n n
n ir i i
ir i
i r
n i i i
i i i n i i
i i n i
i
A A
A
A A
A A A A
A A A
∩
∩
∩
− + +
∩
∩
∩
− +
−
∩
∩ +
∩
−
+
≤
≤
≤
≤
≤ +
≤
≤
≤
≤
≤
≤
≤
≤
≤
∑
∑
∑
∑
L L
L L
L 2 1 1
2 1 1
2 1 1
3 2 1 1
3 2 1 2 1 1
2 1 1
) 1 (
) 1 (
…. ….
the r sets of which x is an element
all n sets
• Count the number of elements that have none of n properties, P 1 , P 2 , …, P n
• E.g.:
P 1 : Got an ‘A’ from Physics I P 2 : Got an ‘A’ from Physics II
Number of students that never got any ‘A’s from
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Let A i be the subset of elements with property P i .
• Let denote the number of
elements with none of the properties P 1 ,P 2 ,..,P n
where N = the total number of elements.
) ( P 1 P 2 P n N ′ ′ L ′
n
n N A A A
P P P
N ( 1 ′ 2 ′ L ′ ) = − 1 ∪ 2 ∪ L ∪
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
n
n N A A A
P P P
N ( 1 ′ 2 ′ L ′ ) = − 1 ∪ 2 ∪ L ∪
) )
1 (
( )
(
2 1 1 1
1 1
2 1
n n
n k j i
k j i
n j i
j i n
i i n
A A
A A A A
A A A
N P P P N
∩
∩
∩
− +
−
∩
∩ +
∩
−
−
′ =
′
′
+
≤
≤
≤
≤
≤
≤
≤
≤
≤
∑
∑
∑
L L
L
) (
) 1 ( )
(
) ( )
( )
(
2 1 1
1 1
2 1
n n
n k j
i i j k
n j
i i j
n
i i
n
P P P N P
P P N
P P N P
N N
P P P N
L L
L
− + +
−
+
−
′ =
′
′
∑
∑
∑
≤
≤
≤
≤
≤
≤
≤
≤
≤
• Example:
How many solutions does x 1 +x 2 +x 3 =11 have, where x 1 is a non negative integer ≤ 3,
x 2 is a non negative integer ≤ 4,
and x 3 is a non negative integer ≤ 6?
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Example:
How many onto functions are there from a set with 6 elements to a set with 3 elements?
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Number of onto functions from a set of m elements to a set of n elements.
• Example:
How many ways are there to assign five different jobs to four employees if every employee is assigned at least one job?
• A derangement is a permutation of objects that leaves no object in its original position.
• Example:
Consider a sequence 12345.
21453
43512
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• The number of derangements of a set with n elements, D n = ?
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Example: “The Hatcheck Problem”
An employee checks the hats of n people at a restaurant. He forgot to put claim check numbers on the hats. When customers return for their hats, this checker gives hats chosen at random to them.
What is the probability that no one receives the
correct hat?