Fundamental Principles of Counting From Chapter 1 of

  • Slides: 67
Download presentation
Fundamental Principles of Counting From Chapter 1 of Discrete and Combinatorial Mathematics, 4 th

Fundamental Principles of Counting From Chapter 1 of Discrete and Combinatorial Mathematics, 4 th ed, by R. P. Grimaldi Fundamental Principles of Counting 1

Outline • • The Rules of Sum and Product Permutations Combinations: The Binormial Theorem

Outline • • The Rules of Sum and Product Permutations Combinations: The Binormial Theorem Combination with Repetition An Application in the Physical Sciences (*) The Catalan Number (*) Summary and Historical Review Fundamental Principles of Counting 2

Introduction • Enumeration does not end up with arithmetic. • 枚舉(enumeration )或計算(counting) • It

Introduction • Enumeration does not end up with arithmetic. • 枚舉(enumeration )或計算(counting) • It also has applications in such areas as coding theory, probability and statistics, and in the analysis of algorithms. • Be sure to learn and understand the basic formulas -but do not rely on them to heavily. • For without an analysis of each problem, a mere knowledge of formulas is next to useless. Fundamental Principles of Counting 3

1. 1 The Rules of Sum and Product • In analyzing more complicated problems,

1. 1 The Rules of Sum and Product • In analyzing more complicated problems, one is often able to break down such problems into parts that can be solved using these basic problem. • We want to develop the ability to “decompose” such problems and piece together our partial solutions in order to arrive at the final answer. • The Rule of Sum: If a first task can be be performed in m ways, while a second task can be performed in n ways, and the two task can be performed simultaneously, then performing either task can be accomplished in any one of m+n ways. Fundamental Principles of Counting 4

 • Example 1. 1: 40 textbooks on sociology and 50 textbooks on anthropology

• Example 1. 1: 40 textbooks on sociology and 50 textbooks on anthropology • Example 1. 2: Five introductory books each on C++, FORTRAN, Java, and Pascal • Example 1. 3: Two colleagues, one has three textbook on the analysis of algorithms, and the other has five. 5≦n≦ 8 , n denotes the maximum number of different books on this topic that an instructor can borrow. Fundamental Principles of Counting 8

1. 1 The Rules of Sum and Product • Example 1. 4: 12 employees

1. 1 The Rules of Sum and Product • Example 1. 4: 12 employees Committee A 5 Committee B 7 Should the administrator decide to speak to just one committee member before making her decision, then 12 employee she can call upon for input. A member of Committee A on Monday, a member of Committee B on Tuesday, then. Fundamental Principles of Counting 9

1. 1 The Rules of Sum and Product • The Rule of Product: If

1. 1 The Rules of Sum and Product • The Rule of Product: If a procedure can be broken down into first and second stages, and if there are m possible outcomes for the first stage and if, for each of these outcomes, there are n possible outcomes for the second stage, then the total procedure can be carried out, in the designated order, in mn, ways. Fundamental Principles of Counting 10

1. 1 The Rules of Sum and Product • Example 1. 6: License plate(車牌)

1. 1 The Rules of Sum and Product • Example 1. 6: License plate(車牌) consisting of two letters followed by four digits – No letter or digit can be repeated: 26 25 10 9 8 7= 32760 – With repetitions of letters and digits allowed: 26 26 10 10=6760000 • Example 1. 7: • Computer Memory – – 1 -byte address: 2 2 2 2 =256 2 -byte address: 256=65536 available addresses 32 -bite architecture: 28 28=4, 294, 967, 296 8 -byte Fundamental Principles of Counting 11

1. 1 The Rules of Sum and Product • Example 1. 8: Six kinds

1. 1 The Rules of Sum and Product • Example 1. 8: Six kinds of muffins(鬆餅), eight kinds of sandwiches, and five beverages (hot coffee, hot tea, iced tea, cola, and orange juice). Want a lunch either a muffin and a hot beverage or a sandwich and a cold beverage. – There are 6 2 8 3=36 ways Fundamental Principles of Counting 12

1. 2 Permutations (排列) • Permutations – Counting linear arrangements of objects • We

1. 2 Permutations (排列) • Permutations – Counting linear arrangements of objects • We shall develop some systematic methods for dealing with linear arrangements. Fundamental Principles of Counting 13

