# 7.6 Applications of Inclusion/Exclusion Problem: Find the number of elements in a set that have none of n properties P1, P2,.. Pn.

## Presentation on theme: "7.6 Applications of Inclusion/Exclusion Problem: Find the number of elements in a set that have none of n properties P1, P2,.. Pn."— Presentation transcript:

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 Div by 5Div by 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 | N(P 1 ’ P 2 ‘ P 3 ‘…P n ‘)= 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) n N(P1P2…Pn)

N(P 1 ’ P 2 ‘ P 3 ‘…P n ‘) Number of elements with none of the properties P1, P2, …Pn N(P 1 ’ P 2 ‘ P 3 ‘…P n ‘) = N - ∑ N (Pi) + ∑(PiPj) -∑N(PiPjPk) +… +(-1) n N(P1P2…Pn)

Ex 1: How many solutions does x 1 +x 2 +x 3 = 11 have where xi is a nonnegative integer with x 1 ≤ 3, x 2 ≤ 4, x 3 ≤ 6 (note: harder than previous problems) Let P1: x1≥4, P2: x2≥5, P3: x3≥7 N(P 1 ’ 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(P 1 ’ P 2 ‘ P 3 ‘ ) = N – N(P1) – N(P2) – N(P3) + N(P1P2)+ N(P1P3)+N(P2P3) –N(P1P2P3)

answer =3 7 -3C1*2 7 +3C2*1 7 -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 of Eratosthenes 12345678910 11121314151617181920 21222324252627282930 31323334353637383940 41424344454647484950 51525354555657585960 61626364656667686970 71727374757677787980 81828384858687888990 919293949596979899100

Sieve- on numbers 2 to 100 The number of primes from 2-100 will be 4+N(P 1 ’ P 2 ‘ P 3 ‘P 4 ‘ ) Define: P1: numbers divisible by 2 … P2: P3: P4: N(P 1 ’ 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(P 1 ’ P 2 ‘ P 3 ‘…P n ‘) 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(P 1 ’ P 2 ‘ P 3 ‘…P n ‘)= = N - ∑N(Pi) + ∑N(PiPj) + -∑N(PiPjPk) +…+(-1) n N(P1P2…Pn) =

Dn = N - ∑N(Pi) + ∑N(PiPj) + -∑N(PiPjPk) +…+(-1) n N(P1P2…Pn) =n! – nC1* (n-1)! + nC2*(n-2)!- … + (-1) n *nCn(n- n)! = … = n! – n!/1! + n!/2! - …+(-1) n n!/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… N2345 Dn/n!.5.33333.335.36666

Other applications Matching cards Mailboxes Passing tests back

Download ppt "7.6 Applications of Inclusion/Exclusion Problem: Find the number of elements in a set that have none of n properties P1, P2,.. Pn."

Similar presentations