Inclusion-Exclusion Selected Exercises Powerpoint Presentation taken from Peter Cappello’s webpage www.cs.ucsb.edu/~capello.

Slides:



Advertisements
Similar presentations
22C:19 Discrete Math Counting Fall 2011 Sukumar Ghosh.
Advertisements

Inclusion-Exclusion Selected Exercises
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| = ?
Permutations and Combinations Rosen 4.3. Permutations A permutation of a set of distinct objects is an ordered arrangement these objects. An ordered arrangement.
Recursively Defined Functions
1. Number of Elements in A 2. Inclusion-Exclusion Principle 3. Venn Diagram 4. De Morgan's Laws 1.
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,
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.
Copyright © Zeph Grunschlag, Counting Techniques Zeph Grunschlag.
Operations on Sets Union Intersection: Two sets are disjoint if their intersection is the null set. Difference A - B. Complement of a set A.
Equivalence Relations: Selected Exercises
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.
The Basics of Counting: Selected Exercises. Copyright © Peter Cappello2 Sum Rule Example There are 3 sizes of pink shirts & 7 sizes of blue shirts. How.
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,
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Copyright © 2007 Pearson Education, Inc. Slide 8-1.
MAT 2720 Discrete Mathematics Section 6.1 Basic Counting Principles
Counting. Why counting  Determine the complexity of algorithms To sort n numbers, how many instructions are executed ?  Count the number of objects.
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
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.
Sets --- A set is a collection of objects. Sets are denoted by A, B, C, … --- The objects in the set are called the elements of the set. The elements are.
Chapter 7 Logic, Sets, and Counting Section 2 Sets.
The Principle of Inclusion-Exclusion
Mathematics.
Copyright © 2006 Brooks/Cole, a division of Thomson Learning, Inc. Sets and Counting6 Sets and Set Operations The Number of Elements in a Finite Set The.
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.
Counting Techniques. L172 Agenda Section 4.1: Counting Basics Sum Rule Product Rule Inclusion-Exclusion.
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.
1 CS 140 Discrete Mathematics Combinatorics And Review Notes.
CS Lecture 11 To Exclude Or Not To Exclude? + -
Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University.
Binomial Coefficients: Selected Exercises
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.
Copyright © Peter Cappello 2011 Simple Arrangements & Selections.
Set Operations Section 2.2.
Section 6.4. Powers of Binomial Expressions Definition: A binomial expression is the sum of two terms, such as x + y. (More generally, these terms can.
THE NATURE OF SETS Copyright © Cengage Learning. All rights reserved. 2.
The Basic Concepts of Set Theory. Chapter 1 Set Operations and Cartesian Products.
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.
Permutations & Combinations: Selected Exercises. Copyright © Peter Cappello2 Preliminaries Denote the # of arrangements of some k elements of a set of.
Section The Product Rule  Example: How many different license plates can be made if each plate contains a sequence of three uppercase English letters.
Recurrence Relations: Selected Exercises. Copyright © Peter Cappello2 Exercise 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded.
Recursive Definitions & Structural Induction: Selected Exercises
Equivalence Relations: Selected Exercises
Sequences, Series, and Probability
Generalized Permutations & Combinations: Selected Exercises
Permutations and Combinations
ALGEBRA II H/G - SETS : UNION and INTERSECTION
Techniques of Differentiation
CS 2210 Discrete Structures Counting
Set Operations Section 2.2.
Set, Combinatorics, Probability & Number Theory
Chapter 8: Further Topics in Algebra
Permutations and Combinations
COUNTING AND PROBABILITY
ALGEBRA I - SETS : UNION and INTERSECTION
Chapter 11: Further Topics in Algebra
ALGEBRA II H/G - SETS : UNION and INTERSECTION
Copyright © Zeph Grunschlag,
Copyright © Zeph Grunschlag,
Counting Elements of Disjoint Sets: The Addition Rule
Section 13.1 Counting.
Equivalence Relations: Selected Exercises
Presentation transcript:

Inclusion-Exclusion Selected Exercises Powerpoint Presentation taken from Peter Cappello’s webpage

Copyright © Peter Cappello The Principle of Inclusion-Exclusion | A 1  A 2 | = | A 1 | + | A 2 | - | A 1  A 2 | | A 1  A 2  A 3 | = | A 1 | + | A 2 | + | A 3 | - | A 1  A 2 | - | A 1  A 3 | - | A 2  A 3 | + | A 1  A 2  A 3 |

Copyright © Peter Cappello The Principle of Inclusion-Exclusion | A 1  A 2 ...  A n | = Σ | A i | - Σ | A i  A j | + Σ | A i  A j  A k | (-1) n-1 Σ | A 1  A 2 ...  A n |

Copyright © Peter Cappello Exercise 10 Find the number of positive integers not exceeding 100 that are not divisible by 5 or 7. (Numbers  100 that are not divisible by 5 and are not divisible by 7.) See Venn diagram.

Copyright © Peter Cappello Exercise 10 Solution Let the “bad” numbers be those that are divisible by 5 or 7. Subtract the number of “bad” numbers from the size of the universe: 100. –Let A 5 denote the numbers  100 that are divisible by 5. –Let A 7 denote the numbers  100 that are divisible by 7. –| A 5  A 7 | = | A 5 | + | A 7 | - | A 5  A 7 | = └ 100/5 ┘ + └ 100/7 ┘ - └ 100/(5. 7) ┘ = – 2 = 32. The answer is 100 – 32 = 68.

Copyright © Peter Cappello Exercise 14 How many permutations of the 26 letters of the English alphabet do not contain any of the strings fish, rat, or bird? See Venn diagram.

Copyright © Peter Cappello Exercise 14 Solution 1.Start with the universe: 26! 2.Subtract the permutations that contain: –fish. To count the number of permutations with a fixed substring: Treat the fixed substring as 1 letter. There are (26 – 4 + 1)! such permutations. –rat: (26 – 3 + 1)! –bird: : (26 – 4 + 1)! 3.Add the permutations that contain: –fish & rat: (26 – 4 – 3 + 2)! –fish & bird: 0 –rat & bird: 0 4.Subtract the permutations that contain all 3 strings There are 0 such permutations. Answer: 26! – 23! – 24! – 23! + 21!

Copyright © Peter Cappello Proof 1.An element in exactly 0 of the sets is counted by the RHS 0 times. 2.An element in exactly 1 of the sets is counted by the RHS 1 time. 3.An element in exactly 2 of the sets is counted by the RHS 2 – 1 = 1 time. 4.An element in exactly 3 of the sets is counted by the RHS 3 – = 1 time. m. An element in exactly m of the sets is counted by the RHS C( m, 1 ) – C( m, 2) + C( m, 3 ) (-1) m-1 C( m, m ) times.

Copyright © Peter Cappello Proof ( x + y ) n = C( n, 0 )x n y 0 + C( n, 1 )x n-1 y 1 + … C( n, n )x 0 y n Evaluate the Binomial Theorem, at x = 1, y = -1, we obtain (1 – 1) n = C( n, 0 ) – C( n, 1 ) + C( n, 2 ) - … + (-1) n-1 C( n, n )  C( n, 1 ) – C( n, 2 ) + … + (-1) n C( n, n ) = C( n, 0 ) = 1.

Copyright © Peter Cappello Exercise 18 How many terms are there in the formula for the # of elements in the union of 10 sets given by the inclusion-exclusion principle?

Copyright © Peter Cappello Exercise 18 Solution It is the sum of the: Terms with 1 set: C( 10, 1 ) Terms with 2-way intersections: C( 10, 2 ) Terms with 3-way intersections: C( 10, 3 ) Terms with 4-way intersections: C( 10, 4 ) Terms with 5-way intersections: C( 10, 5 ) Terms with 6-way intersections: C( 10, 6 ) Terms with 7-way intersections: C( 10, 7 ) Terms with 8-way intersections: C( 10, 8 ) Terms with 9-way intersections: C( 10, 9 ) Terms with 10-way intersections: C( 10, 10 ) The total is 2 10 – 1 = 1,023.

Copyright © Peter Cappello Exercise 20 How many elements are in the union of 5 sets if: –The sets contain 10,000 elements –Each pair of sets has 1,000 common elements –Each triple of sets has 100 common elements –Each quadruple of sets has 10 common elements –All 5 sets have 1 common element.

Copyright © Peter Cappello Exercise 20 Solution To count the size of the union of the 5 sets: –Add the sizes of each set: C(5, 1)10,000 –Subtract the sizes of the 2-way intersections: C(5, 2)1,000 –Add the sizes of the 3-way intersections: C(5, 3)100 –Subtract the sizes of the 4-way intersections: C(5, 4)10 –Add the size of the 5-way intersection: C(5, 5)1 C(5, 1)10,000 - C(5, 2)1,000 + C(5, 3)100 - C(5, 4)10 + C(5, 5)1