1. 2 Permutations • Example 1. 9: In a class of 10 students, five

1. 2 Permutations • Example 1. 9: In a class of 10 students, five are to be chosen and seated in a row for a picture. How many such linear arrangements are possible? 10 9 8 7 6 Fundamental Principles of Counting = 30, 240 14

1. 2 Permutations • Definition 1. 1 For an integer n≥ 0, n factorial

1. 2 Permutations • Definition 1. 1 For an integer n≥ 0, n factorial (denoted n!) is defined by 0!=1, n!=n(n-1)(n-2). . . (3)(2)(1), for n ≥ 1. • How fast the value of n! increase? – – 10!=3628800, 11! exceeds the number of seconds in one year, 12! exceeds the number in 12 years, 13! surpasses the number of seconds in a century. Fundamental Principles of Counting 15

Definition • Definition 1. 1: Given a collection of n distinct objects, any (linear)

Definition • Definition 1. 1: Given a collection of n distinct objects, any (linear) arrangements of these objects is called a permutation of the collection. • In general, if there are n distinct objects, the number of permutations of size r for the n objects is We denote this number by P(n, r). Fact: P(n, 0)=1, P(n, r)=n!/(n-r)!, P(n, n)=n!. Fundamental Principles of Counting 16

1. 2 Permutations • Example 1. 11: The number of arrangements of four letters,

1. 2 Permutations • Example 1. 11: The number of arrangements of four letters, BALL, is 12, not 4!. 2 (Number of arrangements of the letters, B, A, L, L) = (Number of arrangements of the letters, B, A, L 1, L 2 ) Fundamental Principles of Counting 17

Example 1. 12 • Example 1. 12: The number of arrangements of four letters,

Example 1. 12 • Example 1. 12: The number of arrangements of four letters, PEPPER (2!) (3!)(Number of arrangements of the letters in PEPPER) = (Number of permutations of the symbols P 1, E 1, P 2, P 3, E 2 , R) (Number of arrangements of the letters in PEPPER) =6!/(2!)(3!)=60 Fundamental Principles of Counting 18

1. 2 Permutations • In general, if there are n objects with n 1

1. 2 Permutations • In general, if there are n objects with n 1 of a first type, n 2 of a second type, …, nr of an rth type, where n 1 n 2 … nr =n, then there are n!/ n 1!n 2 ! …nr! Arrangements of the n given objects. Fundamental Principles of Counting 19

Example 1. 13 Fundamental Principles of Counting 20

Example 1. 13 Fundamental Principles of Counting 20

1. 2 Permutations • Example 1. 14: • How many paths from (2, 1)

1. 2 Permutations • Example 1. 14: • How many paths from (2, 1) to (7, 4)? 5 4 3 – Each path corresponds with a list of five R’s and three U’s. – 8!/(5!)(3!)=56. 2 1 1 2 3 4 5 6 7 Fundamental Principles of Counting 21

1. 2 Permutations • Example 1. 15 Fundamental Principles of Counting 22

1. 2 Permutations • Example 1. 15 Fundamental Principles of Counting 22

1. 2 Permutations • Example 1. 16: If six people, designated A, B, …,

1. 2 Permutations • Example 1. 16: If six people, designated A, B, …, F, are seated around table, how many different circular arrangement are possible, if arrangements are considered the same when one can be obtained from the other by rotation? • 6 (Number of circular A C arrangements of A, B, …, F)= D (Number of linear B D F arrangements of A, B, …, F)= E A 6! C E • 6!/6=120 F B Fundamental Principles of Counting 23

1. 2 Permutations • Example 1. 17: Suppose now that the six people of

1. 2 Permutations • Example 1. 17: Suppose now that the six people of Example 1. 16 are three married couples and that A, B, and C are the females. We want to arrange the six people around the table so that the sexes alternate. Fundamental Principles of Counting 24

1. 3 Combinations: The Binomial Theorem(組合,二項 式定理) • Draw three cards from a standard

1. 3 Combinations: The Binomial Theorem(組合,二項 式定理) • Draw three cards from a standard deck, in succession without replacement, then by the rule of product, there are possibilities. Fundamental Principles of Counting 25

1. 3 Combinations: The Binomial Theorem • Each selection, or combination, of three cards,

