Discrete Structures, Fall 2011 Permutation vs Combination Permutations Combinations Ordering of elements from a Collection of element from a set Sequence does matter 1 2 3 is not the same as 3 2 1 set Order does not matter 1 2 3 is the same as 3 2 1 Permutation Example How many ways can we select 3 students from a group of 5 students to form a line to wait to order lunch? Students = S = { 1 2 3 4 5 } Possible permutations would be: 123 345 213 542 Solution: notice that order matters There are 5 ways to select the first student Once that selection is made, there are 4 ways to select the 2nd student Then there are 3 ways to select the 3rd student. 5*4*3 = 60. There are sixty different permutations Alternatively, to arrange all 5 students in a line, then there are 5 * 4 * 3 * 2 * 1 = 120 permutations. Permutation Definition A Permutation is an ordering of the objects within a distinct set. An arrangement of a subset of the original set is called an r-Permutation, where the “r” is the number of elements in the subset In the previous example, we first calculated the 3permutation and then calculated the full permutation. Consider the set S = { 1, 2, 3 } The arrangement 2 1 3 is a permutation of S, while 2 1 is a 2-permutation of S How many permutations of a set exist? For a given set containing n elements, we can calculate the number of possible full permutations by considering the number of options we have at each assignment # of permutations = (n)(n-1)(n-2)(n-3)…(2)(1) = n! n! is called “factorial of n” and is n multiplied by every number between n and 0. 5! = 5*4*3*2*1 0! = 1 (special case) For an r-permutation, we have: # of permutations = (n)(n-1)(n-2)(n-3)…(n-r+1) Introduce a new notation for the r-permutation: P(n,r) = (n)(n-1)(n-2)(n-3)…(n-r+1) P(n,r) = n!/(n-r)! where n is the number of elements in the set, and r is the number of elements in the permutation Example How many different ways are there to select a first- prize winner, a second-prize winner and a third-prize winner from 100 different people who entered a contest? This is a 3-permutation P(100,3) = 100 * 99 *98 = 970,200 Combinations How many different committees of three students can be formed by a group of 4 students? S={1234} Solution: We need to find the number of subsets with three elements. This is the same as eliminating 1 number. There are 4 subsets, or combinations. This is an example of finding 3-Combinations of a set S. The number of r distinct combinations of the set of size n is denoted C(n,r) To compute C(n,r), use the formula n!/(r!*(n-r)!) Combination Example How many poker hands of 5 cards can be dealt from a deck of 52 cards? Order does not matter, so this is a combination problem. C(52,5) = 52!/5!47! = 52*51*50*49*48/(5*4*3*2*1) = 2,598,960 Class problems: List the permutations of {a b c} How many different permutations are there of { a b c d e f g }? Let S = {1 2 3 4 5} List the 3-permutations of S List the 3-combinations of S Find C(5,3) Are there more n-combinations or n-permutations of a set?