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.

Slides:



Advertisements
Similar presentations
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| = ?
Advertisements

1 Section 4.3 Permutations & Combinations. 2 Permutation Set of distinct objects in an ordered arrangement An ordered arrangement of r members of a set.
Section 4.1: The Basics of Counting As we have seen, one way to count the number of objects in a finite set S is to produce a one-to-one correspondence.
Section 11 Direct Products and Finitely Generated Abelian Groups One purpose of this section is to show a way to use known groups as building blocks to.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Chapter 7 Logic, Sets, and Counting
Inclusion-Exclusion Formula
Counting and Probability The outcome of a random process is sure to occur, but impossible to predict. Examples: fair coin tossing, rolling a pair of dice,
Chapter 7 Logic, Sets, and Counting Section 3 Basic Counting Principles.
Discrete Structures & Algorithms More about sets EECE 320 — UBC.
CSE115/ENGR160 Discrete Mathematics 04/19/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 04/21/11 Ming-Hsuan Yang UC Merced 1.
Lecture 14: Oct 28 Inclusion-Exclusion Principle.
1 Section 1.7 Set Operations. 2 Union The union of 2 sets A and B is the set containing elements found either in A, or in B, or in both The denotation.
Copyright © Zeph Grunschlag, Counting Techniques Zeph Grunschlag.
1 Section 4.1 Basics of Counting. 2 Basic Counting Principles: Sum Rule Suppose you have two tasks to perform: –The first task can be done in n 1 ways;
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Discrete Mathematics Lecture 6 Alexander Bukharovich New York University.
Discrete Math for CS Chapter 5: Functions. Discrete Math for CS New Relation Operations: Given R, a relation on A x B, we define the inverse relation,
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Copyright © Cengage Learning. All rights reserved. CHAPTER 9 COUNTING AND PROBABILITY.
4.4.2 Combinations of multisets
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Copyright © 2007 Pearson Education, Inc. Slide 8-1.
Advanced Counting Techniques
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Introduction to Proofs
Counting. Why counting  Determine the complexity of algorithms To sort n numbers, how many instructions are executed ?  Count the number of objects.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A.
Binomial Coefficients, Inclusion-exclusion principle
9.3 Addition Rule. The basic rule underlying the calculation of the number of elements in a union or difference or intersection is the addition rule.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
1 Lecture 4 (part 1) Combinatorics Reading: Epp Chp 6.
Inclusion-Exclusion Selected Exercises Powerpoint Presentation taken from Peter Cappello’s webpage
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
1 Binomial Coefficients CS 202 Epp, section ??? Aaron Bloomfield.
The Principle of Inclusion-Exclusion
The Basics of Counting Section 6.1.
15.1 Inclusion/Exclusion OBJ:  to use the inclusion- exclusion principle to solve counting problems involving intersections and unions of sets.
Section Section Summary The Product Rule The Sum Rule The Subtraction Rule The Division Rule Examples, Examples, and Examples Tree Diagrams.
CS201: Data Structures and Discrete Mathematics I
Sets Math 123 September 15.
CompSci 102 Discrete Math for Computer Science
2.2 Set Operations. The Union DEFINITION 1 Let A and B be sets. The union of the sets A and B, denoted by A U B, is the set that contains those elements.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
Counting Techniques. L172 Agenda Section 4.1: Counting Basics Sum Rule Product Rule Inclusion-Exclusion.
Slide Copyright © 2009 Pearson Education, Inc. Unit 1 Number Theory MM-150 SURVEY OF MATHEMATICS – Jody Harris.
1 CS 140 Discrete Mathematics Combinatorics And Review Notes.
CS Lecture 11 To Exclude Or Not To Exclude? + -
Binomials – Addition / Subtraction Binomial sum – the addition of two binomials. Similar to monomial sum except you now have two terms to add together.
UNIT 3. OUTLINE: Sets and Subsets Set Operations the Laws of Set Theory Counting and Venn Diagrams. A First Word on Probability. The Axioms of Probability.
Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University.
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Section Basic Counting Principles: The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n 1.
Binomial Coefficients and Identities
3/7/20161 Now it’s time to look at… Discrete Probability.
THE NATURE OF SETS Copyright © Cengage Learning. All rights reserved. 2.
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.
Principle of Inclusion and Exclusion
Counting by Complement and the Inclusion/Exclusion Principle
Discrete Structures for Computer Science
Section 16 Inclusion/Exclusion
Set, Combinatorics, Probability & Number Theory
COUNTING AND PROBABILITY
Section 16 Inclusion/Exclusion
Inclusion-Exclusion Principle
Counting Elements of Disjoint Sets: The Addition Rule
Counting Elements of Disjoint Sets: The Addition Rule
Presentation transcript:

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 union of 2 sets is the sum of the number of elements in each set minus the number of elements in the intersection of the 2 sets: |A  B| = |A| + |B| - |A  B|

