More Counting Lecture 13 A B …… f. Counting Rule: Bijection If f is a bijection from A to B, then |A| = |B| A B …… f.

Slides:



Advertisements
Similar presentations
9.5 Counting Subsets of a Set: Combinations
Advertisements

Counting. Counting in Algorithms How many comparisons are needed to sort n numbers? How many steps to compute the GCD of two numbers ? How many steps.
Basic Permutations and Combinations
5.3 Permutations and Combinations
Counting Chapter 6 With Question/Answer Animations.
1 More Counting by Mapping Lecture 16: Nov 7. 2 This Lecture Division rule Catalan number.
Counting Chapter 6 With Question/Answer Animations.
The Division Rule Theorem: Suppose a set A has n elements and is partitioned by the collection {A 1, A 2,..., A p }, where each partition set has m elements.
Multiplication Rule. A tree structure is a useful tool for keeping systematic track of all possibilities in situations in which events happen in order.
CSE115/ENGR160 Discrete Mathematics 04/17/12
Discrete Mathematics Math 6A Homework 4 Solution.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 10Feb 12, 2004Carnegie.
ENM 207 Lecture 5. FACTORIAL NOTATION The product of positive integers from 1 to n is denoted by the special symbol n! and read “n factorial”. n!=1.2.3….(n-2).(n-1).n.
Polynomial time approximation scheme Lecture 17: Mar 13.
More Counting Lecture 16: Nov 9 A B …… f. Counting Rule: Bijection If f is a bijection from A to B, then |A| = |B| A B …… f.
Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16,
Chapter 8 The principle of Inclusion and Exclusion Yen-Liang Chen Dept of Information Management National Central University.
Tucker, Section 5.41 Section 5.4 Distributions By Colleen Raimondi.
4.4.2 Combinations of multisets
Chapter 1 Fundamental principles of counting 陳彥良 中央大學資管系.
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
More Counting Lecture 16: Nov 9 A B …… f. This Lecture We will study how to define mappings to count. There will be many examples shown. Bijection rule.
Review of 5.1, 5.3 and new Section 5.5: Generalized Permutations and Combinations.
Chapter 6 The Inclusion-Exclusion Principle and Applications
Basic Counting Lecture 12: Oct 28. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations,
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 6 Counting and Probability Instructor: Hayk Melikyan Today we will review sections 6.4,
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
Generalized Permutations and Combinations
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Permutations and Combinations
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
Great Theoretical Ideas in Computer Science.
Chapter 3 Permutations and combinations
March 10, 2015Applied Discrete Mathematics Week 6: Counting 1 Permutations and Combinations How many different sets of 3 people can we pick from a group.
1 Lecture 4 (part 2) Combinatorics Reading: Epp Chp 6.
Counting CSC-2259 Discrete Structures Konstantin Busch - LSU1.
1 Counting by Mapping Lecture 15: Nov 4 A B …… f.
COMPSCI 102 Discrete Mathematics for Computer Science.
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 Principles. Counting examples Ex 1: A small sandwich café has 4 different types of bread, 5 different types of meat and 3 different types of.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 7Sept 20, 2005Carnegie.
1 CS 140 Discrete Mathematics Combinatorics And Review Notes.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS Spring 2006 Lecture 6Feb 2, 2005Carnegie.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 11 Counting Methods and Probability Theory.
CS Lecture 8 Developing Your Counting Muscles.
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 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.
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.
L14: Permutations, Combinations and Some Review EECS 203: Discrete Mathematics.
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.
Week 9 - Friday.  What did we talk about last time?  Partial orders  Total orders  Basic probability  Event  Sample space  Monty Hall  Multiplication.
Permutations and Combinations. Fundamental Counting Principle If there are r ways of performing one operation, s ways of performing a second operation,
Permutations & Combinations: Selected Exercises. Copyright © Peter Cappello2 Preliminaries Denote the # of arrangements of some k elements of a set of.
Section 6.3. Section Summary Permutations Combinations.
The Multiplication Rule
L14: Permutations, Combinations and Some Review
The Pigeonhole Principle
Developing Your Counting Muscles
CSE15 Discrete Mathematics 04/19/17
Counting Methods and Probability Theory
Generalized Permutations and Combinations
Generalized Permutations & Combinations: Selected Exercises
Permutations and Combinations
CS100: Discrete structures
Basic Counting.
More Counting A B … f Lecture 16: Nov 9.
Basic Counting Lecture 9: Nov 5, 6.
Permutations and Combinations
Counting Methods and Probability Theory
4.4 Permutations and Combinations of multisets
Presentation transcript:

More Counting Lecture 13 A B …… f

Counting Rule: Bijection If f is a bijection from A to B, then |A| = |B| A B …… f

How many subsets of a set A ? P(A) = the power set of A = the set of all subsets of A for A = {a, b, c}, P(A) = { , {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c} } Power Set

Bijection: Power Set and Binary Strings A: {a 1, a 2, a 3, a 4, a 5, …, a n } string: … 1 subset: {a 1, a 3, a 4, …, a n } We define a mapping between subsets and binary strings This is a bijection, because:  each subset is mapped to a unique binary string, and  each binary string represents a unique subset. So, |n-bit binary strings| = |P(A)|

A Chess Problem In how many different ways can we place a pawn (p), a knight (k), and a bishop (b) on a chessboard so that no two pieces share a row or a column?

We define a mapping between configurations to sequences (r(p), c(p), r(k), c(k), r(b), c(b)), where r(p), r(k), and r(b) are distinct rows, and c(p), c(k), and c(b) are distinct columns. A Chess Problem (7,6,2,5,5,2) (7,6) (2,5) (5,2) This is a bijection, because:  each configuration is mapped to a unique sequence  each sequence represents a unique configuration.

