Download Inclusion-Exclusion Principle and Applications

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Vincent's theorem wikipedia , lookup

Location arithmetic wikipedia , lookup

Law of large numbers wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Addition wikipedia , lookup

Pythagorean theorem wikipedia , lookup

Nyquist–Shannon sampling theorem wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Mathematical proof wikipedia , lookup

List of important publications in mathematics wikipedia , lookup

Central limit theorem wikipedia , lookup

Brouwer fixed-point theorem wikipedia , lookup

Fermat's Last Theorem wikipedia , lookup

Wiles's proof of Fermat's Last Theorem wikipedia , lookup

Non-standard analysis wikipedia , lookup

Four color theorem wikipedia , lookup

Elementary mathematics wikipedia , lookup

Theorem wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
Part 12
Inclusion-Exclusion and
Applications
Printed version of the lecture Discrete Mathematics on 7. October 2009
Tommy R. Jensen, Department of Mathematics, KNU
12.1
Contents
1
The Inclusion-Exclusion Principle
1
2
Applications of the Inclusion-Exclusion Principle
3
3
Derangements
4
4
Conclusion
5
12.2
1
The Inclusion-Exclusion Principle
Inclusion-exclusion for more than two sets
12.3
1
The general inclusion-exclusion principle
Notation
Let X be any set and k an integer. Then we can write
X
= {Y ⊆ X : |Y | = k},
k
for the set of k-subsets of X.
Theorem 6.1.1 (inclusion-exclusion principle)
Let A1 , A2 , . . . , Am be subsets of a finite set S.
Then
|A1 ∩ A2 ∩ · · · ∩ Am | = |S| +
m
(−1)k ∑ |Ai1 ∩ Ai2 ∩ · · · ∩ Aik |.
{i1 ,i2 ,...,ik }∈({1,2,...,m}
)
k
∑
k=1
Example. If A, B,C are subsets of S, then
|A ∩ B ∩C| = |S| − |A| − |B| − |C| + |A ∩ B| + |A ∩C| + |B ∩C| − |A ∩ B ∩C|.
12.4
Inclusion-exclusion principle in action
Example.
|A ∩ B ∩C| = |S| − |A| − |B| − |C| + |A ∩ B| + |A ∩C| + |B ∩C| − |A ∩ B ∩C|.
12.5
Proof of
m
|A1 ∩ A2 ∩ · · · ∩ Am | = |S| +
(−1)k ∑ |Ai1 ∩ Ai2 ∩ · · · ∩ Aik |.
{i1 ,i2 ,...,ik }∈({1,2,...,m}
)
k
∑
k=1
How much does an element of S contribute on the left side?
It contributes 1 if it is not an element of any set Ai .
Otherwise it contributes 0.
12.6
2
m
(−1)k ∑ |Ai1 ∩ Ai2 ∩ · · · ∩ Aik |.
{i1 ,i2 ,...,ik }∈({1,2,...,m}
)
k
How much does an element x of S contribute on the right side?
First we assume that x is in some set Ai , and prove that x contributes 0 to the right side.
|A1 ∩ A2 ∩ · · · ∩ Am | = |S| +
∑
k=1
Let A j1 , A j2 , . . . , A jn be the subsets that contain x, so 1 ≤ n ≤ m.
There is a contribution of 1 from x to |Ai1 ∩ Ai2 ∩ · · · ∩ Aik | if and only if {i1 , i2 , . . . , ik } ⊆ { j1 , j2 , . . . , jn }.
Because of the factor (−1)k the contribution is +1 if k is even and −1 if k is odd.
The number of even and odd subsets of { j1 , j2 , . . . , jn } are equal, and the contribution from x is −1
from every odd subset and +1 from every even subset except 0/ (because k > 0).
We deduce that x contributes +1 to |S| and −1 to the summation, so altogether x contributes 0 on the
right side.
12.7
m
|A1 ∩ A2 ∩ · · · ∩ Am | = |S| +
(−1)k ∑ |Ai1 ∩ Ai2 ∩ · · · ∩ Aik |.
{i1 ,i2 ,...,ik }∈({1,2,...,m}
)
k
∑
k=1
How much does an element x of S contribute on the right side?
Now we assume that x is not in any set Ai , and prove that x contributes 1 to the right side.
But this is clear, because x contributes +1 to |S| and 0 to the summation of the sizes of intersections of
the sets A1 , A2 , . . . , Am .
This proves the Theorem.
12.8
Another form of the principle
Corollary 6.1.2
Let A1 , A2 , . . . , Am be subsets of a finite set S.
Then
m
|A1 ∪ A2 ∪ · · · ∪ Am | =
∑
k=1
(−1)k+1 ∑ |Ai1 ∩ Ai2 ∩ · · · ∩ Aik |.
{i1 ,i2 ,...,ik }∈({1,2,...,m}
)
k
Proof of Corollary 6.1.2
|A1 ∪ A2 ∪ · · · ∪ Am | = |S| − |A1 ∩ A2 ∩ · · · ∩ Am |.
Now use Theorem 6.1.1.
2
12.9
Applications of the Inclusion-Exclusion Principle
Example
How many of the integers 1, 2, 3, . . . , 2009 are not divisible by any of the numbers 4, 5, 6?
Answer: Let S = {1, 2, 3, . . . , 2009}.
A1 = {4, 8, 12, . . . , 2008}, |A1 | = b 2009
4 c = 502.
A2 = {5, 10, 15, . . . , 2005}, |A2 | = b 2009
5 c = 401.
A3 = {6, 12, 18, . . . , 2004}, |A3 | = b 2009
6 c = 334.
The least common multiple of some numbers a1 , a2 , . . . , an is the smallest positive number which is
divisible by all of a1 , a2 , . . . , an . It is written as lcm{a1 , a2 , . . . , an }.
A1 ∩A2 contains exactly numbers divisible by 4 and 5. These are precisely the numbers {20, 40, 60, . . . , 2000}
divisible by lcm{4, 5} = 20. Therefore |A1 ∩ A2 | = b 2009
20 c = 100.
We get lcm{4, 6} = 12, so |A1 ∩ A3 | = b 2009
c
=
167.
12
And lcm{5, 6} = 30 implies |A2 ∩ A3 | = b 2009
30 c = 66.
3
Finally lcm{4, 5, 6} = 60, and |A1 ∩ A2 ∩ A3 | = b 2009
60 c = 33.
From Theorem 6.1.1:
|A1 ∩ A2 ∩ A3 | = 2009 − 502 − 401 − 334 + 100 + 167 + 66 − 33 = 1072.
12.10
3
Derangements
Derangements
Definition
A derangement of the set {1, 2, . . . , n} is a permutation i1 i2 . . . in of {1, 2, . . . , n} such that no number is in
its own place:
i1 6= 1, i2 6= 2, . . . , in 6= n.
From the online Wiktionary:
Adjective
deranged (comparative more deranged, superlative most deranged)
• 1. disturbed or upset, especially mentally
• 2. insane
Synonyms
* See also Wikisaurus:insane
12.11
The number of derangements
Theorem 6.3.1
The number of derangements of {1, 2, . . . , n} is equal to
1
1
1
1
Dn = n! 1 − + − + · · · + (−1)n
.
1! 2! 3!
n!
12.12
Proof of Theorem 6.3.1
Let S be the set of all permutations of {1, 2, . . . , n} : |S| = n!
For 1 ≤ j ≤ n let A j be the permutations i1 i2 . . . in with i j = j.
Then Dn = |A1 ∩ A2 ∩ · · · ∩ An |.
What are the permutations in A1 ∩ A2 ∩ · · · ∩ Ak ?
They are of the form i1 i2 . . . ik ik+1 . . . in = 12 . . . kik+1 . . . in , where ik+1 . . . in is any permutation of {k +
1, . . . , n}.
Since there are (n − k)! permutations of {k + 1, . . . , n} we get |A1 ∩ A2 ∩ · · · ∩ Ak | = (n − k)!
We obtain the same number (n − k)! of permutations that place any k numbers i1 , i2 , . . . , ik each in its
own place.
12.13
Proof of Theorem 6.3.1
Theorem 6.1.1 can now be used, with |S| = n! and |Ai1 ∩ Ai2 ∩ · · · ∩ Aik | = (n − k)! for all i1 , i2 , . . . , ik :
n
(−1)k ∑ |Ai1 ∩ Ai2 ∩ · · · ∩ Aik |
k=1 {i1 ,i2 ,...,ik }∈({1,2,...,n})
k
n
n
k n
k
(n − k)!
= n! + ∑
(−1) ∑(n − k)! = n! + ∑ (−1)
k
k=1 {i1 ,i2 ,...,ik }∈({1,2,...,n})
k=1
k
!
n
n
k 1
k n!
= n! 1 + ∑ (−1)
= n! + ∑ (−1)
k!
k!
k=1
k=1
1
1
1
1
= n! 1 − + − + · · · + (−1)n
.
1! 2! 3!
n!
Dn = |S| +
∑
12.14
4
4
Conclusion
Conclusion
This ends the lecture!
12.15
Next time:
Generating Functions
12.16
5