3 Example 1 A discrete math class consists of 4 students taking Software Design, 3 students taking CS2, 2 students taking neither, and 1 student taking both. How many students are in the class? –Let |A| = # in SD, |B| = # in CS2, |C| = # in neither –So |A  B| = # taking both and |A  B  C| = # in discrete –|A  B  C| = |A| + |B| + |C| - |A  B| = =8

4 Example 2 How many positive integers not exceeding 100 are divisible by 2 or 5? –|A| = # divisible by 2 =  100/2  = 50 –|B| = # divisible by 5 =  100/5  = 20 –|A  B| = # divisible by both; since they are mutually prime, this is the numbers divisible by 2*5 =  100/10  = 10 –So |A  B| = = 60

5 Example 3 We can use similar means to find the number of elements outside the union of 2 sets: A recent survey found that 96% of U.S. households have at least one television, 98% have phone service, and 95% have both; what percentage of households have neither?

6 Solution for example 3 Let |A| = % of households with TV (96) and |B| = % of households with phone service (98) We know that 95% have both; this is |A  B| The total number of households that have either TV or phone service, |A  B| is: |A| + |B| - |A  B| = = 99 The total number of households is 100%, so the number that have neither TV nor phone is , or 1%

7 Finding the number of elements in the union of 3 sets The sum |A| + |B| + |C| counts the number of elements in one set once, the number in 2 sets twice, and the number in all 3 sets 3 times Subtracting the number of elements in any pair of the sets eliminates the double counting: |A|+|B|+|C| - |A  B| - |A  C| - |B  C| But this also eliminates all elements appearing in all 3; so we add those elements back in: |A|+|B|+|C| - |A  B| - |A  C| - |B  C| + |A  B  C|

8 Example 4 Suppose there are 2504 computer science majors at a school; of these: –1876 have taken C++, 999 have taken Java, 345 have taken C and –876 have taken both Java and C++, 231 have taken C++ and C, and 290 have taken Java and C How many CS majors have not taken any of these languages?

9 Example 4 Let |J| be the number who have taken Java (999), |P| be the number who have taken C++ (1876) and |C| the number who have taken C (345) Then: |J  P  C| = |J|+|P|+|C| - |J  P| - |J  C| - |P  C| + |J  P  C| = 2012 So or 492 have taken none of these languages

10 Principle of Inclusion/Exclusion Let A 1, A 2, …, A n be finite sets; then |A 1  A 2  …  A n | =  |A i | -  |A i  A j | + 1  i  n 1  i<j  n  |A i  A j  A k | - … + 1  i<j<k  n (-1) n+1 |A 1  A 2  …  A n |

11 Proof We want to show that each element in the union of the sets is counted exactly once; suppose a is a member of exactly r of the sets A 1 … A n where 1  r  n. This element is counted: C(r,1) times by  |A i | and C(r,2) times by  |A i  A j | and, in general, C(r,m) times by summation involving m of the sets So element a is counted C(r,1)-C(r,2)+C(r,3)- … +C(r,r) times

12 Proof continued Recall the binomial theorem: (x+y) n =  C(n,j)x n-j y j (as j goes from 0 to n) We can show from this theorem that  (-1) k C(n,k) = 0 (as k goes from 0 to n); thus C(r,1) - C(r,2) + C(r,3)- … +(-1) r C(r,r) = 0 Changing the exponent of -1 in the last term to r+1 gives us: C(r,1) - C(r,2) + C(r,3)- … +(-1) r+1 C(r,r) = 1 So each element in the union is counted exactly once.