Counting by Complement and the Inclusion/Exclusion Principle

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

Inclusion-Exclusion Rosen 6.5 & 6.6
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.5 Inclusion/Exclusion. Definition and Example- 2 sets |A  B| =|A| + |B| - |A ∩ B| Ex1: |A|=9, |B|=11, |A∩B|=5, |A  B| = ?
More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
Recursively Defined Functions
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,
The Inclusion/Exclusion Rule for Two or Three Sets
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,
Section 5.2 The Addition Rule and Complements
Chapter The Basics of Counting 5.2 The Pigeonhole 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.
Inclusion-Exclusion Selected Exercises Powerpoint Presentation taken from Peter Cappello’s webpage
The Principle of Inclusion-Exclusion
15.1 Inclusion/Exclusion OBJ:  to use the inclusion- exclusion principle to solve counting problems involving intersections and unions of sets.
solve x + (-16) = -12 solve x + (-16) = X = 4.
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.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 11 Basic Structure : Sets, Functions, Sequences, and Sums Sets Operations.
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.
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.
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.
Counting Overview ICS 6D Sandy Irani. Balls into Bins Distinguishable Balls Indistinguishable Balls No restrictions on the number of balls per bin At.
Chapter 7. Section 7.1 Finite probability  In a lottery, players win a large prize when they pick four digits that match, in the correct order, four.
Principle of Inclusion and Exclusion
Lecture 6 Set Theory.
Chapter 4 Introduction to Set Theory
ICS 253: Discrete Structures I
Developing Your Counting Muscles
Chapter 6: Discrete Probability
CSC 321: Data Structures Fall 2015 Counting and problem solving
Chapter 4 Probability Concepts
Copyright © Zeph Grunschlag,
Discrete Structures for Computer Science
Section 16 Inclusion/Exclusion
COCS DISCRETE STRUCTURES
Generalized Permutations & Combinations: Selected Exercises
Permutations and Combinations
Natural Language Processing - Formal Language -
9. Counting and Probability 1 Summary
To Exclude Or Not To Exclude?
Copyright © Zeph Grunschlag,
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
CS 2210 Discrete Structures Counting
Recursively Defined Functions
Chapter 2: Probability · An Experiment: is some procedure (or process) that we do and it results in an outcome. A random experiment: is an experiment we.
Discrete Probability Chapter 7 With Question/Answer Animations
Mathematics for Computer Science MIT 6.042J/18.062J
Set, Combinatorics, Probability & Number Theory
Copyright © Cengage Learning. All rights reserved.
Permutations and Combinations
More Counting A B … f Lecture 16: Nov 9.
COUNTING AND PROBABILITY
ALGEBRA I - SETS : UNION and INTERSECTION
Section 16 Inclusion/Exclusion
Counting Discrete Mathematics.
Representations of Integers
Inclusion-Exclusion Principle
4.4 Permutations and Combinations of multisets
Copyright © Zeph Grunschlag,
Copyright © Zeph Grunschlag,
Additional Rule of Probability
Counting Elements of Disjoint Sets: The Addition Rule
Counting I: Choice Trees and Correspondences
Counting Elements of Disjoint Sets: The Addition Rule
Terminology and Symbols
Sets, Combinatorics, Probability, and Number Theory
Presentation transcript:

Counting by Complement and the Inclusion/Exclusion Principle Sandy Irani ICS 6D

5-card Hands How many 5-card hands have exactly 1 club?

5-card Hands How many 5-card hands have at least one club?

Counting by Complement Set S of items. Let P ⊆ S be the set of items in S that have some particular propery: |S| - |P| = |P| Set of all 5-card hands with at least one club Set of all 5-card hands Set of all 5-card hands with no clubs

Counting by Complement: Examples How many length 8 strings over the alphabet {a, b, c} have at least one “a”?

Counting by Complement: Examples A software team has 10 senior member and 10 junior members. Must select a set of 4 people to work on a project. How many selections have at least one junior member?

- More Donut Selection = How many ways to select 20 donuts from 4 varieties. There is a large selection of glazed, jelly, and maple. But there are only 5 chocolates left. (# chocolates must be ≤ 5) Number of selections with at more than 5 chocolate donuts Number of selections with at most 5 chocolate donuts Number of selections with no restrictions - =

Solution to Sums of Variables How many solutions are there to the following equation, where each variable xi is a non-negative integer? x1 + x2 + x3 + x4 = 12 x2 ≤ 3

Solution to Sums of Variables How many solutions are there to the following equation, where each variable xi is a non-negative integer? x1 + x2 + x3 + x4 = 12 x2 ≤ 3 and x4 ≥ 2

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?

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.

Inclusion/Exclusion Example How many 5-card hands from a standard playing hand have exactly one King or exactly one Ace (or both)? ∪

Inclusion/Exclusion Example How many strings of length 6 over the alphabet {A, B, C} start with a C or end with a C? (inclusive or)

Inclusion/Exclusion Example How many strings of length 6 over the alphabet {A, B, C} start with a B or C? (inclusive or)

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

Inclusion/Exclusion with 3 Sets |A ∪ B ∪ C| = |A| + |B| + |C| - |A ∩ B| - |A ∩ C| - |B ∩ C| + |A ∩ B ∩ C|

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?

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?

Inclusion/Exclusion Example How many strings of length 6 over the alphabet {A, B, C} have at least 4 consecutive A’s?

Incl/Excl 3 Sets How many integers in the range 1 through 42 are divisible by 2, 3, or 7?

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|

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?

Incl/Excl and counting by complement How many 5-card hands have at least one ace or at least one queen (inclusive or)?