A Chess Problem We define a mapping between configurations to sequences (r(p), c(p), r(k), c(k), r(b), c(b)), where r(p), r(k), and r(b) are distinct rows, and c(p), c(k), and c(b) are distinct columns. Using the generalized product rule, there are 8 choices of r(p) and c(p), there are 7 choices of r(k) and c(k), there are 6 choices of r(b) and c(b). (7,6,2,5,5,2) Thus, total number of configurations = (8x7x6) 2 =

Counting Doughnut Selections There are five kinds of doughnuts. How many different ways to select a dozen doughnuts? A ::= all selections of a dozen doughnuts Hint: define a bijection! 00 (none) Chocolate Lemon Sugar Glazed Plain

Counting Doughnut Selections A ::= all selections of a dozen doughnuts Define a bijection between A and B Each doughnut is represented by a 0, and four 1’s are used to separate five types of doughnuts. B::= all 16-bit binary strings with exactly four 1’s. 00 (none) Chocolate Lemon Sugar Glazed Plain

Counting Doughnut Selections c chocolate, l lemon, s sugar, g glazed, p plain maps to 0 c 10 l 10 s 10 g 10 p B::= all 16-bit binary strings with exactly four 1’s. A ::= all selections of a dozen doughnuts

In-Class Exercise for i=1 to n do for j=1 to i do for k=1 to j do printf(“hello world”); How many “hello world” will this program print? (page of the textbook)

There are 20 books arranged in a row on a shelf. How many ways to choose 6 of these books so that no two adjacent books are selected? Choosing Non-Adjacent Books Hint: define a bijection! A ::= all selections of 6 non-adjacent books from 20 books B::= all 15-bit binary strings with exactly six 1’s.

A ::= all selections of 6 non-adjacent books from 20 books B::= all 15-bit binary strings with exactly six 1’s. Choosing Non-Adjacent Books Map each zero to a non-chosen book, each of the first five 1’s to a chosen book followed by a non-chosen book, and the last 1 to a chosen book. This is a bijection, because:  each selection maps to a unique binary string.  each binary string is mapped by a unique selection.

Choosing Non-Adjacent Books 15 chooses 6, will be discussed. A ::= all selections of 6 non-adjacent books from 20 books B::= all 15-bit binary strings with exactly six 1’s.

In-Class Exercises How many solutions are there to the equation x1+x2+x3+x4=10, where x1,x2,x3,x4 are nonnegative integers? (page of the textbook) How many integer solutions to x1+x2+x3+x4=10 if each xi>=1?

if function from A to B is k-to-1, then (generalizes the Bijection Rule) Division Rule

Another Chess Problem In how many different ways can you place two identical rooks on a chessboard so that they do not share a row or column?

We define a mapping between configurations to sequences (r(1), c(1), r(2), c(2)), where r(1) and r(2) are distinct rows, and c(1) and c(2) are distinct columns. Another Chess Problem A ::= all sequences (r(1),c(1),r(2),c(2)) with r(1) ≠ r(2) and c(1) ≠ c(2) B::= all valid rook configurations (1,1,8,8) and (8,8,1,1) maps to the same configuration. The mapping is a 2-to-1 mapping.

Another Chess Problem A ::= all sequences (r(1),c(1),r(2),c(2)) with r(1) ≠ r(2) and c(1) ≠ c(2) B::= all valid rook configurations The mapping is a 2-to-1 mapping. Using the generalized product rule to count |A|, there are 8 choices of r(1) and c(1), there are 7 choices of r(2) and c(2), and so |A| = 8x8x7x7 = Thus, total number of configurations |B| = |A|/2 = 3136/2 = 1568.

How many ways can we seat n different people at a round table? Round Table Two seatings are considered equivalent if one can be obtained from the other by rotation. equivalent

A ::= all the permutations of the people B::= all possible seating arrangements at the round table Round Table Map each permutation in set A to a circular seating arrangement in set B by following the natural order in the permutation.

Round Table A ::= all the permutations of the people B::= all possible seating arrangements at the round table This mapping is an n-to-1 mapping. Thus, total number of seating arrangements |B| = |A|/n = n!/n = (n-1)!

Counting Subsets How many size 4 subsets of {1,2,…,13}? Let A::= permutations of {1,2,…,13} B::= size 4 subsets map a 1 a 2 a 3 a 4 a 5 … a 12 a 13 to {a 1,a 2,a 3, a 4 } How many permutations are mapped to the same subset??

map a 1 a 2 a 3 a 4 a 5 … a 12 a 13 to {a 1,a 2,a 3, a 4 } a 2 a 4 a 3 a 1 a 5 … a 12 a 13 also maps to {a 1,a 2,a 3, a 4 } as does a 2 a 4 a 3 a 1 a 13 a 12 … a 5 So this mapping is 4!  9!-to-1 Counting Subsets 4! 9!

Let A::= permutations of {1,2,…,13} B::= size 4 subsets Counting Subsets So number of 4 element subsets is Number of m element subsets of an n element set is

In-Class Exercise How many ways to rearrange the letters in the word “MISSISSIPPI”?

I’m planning a 20-mile walk, which should include 5 northward miles, 5 eastward miles, 5 southward miles, and 5 westward miles. How many different walks are possible? There is a bijection between such walks and sequences with 5 N’s, 5 E’s, 5 S’s, and 5 W’s. The number of such sequences is equal to the number of rearrangements: 20! 5!5!5!5! Example: 20 Mile Walk

Multinomial Theorem