230 likes | 466 Views
7.6 Applications of Inclusion/Exclusion. Problem: Find the number of elements in a set that have none of n properties P1, P2, .. Pn . Intro. Ex: not divisible by 5 or 7. Let A i =subset containing elements with property P i N(P 1 P 2 P 3 … P n )=|A 1 ∩A 2 ∩…∩A n |
E N D
7.6 Applications of Inclusion/Exclusion Problem: Find the number of elements in a set that have none of n properties P1, P2, .. Pn.
Intro Ex: not divisible by 5 or 7
Let Ai=subset containing elements with property Pi N(P1P2P3…Pn)=|A1∩A2∩…∩An| N(P1’ P 2 ‘ P 3 ‘…Pn ‘)= number of elements with none of the properties P1, P2, …Pn =N - |A1 A2 … An| =N- (∑|Ai| - ∑|Ai ∩ Aj| + … +(-1)n+1|A1∩ A2 ∩…∩ An|) = N - ∑ N (Pi) + ∑(PiPj) -∑N(PiPjPk) +… +(-1)nN(P1P2…Pn)
N(P1’ P 2 ‘ P 3 ‘…Pn‘) Number of elements with none of the properties P1, P2, …Pn N(P1’ P 2 ‘ P 3 ‘…Pn ‘) = N - ∑ N (Pi) + ∑(PiPj) -∑N(PiPjPk) +… +(-1)nN(P1P2…Pn)
Ex 1: How many solutions does x1+x2+x3= 11 have where xi is a nonnegative integer with x1≤ 3, x2≤ 4, x3≤ 6 (note: harder than previous problems) Let P1: x1≥4, P2: x2≥5, P3: x3≥7 N(P1’ P 2 ‘ P 3 ‘ ) = N – N(P1) – N(P2) – N(P3) + N(P1P2)+ N(P1P3)+N(P2P3) –N(P1P2P3) =13C11 – 9C7 – 8C6 – 6C4 + 4C2 + 2C0 + 0 – 0 =78 – 36 – 28 – 15 + 6 + 1 + 0 – 0 = 6
Check the solution Check: • 3 4 4 • 3 3 5 • 1 4 6 • 2 3 6 • 2 2 6 • 3 2 6
Ex: 2: How many onto functions are there from a set A of 7 elements to a set B of 3 elements Let A={a1,a2,a3,a4,a5,a6,a7}, B={b1,b2,b3} Let Pi be the property that bi is not an element of range(f) N(P1’ P 2 ‘ P 3 ‘ ) = N – N(P1) – N(P2) – N(P3) + N(P1P2)+ N(P1P3)+N(P2P3) –N(P1P2P3)
answer =37 -3C1*27 +3C2*17 -0 =2187-384+3 =1806 Note: Theorem 1 covers these problems in general.
Application: How many ways are there to assign 7 different jobs to 3 different employees if every employee is assigned at least one job?
Sieve- on numbers 2 to 100 The number of primes from 2-100 will be 4+N(P1’ P 2 ‘ P 3 ‘P 4 ‘ ) Define: P1: numbers divisible by 2 … P2: P3: P4: N(P1’ P 2 ‘ P 3‘P 4‘ ) = N – N(P1) – N(P2) – N(P3) - N(P4) +N(P1P2)+ N(P1P3)+N(P1P4)+N(P2P3)+N(P2P3)+N(P3P4) –N(P1P2P3)-N(P1P2P4)-N(P1P3P4)-N(P2P3P4) +N(P1P2P3P4) =… = = =
Hatcheck problem Question: A new employee checks the hats of n people and hands them back randomly. What is the probability that no one gets the right hat. (Similar question: If I don’t know anyone’s names, what’s the probability no one gets the right test back?) Term: “Derangement”- permutation of objects that leave NO object in its original place
Examples of derangements • For 1,2,3,4,5, make some examples of a derangement: • Some non-examples:
Thm. 2: The number of derangements of a set with n elements is… Dn= n![1 - ] In order to prove this, we will use the N(P1’ P 2 ‘ P 3 ‘…Pn ‘) formula. But, first we calculate: N=___ N(Pi)=___ N(PiPj)=___
Proof of derangement formula Since N=n!, N(Pi)=(n-1)!, N(PiPj)=(n-2)!,… Dn = N(P1’ P 2 ‘ P 3 ‘…Pn ‘)= = N - ∑N(Pi) + ∑N(PiPj) + -∑N(PiPjPk) +…+(-1)nN(P1P2…Pn) =
Dn Dn = N - ∑N(Pi) + ∑N(PiPj) + -∑N(PiPjPk) +…+(-1)nN(P1P2…Pn) =n! – nC1* (n-1)! + nC2*(n-2)!- … + (-1)n*nCn(n-n)! = … = n! – n!/1! + n!/2! - …+(-1)nn!/n! = n![1 - ]
Probability no one gets the same hat back… is Dn/n!= 1 – 1/1! + ½! - … (-1) n 1/n! As n, Dn/n!1/e =.368…
Other applications • Matching cards • Mailboxes • Passing tests back