Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Discrete Math Basic Permutations and Combinations.

Similar presentations


Presentation on theme: "1 Discrete Math Basic Permutations and Combinations."— Presentation transcript:

1 1 Discrete Math Basic Permutations and Combinations

2 Ordering Distinguishable Objects When we have a group of N objects that are distinguishable how can we count how many ways we can put M of them into different orders? 20 students are distinguishable, each one is unique 20 coins of the same type are not distinguishable, each one is a copy of the others 2

3 An example Consider 60 students in a classroom. The students are distinguishable, we can tell one student from another How many ways to choose an ordered line of 5 students from a class of 60? Note that order matters is different from

4 Revisit example: solution Consider the 60 students in the classroom How many ways to choose an ordered row of 5 students from the class? use product rule 60*59*58*57* 56 = N OR N * (55*54*…*1) / (55*54*…*1) = 60! / 55! 4

5 Another example How many ways can we seat 30 students in a lecture hall with 80 seats. First student to sit down has 80 choices Second has 79 … 80*79*…*51 * (50*49*….*1)/(50*49*….*1) 80! / 50! 5

6 Without replacement How many 6 digit numbers are there, in which no digit is repeated and there are no digits that are 0? 9 choices for first digit (0 not permitted) 8 choices for 2 nd digit … 9*8*7*6*5*4 * (3*2*1) / (3 * 2 * 1) 9!/3! We are choosing digits without replacement (we cannot choose the same digit again) 6

7 With replacement How many 6 digit numbers are there, in which no digits that are 0? 9 choices for first digit (0 not permitted) 9 choices for 2 nd digit … 9*8*7*6*5*4 * (3*2*1) / (3 * 2 * 1) 9!/3! We are choosing digits with replacement (we can choose the same digit again,) 7

8 With and without replacement Consider a bag with 10 chips in it, on each chip one digit (0, 1, …, 9) is written We choose a chip from the bag, the digit on the chip is the first digit in our number If we are choosing with replacement we put the chip back in the bag before making our next choice If we are choosing without replacement we do not put the chip back in the bag before making our next choice 8

9 Permutation A permutation is a distinct ordering of distinguishable objects without replacement A k permutation is a distinct ordering of k objects chosen from N objects where Nk. Suppose we have N distinguishable objects and we wish to order k of these objects without replacement. The number of ways we can order these k objects is 9

10 Anagrams An anagram is a permutation of the letters in a word How many anagrams can we make of a particular word. First Case: no letters in the word are repeated Second Case: one or more letters in the word are repeated 10

11 No repeated letters Try a 4 letter word For any anagram have 4 choices for the first character Have 3 choices for the second character Have 2 choices for the third character Have 1 choice for the final character So there are 4! Anagrams of a 4 letter word In general there are N! anagrams of an N letter word 11

12 With repeated letters (1) When the word has repeated letters we cannot distinguish the anagrams with those repeated letters in the same locations Consider the word SPITS The anagram SSITP and SSITP (the two ss in different orders) are not distinguishable 12

13 With repeated letters (2) For a word with one letter appearing twice SPITS Every distinguishable anagram will have two Ss. We cannot distinguish if we change the order of those Ss So 5! /2 possible distinguishable anagrams 13

14 With repeated letters (3) PINEAPPLE For a letter that repeats 3 times in the word we have 3*2*1 ways that the Ps can be arranged in each distinguishable anagram We also have 2 Es with 2*1 ways to arrange the Es in each distinguishable anagram 9! / (3! *2!) anagrams 14

15 Selecting students We used permutations to count how many ways we could make an orderly row of 5 students from a class of 60 students. What if our orderly row forms a cluster instead of a row, we no longer have order we have a mob not a line. How many 5 persons mobs can be formed from a class of 60 students. 60 ! / 55! Lines, 5! Possible lines for each mob 60! / (55! * 5!) mobs 15

16 Selecting students Select a k student mob from a class of N students. Number of mobs you can select is Number of ways of choosing k objects from a group of N objects read N choose k also known as a binomial coefficient 16

17 Combinations Consider the set of N objects from which we are selecting a group of k objects We are counting the subsets of the set of N objects that have k elements Each subset of k elements can be considered an k combination, a subset or unordered group of k elements chosen from the set of N elements The number of k combinations of the set of N elements is denoted C(N,k) 17

18 Example: Combinations How many bit strings of length 8 have exactly 3 1s? Choose 3 of 8 positions for the 1s 8 choose 3 ways OR Choose 5 of 8 positions for the 0s 8 choose 5 ways 8!/(5!3!)=8*7*6/(2*3) =56 18

19 Combinations with replacement There are C(n+r-1,r)=C(n+r-1,n-1) r combinations from a set with n elements when repetition is allowed. Each r-combination of a set with n elements when repetition is allowed can be represented by a list of n-1 bars (dividers) and r stars (items) N=4, r=6 one combination **|**|*|* 19

20 Combinations with replacement Each possible combination can be represented by a list of bars and stars So count the number of ways n-1 bars and r stars can be arranged in a list The number of ways n-1 bars can be placed into n-1+r positions C(n-1+r,n-1) The number of ways r stars can be placed into n-1+r positions C(n-1+r,r) 20

21 Combinatorial Proof A combinatorical proof of an identity is a proof that uses counting arguments to prove that both sides of the identity count the same objects but in different ways Many identities involving the binomial theorem can be proved using combinatorial proofs 21

22 The Binomial Theorem 22 Let x an y be variables, and let n be a nonnegative integer Then

23 Binomial Theorem Proof The terms in the product are of the form x n-j y j for j=0,…,n Count the number of terms Must choose n-j xs from x terms so the other j terms are ys Therefore the coefficient will be n choose n-j 23

24 Seating students How many ways to seat 30 students in a lecture hall with 80 seats. Choose the occupied seats 80 choose 30 Then permute the students in those seats 30! Ways 24

25 Binomial coefficients Let n be a nonnegative integer Then Combinatorial Proof: Using the binomial theorem 25

26 Why? Binomial Theorem The binomial theorem tells us how to determine the coefficients in the expansion of (x+y) n n=0 1 coefficients (1) n=1 x + y coefficients (1, 1) N=2x2 + 2xy + y2 coefficients (1,2,1) 26

27 Pascals triangle Represents the binomial coefficients 1n=0 1 1n= n= n= n=4 For n=4 x 4 +4x 3 y+6x 2 y 2 +4xy

28 Pascals triangle Can also be represented n=0 n=1 n=2 n=3 n=4 28

29 Pascals Identity Pascals triangle is based on Pascals identity Each row is the values of for a given n and for k=0,1, …, n 29

30 Proving Pascals Identity Combinatorial Proof Let T be a set containing n+1 elements There are subsets of T with k elements Let S be a subset of T with n elements S=T-{a} where a is an arbitrary element of T There are subsets of S with k elements Any subset of T with n elements either contains element a or does not contain element a 30

31 Proving Pascals Identity Combinatorial Proof Any subset of T with k elements either contains element a or does not contain element a S does not contain a so a subset of T with k elements that does not contain element a is also an subset S. Therefore there are subsets of T with k elements do not contain a A k element subset of T that does contain a, contains a and k-1 elements of S. There are subsets of S with k-1 elements. Therefore there are k element subsets of T that contain a Therefore the number of k element subsets of T is 31


Download ppt "1 Discrete Math Basic Permutations and Combinations."

Similar presentations


Ads by Google