# Basic Permutations and Combinations

## Presentation on theme: "Basic Permutations and Combinations"— Presentation transcript:

Basic Permutations and Combinations
Discrete Math Basic Permutations and Combinations

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

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 2 1 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!

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!

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 2nd 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)

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 2nd 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,)

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

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 N≥k. 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

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

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

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 s’s in different orders) are not distinguishable

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

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

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

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

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)

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

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 **|**|*|*

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)

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

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

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

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

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

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

Pascal’s triangle Represents the binomial coefficients 1 n=0 1 1 n= n= n= n=4 For n=4 x4+4x3y+6x2y2+4xy3+1

Pascal’s triangle Can also be represented n=0 n=1 n=2 n=3 n=4

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

Proving Pascal’s 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

Proving Pascal’s 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