Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of...

9
Permutations and Combinations Discrete Structures, Fall 2011

Transcript of Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of...

Page 1: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

Permutations and Combinations

Discrete Structures, Fall 2011

Page 2: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

Permutation vs CombinationPermutations CombinationsOrdering of elements

from a setSequence does matter1 2 3 is not the same as

3 2 1

Collection of element from a set

Order does not matter1 2 3 is the same as 3 2

1

Page 3: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

Permutation ExampleHow 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:

1 2 3 3 4 5 2 1 3 5 4 2

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.

Page 4: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

Permutation DefinitionA 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 3-permutation 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

Page 5: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

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

Page 6: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

ExampleHow 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-permutationP(100,3) = 100 * 99 *98 = 970,200

Page 7: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

CombinationsHow many different committees of three students can

be formed by a group of 4 students?S = { 1 2 3 4 }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)!)

Page 8: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

Combination ExampleHow 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

Page 9: Discrete Structures, Fall 2011. Permutation vs Combination Permutations Combinations Ordering of elements from a set Sequence does matter 1 2 3 is not.

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 SList the 3-combinations of S

Find C(5,3)Are there more n-combinations or n-

permutations of a set?