1. 3 Combinations: The Binomial Theorem • Each selection, or combination, of three cards, with no reference to order, corresponds to 3! permutations of three cards. (3!) (Number of selection of size 3 from a deck of 52) = Number of permutation of size 3 from the 52 cards = Fundamental Principles of Counting 26

1. 3 Combinations: The Binomial Theorem • In general, if we start with n

1. 3 Combinations: The Binomial Theorem • In general, if we start with n objects, each selection, or combination, of r of these objects, with no reference to order, corresponds to r! permutations of size r from the n objects. • Thus the number of combinations of size r from a collection of size n, denoted C(n, r), where 0 r n, satisfies (r!) C(n, r)=P(n, r) and Fundamental Principles of Counting 27

1. 3 Combinations: The Binomial Theorem • When dealing with any counting problem, we

1. 3 Combinations: The Binomial Theorem • When dealing with any counting problem, we should ask ourselves about the importance of order in the problem. • When order is relevant, we think in terms of permutations, and arrangements and the rule of product. • When order is not relevant, combination should play a key role in solving the problem, Fundamental Principles of Counting 28

Fundamental Principles of Counting 29

Fundamental Principles of Counting 29

1. 3 Combinations: The Binomial Theorem • • Example 1. 18: Invite 11 of

1. 3 Combinations: The Binomial Theorem • • Example 1. 18: Invite 11 of the 20 committee member. Order is not important, so she can invite the “the lucky 11” in C(20, 11)=20!/(11!9!) ways. Example 1. 19: a) Answer any 7 of 10 questions: b) Answer 3 from the first 5 and 4 from the last 5. c) Answer 7 of the 10 question, where at least 3 are selected from the first 5. 1) Answer 3 of the first 5 and 4 of the last 5. 2) Answer 4 of the first 5 and 3 of the last 5. 3) Answer all 5 of the first 5 and 2 of the last 5. Fundamental Principles of Counting 30

1. 3 Combinations: The Binomial Theorem • Example 1. 20: a) Select 9 from

1. 3 Combinations: The Binomial Theorem • Example 1. 20: a) Select 9 from 28 juniors and 25 seniors. b) If two juniors and one senior are the best spikers and must be on the team, then the rest of the team can be chosen in c) For a tournament the team must comprise 4 juniors and 5 seniors. She can select her team in Fundamental Principles of Counting 31

1. 3 Combinations: The Binomial Theorem • Example 1. 21: Make up four teams,

1. 3 Combinations: The Binomial Theorem • Example 1. 21: Make up four teams, termed A, B, C and D, of nine girls each from the 36 freshman girls. a) Team A: Team B: a) Distribute 9 A’s, 9 B’s, 9 C’s, and 9 D’s in the 36 spaces. The number of way is the number of arrangements of 36 letters comprising 9 each of A, B, C and D. Team C: Team D: Fundamental Principles of Counting 32

Example 1. 21 Fundamental Principles of Counting 33

Example 1. 21 Fundamental Principles of Counting 33

1. 3 Combinations: The Binomial Theorem • Example 1. 22: a) The number of

1. 3 Combinations: The Binomial Theorem • Example 1. 22: a) The number of arrangements of letters in TALLAHASSEE is 11!/3!2!2!1!1!. b) How many of these arrangements have no adjacent A’s? • Disregarding the A’s, there are 8!/2!2!2!1!1!=5040 ways • Insert 3 A’s in 9 possible locations: (why? ) • Each of the insertion is for all other 5039 arrangements of other letters. By the rule of product, there are 5040 84=423, 360 ways. Fundamental Principles of Counting 34

Example 1. 21 Fundamental Principles of Counting 35

Example 1. 21 Fundamental Principles of Counting 35

Summation Notation Fundamental Principles of Counting 36

Summation Notation Fundamental Principles of Counting 36

Summation Fundamental Principles of Counting 37

Summation Fundamental Principles of Counting 37

1. 3 Combinations: The Binomial Theorem • Example 1. 23: – String made up

