Inclusion-Exclusion Rosen 6.5 & 6.6

Slides:



Advertisements
Similar presentations
THE WELL ORDERING PROPERTY Definition: Let B be a set of integers. An integer m is called a least element of B if m is an element of B, and for every x.
Advertisements

Mathematical Induction
Counting Techniques: Permutations of Selected Elements Addition Rule, Difference Rule, Inclusion/Exclusion Rule.
Lecture & 6.6 Inclusion-Exclusion. 6.5 Inclusion-Exclusion A AB U It’s simply a matter of not over-counting the blue area in the intersection.
7.6 Applications of Inclusion/Exclusion Problem: Find the number of elements in a set that have none of n properties P1, P2,.. Pn.
7.5 Inclusion/Exclusion. Definition and Example- 2 sets |A  B| =|A| + |B| - |A ∩ B| Ex1: |A|=9, |B|=11, |A∩B|=5, |A  B| = ?
Recursive Definitions and Structural Induction
Lecture 17 Generating Functions. Recap Generating functions are defined by a sequence as follows: Thus: For every sequence there a generating function.
Week 21 Basic Set Theory A set is a collection of elements. Use capital letters, A, B, C to denotes sets and small letters a 1, a 2, … to denote the elements.
Induction and recursion
The Inclusion/Exclusion Rule for Two or Three Sets
Copyright © Cengage Learning. All rights reserved. CHAPTER 9 COUNTING AND PROBABILITY.
CSE115/ENGR160 Discrete Mathematics 03/29/11 Ming-Hsuan Yang UC Merced 1.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Induction and recursion
Operations on Sets – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Operations on Sets Reading: Kolman, Section 1.2.
Induction and recursion
Discrete Mathematics, 1st Edition Kevin Ferland
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Binomial Coefficients, Inclusion-exclusion principle
Mathematical Induction II Lecture 21 Section 4.3 Mon, Feb 27, 2006.
1 ENM 503 Block 1 Algebraic Systems Lesson 2 – The Algebra of Sets The Essence of Sets What are they?
April 14, 2015Applied Discrete Mathematics Week 10: Equivalence Relations 1 Properties of Relations Definition: A relation R on a set A is called transitive.
CS201: Data Structures and Discrete Mathematics I
CompSci 102 Discrete Math for Computer Science
SECTION 2-3 Set Operations and Cartesian Products Slide
Section 3.3: Mathematical Induction Mathematical induction is a proof technique that can be used to prove theorems of the form:  n  Z +,P(n) We have.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Counting Techniques. L172 Agenda Section 4.1: Counting Basics Sum Rule Product Rule Inclusion-Exclusion.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
Basic Principles (continuation) 1. A Quantitative Measure of Information As we already have realized, when a statistical experiment has n eqiuprobable.
Rosen 1.6, 1.7. Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by.
Ch. 2 Basic Structures Section 1 Sets. Principles of Inclusion and Exclusion | A  B | = | A | + | B | – | A  B| | A  B  C | = | A | + | B | + | C.
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
1 Section 6.5 Inclusion/Exclusion. 2 Finding the number of elements in the union of 2 sets From set theory, we know that the number of elements in the.
MAT 2720 Discrete Mathematics Section 2.2 More Methods of Proof Part II
Functions (Mappings). Definitions A function (or mapping)  from a set A to a set B is a rule that assigns to each element a of A exactly one element.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
Mathematical Induction
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Induction Practice CS1050. Prove that whenever n is a positive integer. Proof: Basis Case: Let n = 1, then.
Pigeonhole Principle. If n pigeons fly into m pigeonholes and n > m, then at least one hole must contain two or more pigeons A function from one finite.
Section The Pigeonhole Principle If a flock of 20 pigeons roosts in a set of 19 pigeonholes, one of the pigeonholes must have more than 1 pigeon.
1 Closures of Relations Based on Aaron Bloomfield Modified by Longin Jan Latecki Rosen, Section 8.4.
Main Menu Main Menu (Click on the topics below) Pigeonhole Principle Example Generalized Pigeonhole Principle Example Proof of Pigeonhole Principle Click.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Section 9.1. Section Summary Relations and Functions Properties of Relations Reflexive Relations Symmetric and Antisymmetric Relations Transitive Relations.
Section 6.1 Set and Set Operations. Set: A set is a collection of objects/elements. Ex. A = {w, a, r, d} Sets are often named with capital letters. Order.
Principle of Inclusion and Exclusion
Counting by Complement and the Inclusion/Exclusion Principle
What is Probability? Quantification of uncertainty.
Set Operations Section 2.2.
Set, Combinatorics, Probability & Number Theory
Induction and recursion
Module #15: Combinatorics
Copyright © Cengage Learning. All rights reserved.
15.1 Venn Diagrams.
CSE 321 Discrete Structures
Module #15: Combinatorics
Counting Discrete Mathematics.
Inclusion-Exclusion Principle
Advanced Analysis of Algorithms
Copyright © Zeph Grunschlag,
Copyright © Zeph Grunschlag,
Mathematical Induction
Counting Elements of Disjoint Sets: The Addition Rule
Counting Elements of Disjoint Sets: The Addition Rule
Presentation transcript:

