Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Inclusion Exclusion - Discrete Mathematics and its Applications - Lecture Slides, Slides of Discrete Mathematics

During the study of discrete mathematics, I found this course very informative and applicable.The main points in these lecture slides are:Inclusion Exclusion, Second Term Counts, Number of Elements, Subset of Elements, Non-Negative Integers, Connection with De Morgan’s Law, Number of Onto-Functions, Surjective Functions, Derangements, Hatcheck Problem

Typology: Slides

2012/2013

Uploaded on 04/27/2013

atmaja
atmaja 🇮🇳

4.2

(45)

182 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 18
6.5 & 6.6 Inclusion-Exclusion
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Inclusion Exclusion - Discrete Mathematics and its Applications - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

Lecture 18

6.5 & 6.6 Inclusion-Exclusion

6.5 Inclusion-Exclusion

A A B

U

A  B | A  B | |= A | + | B | −| A B|

It’s simply a matter of not over-counting the blue area in the intersection.

General Case

(^1 21) ( ) ( ) 1

| ... | | | | | | | ... ( 1) | ... |

n n (^) i i (^) pairs ij i j (^) triples ijk i j k n i j k n

A A A A A A A A A A A A A

=

= − + −

   

Proof: We show that each element is counted exactly once. Assume element ‘a’ is in r sets out of the n sets A1,...,An. -The first term counts ‘a’ r-times=C(r,1). -The second term counts ‘a’ -C(r,2) times (there are C(r,2) pairs in a set of r elements). -The k’th term counts ‘a’ -C(r,k) times (there are C(r,k) k-subsets in a set of r elements). -...

_- If k=r then there are precisely (-1)^(r+1) C(r,r) terms.

  • For k>r ‘a’ is not in the intersection: it is counted 0 times. Total: C(r,1)-C(r,2)+...+(-1)^(r+1)C(r,r)_

Now use: (^) 0 to show that each element is counted exactly once 1 1

( 1) ( , ) 0 1 ( 1) ( , )

r (^) k k r k k

C r k C r k

=

=

− = ⇒ = −

∑ ∑ Docsity.com

Applications of Incl.-Excl.

We can use inclusion/exclusion to count the number of members of a set that do not have a bunch of properties: P1,P2,...,Pn.

Call N(Pi,Pj,Pk,...) the number of elements of a set that do have properties Pi, Pj, Pk,.... and N the total number of elements in the set.

By inclusion/exclusion we then have:

Theorem: Let Ai be the subset of elements of a set A that has property Pi. The number of elements in a set A that do not have properties P1,...Pn is given then by: 1 2 3 1 , 1 , , 1 1 2

n n n n i i j i j k n n i i ji j i j ki j k i j k i j k

A A A A A

N N P N P P N P P P N P P P

with N P P P A A A

= (^) < = (^) < <=

Examples

Compute the number of solutions to x1+x2+x3= where x1,x2,x3 non-negative integers and x1 <=3, x2<=4, x4<=6. P1: x1 > 3 P2: x2 > 4 P3: x3 > 6 The solution must have non of the properties P1,P2,P3. The solution of a problem x1+x2+x3=11 with constraints x1 > 3 is solved as follows:

x1 x2 x

7 more balls 4 balls in basket x already.

Total number of ways: C(7+3-1,7)=

Therefore: N-N(P1)-N(P2)-N(P3)+N(P1,P2)+N(P2,P3)+N(P1,P3)-N(P1,P2,P3) C(11+3-1,11) – C(7+3-1,7) – C(6+3-1,6) ... – 0. Docsity.com

Connection with De Morgan’s law

1 1

1 1 1 ,^1

1

| | | | | | | | ... ( 1) | ... |

n n i i^ i i n n n n (^) n i i^ i i^ i^ i^ i j i^ j^ n i j n i i

A A

A U A U A A A A A

A

= =

= = = <

=

= →

= − = − + + + −

=

∑ ∑ ^ ^ 

 

 

 (^) So we have 2 ways to solve the last example: x1+x2+x3 = 11 such that non of the following properties hold: P1: x1 > 3 P2: x2 > 4 P3: x3 > 6 or x1+x2+x3=11 such all of the following properties hold: Q1=NOT P1: 0<x1<= Q2=NOT P2: 0<x2<= Q3=NOT P3: 0<x3<=

Sometimes this is easier to compute.

Number of Onto-Functions

A B

f

x y

There is no element without incoming arrows

N-N(P1)-N(P2) ... + N(P1,P2) -...+(-1)^n N(P1,...,Pn).

N: number of function from A  B: n^m N(Pi): number of functions that do not have y1 in its range: (n-1)^m. There are n=C(n,1) such terms. N(Pi,Pj): (n-2)^m with C(n,2) terms.

Total: n^m – C(n,1)(n-1)^m + C(n,2)(n-2)^m – ...+(-1)^(n-1)C(n,n-1)1^m.

Derangements

A derangement: is a permutation that leaves non of the elements in its place.

Example: (3,2,1) is not a derangement, but (2,3,1) is one. Then: how many derangements are there of a set of n elements. This is the answer to the Hatcheck problem: If n people check in their hats and the employee randomly returns hats back to people: what is the probability no-one gets their own hat back:  P = number of derangements of n / total number of permutations = Dn / n!

Derangements

More generally we have:

N(Pi) = (n-1)! and there are C(1,n) such terms N(Pi,Pj) = (n-2)! and there are C(n,2) such terms.

Total: Dn = n! – C(n,1)(n-1)! + C(n,2)(n-2)! - ...+ (-1)^n C(n,n) (n-n)! = n! – [n!/1!(n-1)!] (n-1)! + n!/2!(n-2)!! ... = n!(1-1/1! + 1/2! -1/3!+...+(-1)^n 1/n!)

P(hatcheck) = 1-1/1!+1/2!-...(-1)^n1/n! = 0.368 if n is large.

so even if 1M people check in their hat there is a probability of 0.368 that no-one gets there hat returned correctly.

THE END...

Next time we will do a review of the material you need to know for your final exam.

This will be useful if you want to know what kind of questions to expect and on what topics.

I will also ask you to fill out evaluation forms.