1. 3 Combinations: The Binomial Theorem • Example 1. 23: – String made up of prescribed alphabets – E. g. 01, 11, 21, 12, 22, 000, 012, 202, 110 of 0, 1 and 2 – In general, if n is any positive integer, then by the rule of product there are 3 n strings of length n for alphabet 0, 1, and 2. – Define weight of x, wt(x), by wt(X)=x 1+x 2+x 3+…+xn. – e. g. wt(22)=4, wt(12)=3, wt(101)=2, wt(210)=3, . . . – Among the 310 strings of length 10, we wish to determine how many even weight. – Such a string has even weight precisely when the number of 1’s in the string is even. 1 出現偶數次 inued Cont Fundamental Principles of Counting 38

1. 3 Combinations: The Binomial Theorem • Example 1. 23: – Six different cases

1. 3 Combinations: The Binomial Theorem • Example 1. 23: – Six different cases to consider. 1) If the string contains no 1’s, then each of the 10 positions can be filled with either 0 or 2: 210. 2) Two 1’s: 2 8. 3) Four 1’s: 2 6. 4) Six 1’s: 2 4. 5) Eight 1’s: 2 2. 6) Ten 1’s: . – By the rule of sum, Fundamental Principles of Counting 39

1. 3 Combinations: The Binomial Theorem • Example 1. 24: a) Draw five cards

1. 3 Combinations: The Binomial Theorem • Example 1. 24: a) Draw five cards from a standard deck of 52 cards. In how many ways can her selection result in a hand with no clubs? – Ellen is restricted to selecting her five cards from the 39 cards in the deck that are not clubs. d e u n i t Con Fundamental Principles of Counting 40

1. 3 Combinations: The Binomial Theorem b) We want to count the number of

1. 3 Combinations: The Binomial Theorem b) We want to count the number of Ellen’s five card selection that contain at least one club. – These are precisely the selections that were not counted in part (a). – There are possible five-card hands in total, we find that d e u n i t Con Fundamental Principles of Counting 41

1. 3 Combinations: The Binomial Theorem c) Can we obtain the result in part

1. 3 Combinations: The Binomial Theorem c) Can we obtain the result in part (b) in another way? – For example, since Ellen wants to have at least one club in the five-card hand, let her first selection a club. – Now she does not care what comes up for other four cards. – Something wrong! 3 5 K 7 J 5 3 K 7 J Over-counting d e u n i t Con K 3 5 7 J Fundamental Principles of Counting 42

1. 3 Combinations: The Binomial Theorem d) Any other way to arrive at the

1. 3 Combinations: The Binomial Theorem d) Any other way to arrive at the answer in part (b)? Fundamental Principles of Counting 43

1. 3 Combinations: The Binomial Theorem • Note: C(n, r)=C(n, n-r) • Theorem 1.

1. 3 Combinations: The Binomial Theorem • Note: C(n, r)=C(n, n-r) • Theorem 1. 1: The Binomial Theorem. If x and y are variables and n is a positive integer, then Fundamental Principles of Counting d e u n i t Con 44

1. 3 Combinations: The Binomial Theorem – In n=4, the coefficient of x 2

1. 3 Combinations: The Binomial Theorem – In n=4, the coefficient of x 2 y 2 in the expansion of the product (x+y)(x+y) is the number of ways in which we can select two x’s from the four x’s, one of which is available in each factor. – For example, among the possibilities, we can select (1) x from the first two factors and y from the last two factors or (2) x from the first and third factors and y from the second and fourth. Factor selected for x Factor selected for y 1) 1, 2 1) 3, 4 2) 1, 3 2) 2, 4 3) 1, 4 3) 2, 3 4) 1, 4 d e u n i 5) 2, 4 5) 1, 3 t Con 6) 3, 4 Principles of Counting 6) 1, 2 Fundamental 45

1. 3 Combinations: The Binomial Theorem – Consequently, the coefficient of x 2 y

1. 3 Combinations: The Binomial Theorem – Consequently, the coefficient of x 2 y 2 in the expansion of (x+y)4 is =6, the number of ways to select two distinct objects from a collection of four distinct objects. Fundamental Principles of Counting d e u n i t Con 46

1. 3 Combinations: The Binomial Theorem • Proof: In the expansion of the product

1. 3 Combinations: The Binomial Theorem • Proof: In the expansion of the product The coefficient of xkyn-k, where 0 k n, is the number of different ways in which we can select k x’s from the n available factors. The total number of such selections of size k from a collection of size n is C(n, k)= , and from this the binomial theorem follows. Fundamental Principles of Counting 47

