Download presentation
1
Inclusion-Exclusion Formula
2
Sk Let A1, A2, …, An be n sets in a universe U of N elements. Let:
S1 = |A1| + |A2| + …+ |An| S2 = |A1 A2| + |A1 A3| + …+ |An-1 An|, i.e., the size of all AiAj for i j. Sk = |A1 A2 …Ak| + |A1 A2 …Ak+1| + …+ |An-k+1 An-k+2 … An-1An|, i.e., the sizes of all k-ary intersections of the sets. How many terms are there in S1 , S2 , Sn , Sk?
3
The Inclusion-Exclusion Formula
The # of elements in none of the sets is: | A1 A2 …An | = N - S1 + S2 - S3 + …+(-1)n Sn Proof We show that the formula counts each element in: none of the sets once 1 or more of the sets a net of 0 times.
4
Case: An element that is in none.
Such an element is added once in the 1st term: N Since this element is in none of the Ais, it is in none of the Si, thus is counted a net of 1 time. Case: An element is in exactly 1 of the Ais. It is added once in the 1st term, N. It is subtracted once in S1. It is in no other term, thus is counted a net of 0.
5
Case: An element is in exactly 2 of the Ais.
It is added once in the 1st term, N. It is subtracted twice in S1. It is added once in S2. It is in no other term, thus is counted a net of 0 times.
6
Case: An element is in exactly k of the Ais.
It is added once in the 1st term, N. It is subtracted C(k, 1) times in S1. It is added C(k,2) times in S2. It is subtracted C(k,3) times in S An element in exactly k sets cannot be in any intersection of more than k of the Ais.
7
The net count for such an element is:
This binomial sum equals (1 + x)k, for x = -1. Thus, its value is exactly 0. In general, the formula counts elements in 1 or more of the sets exactly 0 times.
8
Corollary |A1 + A2 +. . .+ An| = S1 - S2 + S3 - S1 - ...+ (-1)n-1Sn.
Proof: A1 + A An = U - A1 A2 …An Thus, a count is: N - [N - S1 + S2 - S3 + …+(-1)n Sn] = S1 - S2 + S3 - S (-1)n-1Sn.
9
Inclusion-Exclusion Pattern
To count the elements of a set that has: property 1 and property 2 and … and property n Define: A1 as the set of elements that do not have property 1 A2 as the set of elements that do not have property 2 etc. Then, A1 A2 …An is the set of all elements that have property 1 and property 2 and … and property n.
10
Inclusion-Exclusion Pattern
To count the elements of a set that has: property 1 or property 2 or … or property n Define: A1 as the set of elements that have property 1 A2 as the set of elements that have property 2 etc. Then, A1 + A An is the set of all elements that have property 1 or property 2 or … or property n.
11
Example 1 How many ways are there to roll 10 distinct dice so that all 6 faces appear? Let Ai be the set of ways that face i does not appear. Then, we want |A1 A2 A3 A4 A5 A6 | = N - S1 + S2 - S3 + S4 - S5 + S6 = 610 - C(6,1)510 + C(6,2)410 + C(6,3)310 + C(6,4)210 + C(6,5)110
12
Example 2 What is the probability that a 10-card hand has at least one 4-of-a-kind? Let A1 be the set of all 10-card hands with 4 aces. … Let AK be the set of all 10-card hands with 4 kings. Then, we want |A1+ A AK| = S1 - S2 + S S13 = C(13,1)C(48,6) - C(13,2)C(44,2) The probability = [C(13,1)C(48,6) - C(13,2)C(44,2)] / C(52,10)
13
Example 3 How many integer solutions of
x1 + x2 + x3 + x4 = 30 are there with: 0 xi, x1 5, x2 10, x3 15, x4 21 ? Let A1 be the set of solutions where x1 6. Let A2 be the set of solutions where x2 11. Let A3 be the set of solutions where x3 16. Let A4 be the set of solutions where x4 22. We want |A1 A2 A3 A4| = N - S1 + S2 - S3 + S4
14
N = C( , 4 - 1) A1 = C( , 4 - 1) A2 = C( , 4 - 1) A3 = C( , 4 - 1) A4 = C( , 4 - 1) A1 A2 = C( , 4 - 1) A1 A3 = C( , 4 - 1) A1 A4 = C( , 4 - 1) A2 A3 = C( , 4 - 1) A2 A4 = 0 = A3 A4 All 3-intersections & 4-intersections have 0 elements in them.
15
Derangements What is the probability that if n people randomly reach into a dark closet to retrieve their hats, no person receives their own hat? Let Ai be the set outcomes where person i receives his/her own hat. We need |A1 A2 ... An| = N - S1 + S2 - S3 + … + (-1)n Sn N = n! |Ai| = (n-1)!, |AiAj| = (n-2)!, …, |A1A2... An|= 0!
16
N - S1 + S2 - S3 + … + (-1)n Sn= n! - C(n,1)(n-1)! + C(n,2)(n-2)! - … + (-1)n C(n,n)0! Since C(n,k) = n!/[k!(n-k)!], C(n,k) (n-k)! = n!/k!. Thus, the sum equals n! - n!/1! + n!/2! - n!/3! + … + (-1)n n!/n! =
17
This sum is the number of good outcomes.
The probability, then, is this number over all possible outcomes (n!) :
18
This is the 1st n + 1 terms of the power series for
This power series converges quickly. The numerator of the probability, the number of permutations that leave no element fixed, denoted Dn, is called the number of derangements of n elements.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.