Inclusion-Exclusion Rosen 6.5 & 6.6 Longin Jan Latecki basd on Slides by Max Welling, University of California, Irvine Vardges Melkonian, Ohio University, Athens

6.5 Inclusion-Exclusion U A B It’s simply a matter of not over-counting the blue area in the intersection.

Example on Inclusion/Exclusion Rule (2 sets) Question: How many integers from 1 through 100 are multiples of 3 or multiples of 7 ? Solution: Let A=the set of integers from 1 through 100 which are multiples of 3; B = the set of integers from 1 through 100 which are multiples of 7. Then we want to find n(A  B). First note that A  B is the set of integers from 1 through 100 which are multiples of 21 . n(A  B) = n(A) + n(B) - n(A  B) (by incl./excl. rule) = 33 + 14 – 4 = 43 (by counting the elements of the three lists)

Now three Sets area = 4-3=1 U C area = 2-1=1 area = 1 B A Image a blue circle has area 4. The intersections between 2 circles have area 2 and the intersection between three circles 1. What is the total area covered? A=4+4+4 – 2 -2 -2 + 1 = 12 – 6 + 1 = 7.

Example on Inclusion/Exclusion Rule (3 sets) 3 headache drugs – A,B, and C – were tested on 40 subjects. The results of tests: 23 reported relief from drug A; 18 reported relief from drug B; 31 reported relief from drug C; 11 reported relief from both drugs A and B; 19 reported relief from both drugs A and C; 14 reported relief from both drugs B and C; 37 reported relief from at least one of the drugs. Questions: 1) How many people got relief from none of the drugs? 2) How many people got relief from all 3 drugs? 3) How many people got relief from A only?

Example on Inclusion/Exclusion Rule (3 sets) We are given: n(A)=23, n(B)=18, n(C)=31, n(A  B)=11, n(A  C)=19, n(B  C)=14 , n(S)=40, n(A  B  C)=37 Q1) How many people got relief from none of the drugs? By difference rule, n((A  B  C)c ) = n(S) – n(A  B  C) = 40 - 37 = 3 S A B C

Example on Inclusion/Exclusion Rule (3 sets) Q2) How many people got relief from all 3 drugs? By inclusion/exclusion rule: n(A  B  C) = n(A  B  C) - n(A) - n(B) - n(C) + n(A  B) + n(A  C) + n(B  C) = 37 – 23 – 18 – 31 + 11 + 19 + 14 = 9 Q3) How many people got relief from A only? n(A – (B  C)) (by inclusion/exclusion rule) = n(A) – n(A  B) - n(A  C) + n(A  B  C) = 23 – 11 – 19 + 9 = 2

The Principle of Inclusion-Exclusion 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: to show that each element is counted exactly once.

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:

A Picture U C B A

Examples Compute the number of solutions to x1+x2+x3=11 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: 7 more balls 4 balls in basket x1 already. Total number of ways: C(7+3-1,7)=36 x1 x2 x3 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) – C(4+3-1,4) + … – 0.

Connection with De Morgan’s law 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<=3 Q2=NOT P2: 0<x2<=4 Q3=NOT P3: 0<x3<=6 Sometimes this is easier to compute.

Number of Onto-Functions Onto or surjective functions: A function f from A to B is onto if for every element b in B there is an element a in A with f(a)=b. If we have m elements in A and n in B, how many onto functions are there? We want all yi in the range of the function f. Call Pi the property that yi is not in the range of the the function f. Then we are looking for the number of functions that has none of the properties P1,...,Pn x y f A B There is no element without incoming arrows

Number of Onto-Functions N(P1’P2’P3’) = 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. m=6 and n=3 N(P1’P2’P3’) = 3^6 – C(3,1)2^6 + C(3,2)1^6 = 540 x y f A B There is no element without incoming arrows