1. 3 Combinations: The Binomial Theorem • Example 1. 25: a) From the binomial

1. 3 Combinations: The Binomial Theorem • Example 1. 25: a) From the binomial theorem it follows that the x 5 y 2 coefficient of (x+y)7 in the expansion of is b) To obtain the coefficient of a 5 b 2 in the expansion of (2 a-3 b)7, replace 2 a by x and – 3 b by y. Fundamental Principles of Counting 48

1. 3 Combinations: The Binomial Theorem • Corollary 1. 1: For each integer n>0,

1. 3 Combinations: The Binomial Theorem • Corollary 1. 1: For each integer n>0, Fundamental Principles of Counting 49

1. 3 Combinations: The Binomial Theorem • Theorem 1. 2: For positive integers n,

1. 3 Combinations: The Binomial Theorem • Theorem 1. 2: For positive integers n, t, the coefficient of in the expansion of is where each ni is an integer with 0 ni n, for all 1 i t, and. Fundamental Principles of Counting 50

1. 3 Combinations: The Binomial Theorem • Example 1. 26: a) (x+y+z)7 – x

1. 3 Combinations: The Binomial Theorem • Example 1. 26: a) (x+y+z)7 – x 2 y 2 z 3 – xyz 5 b) We need to know the coefficient of a 2 b 3 c 2 d 5 in the expansion of (a+3 b-3 c+2 d+5)16. Fundamental Principles of Counting 51

1. 4 Combinations with Repetition • When repetitions are allowed, we have seen that

1. 4 Combinations with Repetition • When repetitions are allowed, we have seen that for n distinct objects an arrangement of size r of these objects can be obtained in nr ways, for an integer r 0. • We now turn to the comparable problem for combinations and once again obtain a related problem whose solution follows from out previous enumeration principles. Fundamental Principles of Counting 52

1. 4 Combinations with Repetition 組合重複問題 • Example 1. 27: Seven high school freshmen,

1. 4 Combinations with Repetition 組合重複問題 • Example 1. 27: Seven high school freshmen, each wants one of the following: a cheeseburger (c), a hot dog (h), a taco(乾酪夾餅) (t), or a fish sandwich (f). How many different purchases are possible (買法有 幾種)? – Here we are concerned with how many of each item are purchased, not with the order in which they are purchased, so the problem is one of selections, or combinations, with repetition. Enumerating all arrangements of 10 symbols consisting of 7 x’s and 3 |’s Fundamental Principles of Counting 53

1. 4 Combinations with Repetition (有重複之組合) • In general, when we wish to select,

1. 4 Combinations with Repetition (有重複之組合) • In general, when we wish to select, with repetition, r of n distinct objects, we find that we are considering all arrangements of r x’s and n-1 |’s and that this number is Consequently, the number of combination of n objects taken r at a time, with repetition, is C(n+r-1, r). Fundamental Principles of Counting 54

1. 4 Combinations with Repetition • Example 1. 28: A donut(甜甜圈) shop offer 20

1. 4 Combinations with Repetition • Example 1. 28: A donut(甜甜圈) shop offer 20 kinds of donuts. Assuming that there at least a dozen of each kind when we enter the shop, we can select a dozen in • C(20+12 -1, 12) =C(31, 12)=141, 120, 525 ways. Fundamental Principles of Counting 56

1. 4 Combinations with Repetition • Example 1. 29: President wishes to distribute among

1. 4 Combinations with Repetition • Example 1. 29: President wishes to distribute among four vice presidents $1000 in Christmas bonus(獎 金) checks, where each check will be written for a multiple of $100. a) One or more presidents get nothing. C(4+101, 10)=C(13, 10) b) Each president should receive at least $100. C(4+61, 6)=C(9, 6) c) If each vice president must get at least $100 and Mona gets at least $500, then C(3+2 -1, 2)+C(3+1 -1, 1)+C(3+0 -1, 0)=10=C(4+2 -1, 1) Mona gets exactly $500 Mona gets exactly $600 Fundamental Principles of Counting 57

1. 4 Combinations with Repetition • Example 1. 30: In how many ways can

