1 Chapter 1 Fundamental Principles of Counting Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Permutations and Combinations Rosen 4.3. Permutations A permutation of a set of distinct objects is an ordered arrangement these objects. An ordered arrangement.
Counting Chapter 6 With Question/Answer Animations.
Recursively Defined Functions
College of Information Technology & Design
Multiplication Rule. A tree structure is a useful tool for keeping systematic track of all possibilities in situations in which events happen in order.
Discrete Structures & Algorithms More Counting. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences.
CSE115/ENGR160 Discrete Mathematics 04/17/12
Permutations r-permutation (AKA “ordered r-selection”) An ordered arrangement of r elements of a set of n distinct elements. permutation of a set of n.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
Counting Techniques: r-combinations with
Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16,
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Course Information.
1 Permutations and Combinations CS/APMA 202 Epp section 6.4 Aaron Bloomfield.
Permutations and Combinations
Chapter 1 Fundamental principles of counting 陳彥良 中央大學資管系.
Exam 1 Review 5.1, , 8.1, 8.2.
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Counting. Why counting  Determine the complexity of algorithms To sort n numbers, how many instructions are executed ?  Count the number of objects.
Chapter 1 Fundamental Principles of Counting Discrete Mathematics.
Counting. Techniques for counting Rule 1 Suppose we carry out have a sets A 1, A 2, A 3, … and that any pair are mutually exclusive (i.e. A 1  A 2 =
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 6 Generating Functions.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
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.
2 Permutations and Combinations Lesson 8 HAND OUT REFERENCE SHEET AND GO OVER IT.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
1 Binomial Coefficients CS 202 Epp, section ??? Aaron Bloomfield.
Chapter 5 The Binomial Coefficients
1 Lecture 4 (part 2) Combinatorics Reading: Epp Chp 6.
Counting CSC-2259 Discrete Structures Konstantin Busch - LSU1.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle.
Spatial Statistics and Spatial Knowledge Discovery First law of geography [Tobler]: Everything is related to everything, but nearby things are more related.
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,
Textbook: Discrete and Combinatorial Mathematics:
1 CS 140 Discrete Mathematics Combinatorics And Review Notes.
2.1 Factorial Notation (Textbook Section 4.6). Warm – Up Question  How many four-digit numbers can be made using the numbers 1, 2, 3, & 4?  (all numbers.
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.
Binomial Coefficients and Identities
5.4 Binomial Coefficients Theorem 1: The binomial theorem Let x and y be variables, and let n be a nonnegative integer. Then Example 3: What is the coefficient.
CS 104: Discrete Mathematics
L14: Permutations, Combinations and Some Review EECS 203: Discrete Mathematics.
1 DISCRETE STRUCTURES DISCRETE STRUCTURES SSK3003 DR. ALI MAMAT 1.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 5 Counting 歐亞書局.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Section 6.3. Section Summary Permutations Combinations.
L14: Permutations, Combinations and Some Review
The Pigeonhole Principle
CSE15 Discrete Mathematics 04/19/17
ICS 253: Discrete Structures I
Chapter 5, Section 5.1 The Basics of Counting
CSC-2259 Discrete Structures
COCS DISCRETE STRUCTURES
Permutations and Combinations
CS100: Discrete structures
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Permutations and Combinations
Basic Counting.
CSE 321 Discrete Structures
Basic Counting Lecture 9: Nov 5, 6.
Permutations and Combinations
Sequences and the Binomial Theorem
Representations of Integers
Presentation transcript:

1 Chapter 1 Fundamental Principles of Counting Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004

2 Issues of Counting How many license plates like AB-1234 are there? How many 16 digits credit card numbers are there such that they always have at least two different digits? What is the coefficient of x 2 y 3 z 4 in the expansion of (x+y+z) 9 ? Applications: coding theory, probability and statistics, and analysis of algorithms.

3 “ If a first task can be performed in m ways, while a second task can be performed in n ways, and two tasks cannot be performed simultaneously, then performing either task can be accomplished in any one of m+n ways. ” Example: A class has 10 males and 5 females, picking a student from this class can be done in 10+5=15 ways. The Rule of Sum

4 The Rule of Product “ If a procedure can be broken down into two stages, and there are m possible outcomes for the first stage and, for each of these outcomes, there are n possible outcomes for the second stage, then the total procedure can be carried out in mn ways. ” Example: A class has 20 males and 15 females, picking an opposite sex pair from this class can be done in 20×15 = 300 ways.

5 Examples How many 5-digit sequences are there such that no two consecutive digits are the same? Answer: 109999 = # How many 5-digit sequences are there such that no two digits are the same? Answer: 109876 = # How many functions f:{1, …,n}  {1, …,m}? Answer: m n. #

6 More Examples How many 12 digit credit card numbers are there such that they end with an even number or with “ 5 ” ? Answer: Numbers that end with even number: 5 Numbers that end with “ 5 ” : Total:  = 600,000,000,000. #

7 Permutations In how many ways can you ‘line up’ a class of 35 students? Answer: 35×34×33×…×1 ≈ × 1040, which is the number of permutations of 35 elements. # In how many ways can you ‘ line up ’ 20 students from a class of 35 students? Answer: 35×34× … ×16 ≈ × #

8 Permutations (Cont.) How many ways can you order n elements? Answer: n(n – 1)(n – 2) … 1 = n!. (say “ n factorial ” ) # Note: 0!=1, 1!=1, 2!=2, 3!=6, 4!=24, … How many ways can you order r out of n elements? Answer: n(n – 1)(n – 2) … (n – r+1) = n! / (n – r)!. Also denoted by P(n,r). #

9 How many 4-letter words out of “ desktop ” ? Answer: P(7,4) = 7!/3! = 840. How many 4-letter words out of “ website ” ? Answer: Not P(7,4) = 840, because of the two “ e ” s. 4-letter words with no or one “ e ” : P(6,4) = 360 (idea: make 4-letter words out of “ w e b s i t ” ) 4-letter words with two “ e ” s: 6 × P(5,2) = 120 (idea: positions of two “ e ” s gives 6 possibilities, the remaining two letter positions can be completed in P(5,2) = 20 ways from “ w b s i t ”.) Total: = 480. # Examples

10 Permutations with Repetitions How many ways can you select r out of n positions? We just saw that n=4 and r=2 gives 6 possibilities: , , , , , . One way of re-phrasing it: “ How many strings of length n can you make out of r symbols  and n – r symbols  ? ” (This is not n! because many symbols are identical.) Another way of phrasing it: “ How many ways can you select r different numbers (=positions) out of {1,2, …,n}? (This is not P(n,r) because the order of choosing does not matter; e.g. picking 3,4 versus picking 4,3.)

11 Answer 1 How many n-strings can you make of r “  ” and n – r “  ” ? The answer would be n! if all  and  would be unique. Example for n=4 and r=2: Consider: , , ,  for which there are indeed 4!=24 combinations:    ,  ,  ,  ,  ,     Indeed 24/4=6.

12 Answer 1 (cont.) If all  and  are unique, the answer is n! Dividing this number by the factor of overcounts gives the right answer. The r symbols “  ” give an overcount factor of r!. The n – r symbols “  ” give an overcount factor of (n – r)!. Hence the right answer is:.

13 Answer 2 How many ways can you select r numbers out of 1,2, …,n? This is not P(n,r) as the order of choosing does not matter. Example for n=4, r=2: The P(4,2) = 12 ways of selecting two different numbers out of {1, …,4} are: (1,2), (2,1), (1,3), (3,1), (1,4), (4,1), (2,3), (3,2), (2,4), (4,2), (3,4), (4,3). The overcount factor is 2; the right answer is P(4,2)/2 = 6. In general, the overcount factor will be r!, hence we have again:.

14 Example How many routes are there from the lower-left corner to the upper-right corner of an mn grid in which we restricted to traveling only to the right or upward? Answer:. #

15 Combinations How many ways can you select r objects out of n? (without concern for the order of selection) Answer: Say: “n choose r”. Despite the fraction, C(n,r) will always be an integer.

16 Combinations Also: Because: we have

17 Summations The sum of a list of n+1 terms like a m, a m+1, …, a m+n, where m and n are integers and n0, is denoted by Sigma notation as lower limit: m upper limit: m+n index: i

18 Properties of Summations

19 Binomial Theorem Proof. Consider (x+y) n = (x+y)(x+y) … (x+y) with n factors. The coefficient of x k y n-k, where 0  k  n, is the number of different ways in which we select k x ’ s from n factors. The total number of such selections is C(n,k). # If x an y are variables and n is a positive integer, then

… Pascal’s Triangle

21 Corollary

22 More Combinations Q: How many 11-letter words out of “ M i s s i s s i p p i ” ? Answer: There is one “ m ”, four “ i ”, four “ s ”, and two “ p ” ; calculate the answer by positioning the letters by type: We can position the “ m ” in 11 ways (leaving 10 spots open), we can position the four “ i ” in C(10,4) ways, (6 spots open), we can position the four “ s ” in C(6,4) ways, (2 spots open), and we can position the two “ p ” in C(2,2) ways. Overall answer: C(11,1)×C(10,4)×C(6,4)×C(2,2) = Note, this equals: 11!/(1! 4! 4! 2!) = How to generalize?

23 Multinomial Theorem For positive integers n, t, the coefficient of in the expansion of (x 1 +x 2 + … +x t ) n is where each n i is an integer with 0n i n, for all 1  i  t, and n 1 + n 2 + … +n t = n. Proof. The coefficient of is the number of ways in which we select x 1 from n 1 of the n factors, x 2 from n 2 of the n-n 1 factors, …, x t from n t of the n - n 1 – n 2 - … - n t-1 = n t factors. The total number of such selections is #

24 Question: How many alphabetized strings are there of length 3 containing the letters a,b,c? Brute force answer: 10, namely: aaa, aab, aac, abb, abc, acc, bbb, bbc, bcc, and ccc. Slightly less brute force: Alphabetization: the only thing that matters is the multitude of the letters a,b,c. Introduce the 3 nonnegative counters n a n b and n c. How many combinations are there such that n a +n b +n c =3? Answer is 10: (3,0,0) (2,1,0) … (0,0,3). Another way of visualizing these 10 options is:  = (3,0,0) and  = (2,1,0) … and  = (1,1,1) … and  = (0,0,3). Answer: C(5,2) = 10 Combinations with Repetitions

25 Combinations with Repetitions Consider a list of k words, out of a dictionary of n words. How many different, alphabetized lists are possible? Answer: Let the 1 st word occurs k 1 times, the 2 nd word occurs k 2 times, …, the n th word k n times. How many different sums k 1 + … +k n = k are there? Consider k symbols “  ” with n – 1 separators “  ”, such that 3+0+2=5 is represented by “  ” (k=5, n=3). For given n and k, there are C(n+k – 1,k) possibilities.

26 Summary When counting the number if selections of k elements out of 1, …,n, consider two crucial questions: Repetition: Can an element be picked more than once? Order: Is the order of picking relevant? Ordering relevant? Repetition allowed? yesno yes n k (Arrangement) P(n,k) (Permutation) no C(n+k-1,k) (Combinations with repetitions) C(n,k) (Combinations)

27 Brainstorm 騎士在旅途中遇見三位美女,其中有天使也有 魔鬼。天使向來只說真話,而魔鬼總是說謊。 三位美女 A,B,C 的對話如下 : A: B 和 C 之中,至少有一位是天使。 B: A 和 C 之中,至少有一位是魔鬼。 C: 我來告訴你正確的道路。 問題:有幾位天使?