Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4...

15

Click here to load reader

Transcript of Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4...

Page 1: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion Principle

Sandy Irani

ICS 6D

Page 2: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

The Sum Rule (Review)

• For finite sets A1, A2,…, An ,

If the sets are pairwise disjoint (Ai ∩ Aj = φ, for i≠j)

then |A1 ∪ A2 ∪ … ∪ An|= |A1| + |A2| + … + |An|

• What if the sets are not pairwise disjoint?

Page 3: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion Example

• How many strings of length 6 over the alphabet {A, B, C} start with a C or a B?

• How many strings of length 6 over the alphabet {A, B, C} start with a C or end with a C?

Page 4: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion 2 Sets

• |A ∪ B| = |A| + |B| - |A ∩ B|

• S general population of elements

• P1 is the set of elements with property 1

• P2 is the set of elements with property 2

• How many elements in S have property 1 or 2 (inclusive or)?

| P1 ∪ P2| = Number of elements with property 1

+ Number of elements with property 2

- Number of elements with both properties.

Page 5: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion Example

• How many 5-card hands from a standard playing hand have exactly one King or exactly one Ace (or both)?

*

Page 6: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion Example

• How many strings of length 6 over the alphabet {A, B, C} have at least 5 consecutive A’s?

Page 7: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion with 3 Sets

• |A ∪ B ∪ C| = |A| + |B| + |C|

- |A ∩ B| - |A ∩ C| - |B ∩ C|

+ |A ∩ B ∩ C|

Page 8: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion with 3 Sets

• Drug test on a population of 1000 people – 122 people develop symptom A

– 88 people develop symptom B

– 112 people develop symptom C

– 27 people develop symptom A and B

– 29 people develop symptom A and C

– 32 people develop symptom B and C

– 10 people develop all three symptoms

• How many people get at least one symptom?

Page 9: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion with 3 Sets

• Line up of 7 people:

– Mother, Father, 3 sons, 2 daughters

• How many line-ups are there in which the mother is next to at least one of her 3 sons?

Page 10: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion Example

• How many strings of length 6 over the alphabet {A, B, C, D, E} have at least 4 consecutive A’s?

*

Page 11: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Incl/Excl 3 Sets

• How many integers in the range 1 through 42 are divisible by 2, 3, or 7?

Page 12: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion with 4 Sets

• |A ∪ B ∪ C ∪ D | = |A| + |B| + |C| + |D|

- |A ∩ B| - |A ∩ C| - |B ∩ C|

- |A ∩ D| - |B ∩ D| - |C ∩ D|

+ |A ∩ B ∩ C| + |A ∩ B ∩ D|

+ |A ∩ C ∩ D| + |B ∩ C ∩ D|

- |A ∩ B ∩ C ∩ D|

Page 13: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Inclusion/Exclusion with 4 Sets

• Suppose you are using the inclusion-exclusion principle to compute the number of elements in the union of four sets. – Each set has 15 elements.

– The pair-wise intersections have 5 elements each.

– The three-way intersections have 2 elements each.

– There is only one element in the intersection of all four sets. What is the size of the union?

• What is the size of the union?

Page 14: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

Incl/Excl and counting by complement

• How many 5-card hands have at least one ace or at least one queen (inclusive or)?

Page 15: Inclusion/Exclusion Principleirani/w17-6D/BoardNotes/21_InclExclPost.pdfInclusion/Exclusion with 4 Sets • Suppose you are using the inclusion-exclusion principle to compute the number

More Donut Selection

• How many ways to select 20 donuts from 4 varieties. There is a large selection of glazed and maple. But there are only 5 chocolates left and only 3 jelly left. (# chocolates must be ≤ 5)

Number of selections with at most 5

chocolate donuts and at most 3

Jelly donuts

Number of selections

with no restrictions

Number of selections with more than 5 chocolate donuts OR more than 3 chocolate donuts

= -