1. 4 Combinations with Repetition • Example 1. 30: In how many ways can we distribute 7 apples and 6 oranges among 4 children so that each children receives at least one apple? – Given each child an apple, we have C(4+3 -1, 3)=20 ways to distribute the other 3 apples. – There are C(4+6 -1, 6)=84 ways to distribute 6 oranges. – By the rule of product, 20 84=1680 ways Fundamental Principles of Counting 58

1. 4 Combinations with Repetition • Example 1. 31: A message is made up

1. 4 Combinations with Repetition • Example 1. 31: A message is made up of 12 different symbols and is to be transmitted through a communication channel. In addition to 12 symbols, the transmitter will also send a total of 45 spaces between the symbols, with at least three spaces between each pair of consecutive symbols. In how many ways can the transmitter send such a message? 12! C(11+12 -1, 12) arrangement of 12 different symbols 45 -11 3=12 A selection of size 12 from a collection of size 11 Fundamental Principles of Counting 59

1. 4 Combinations with Repetition • Example 1. 32: Determine all integer solutions to

1. 4 Combinations with Repetition • Example 1. 32: Determine all integer solutions to the equation where x i 0 1 i 4. – A selection, with repetition, of size 7 from a collection of size 4, so there are C(4+7 -1, 7) solutions. – 七元分給四人 • At this point it is crucial that we recognize the equivalence of the following: a) The number of integer solutions of the equation b) The number of selections, with repetition, of size r from a collection of size n. c) The number of ways r identical objects can be distributed among n containers. Fundamental Principles of Counting 60

1. Combinations with Repetition Fundamental Principles of Counting 61

1. Combinations with Repetition Fundamental Principles of Counting 61

1. 4 Combinations with Repetition • Example 1. 33: In how many ways can

1. 4 Combinations with Repetition • Example 1. 33: In how many ways can one distribute 10 (identical) white marbles among 6 distinct containers? – C(6+10 -1, 10)=3003 Fundamental Principles of Counting 62

1. 4 Combinations with Repetition • Example 1. 34: How many solutions are there

1. 4 Combinations with Repetition • Example 1. 34: How many solutions are there to the inequality – One approach is to determine the number of such solutions to where k is an integer and 0 k 9. – Transform the problem by noting the correspondence between the nonnegative integer solutions of the above equation and the integer solution of – The number of solutions is the same as where yi=xi, for 1 i 6, and y 7=x 7 -1. Fundamental Principles of Counting C(7+9 -1, 9) 63

1. 4 Combinations with Repetition • Example 1. 36: a) Let us determine all

1. 4 Combinations with Repetition • Example 1. 36: a) Let us determine all the different ways in which we can write the number 4 as a sum of positive integers, where the order of summands is considered relevant. b) partition of integer 1) 2) 3) 4) 4 3+1 1+3 2+2 5) 6) 7) 8) 2+1+1 1+2+1 1+1+2 don’t care order 1+1+1+1 1) 2) 3) 4) Fundamental Principles of Counting 4 3+1 1+3 2+2 5) 6) 7) 8) 2+1+1 1+2+1 1+1+2 1+1+1+1 64

1. 4 Combinations with Repetition • Example 1. 36: b) We wish to count

1. 4 Combinations with Repetition • Example 1. 36: b) We wish to count the number of compositions for the number 7. • Consider the number of possible summands. One summand: 1 If there are two (positive) summands, we want to count the number of integer solutions for w 1+w 2=7, where w 1, w 2 >0. This is equal to the number integer solutions for x 1+x 2=5, where x 1, x 2 0. Fundamental Principles of Counting d e u n i t Con 65

1. 4 Combinations with Repetition • In general, one finds that for each positive

1. 4 Combinations with Repetition • In general, one finds that for each positive integer m, there are compositions. Fundamental Principles of Counting 66

1. 4 Combinations with Repetition • Example 1. 37: How many time is the

1. 4 Combinations with Repetition • Example 1. 37: How many time is the print statement executed? for i: =1 to 20 do for j: =1 to i do for k: =1 to j do print(i*j+k) – For the print statement to be executed, it must satisfy the condition 1 k j i 20. – In fact, any selection a, b, c(a b c) of size 3, with repetition allowed, from the list 1, 2, 3, …, 20 results in one of the correct selection: here k=a, Fundamental Principles of Counting 67 j=b, i=c.