the generalized product rule counting permutationsirani/w17-6d/boardnotes/...generalized product...
TRANSCRIPT
The Generalized Product Rule Counting Permutations
ICS 6D
Sandy Irani
• Student council has 15 members. Must select officers (Pres, VP, Treasurer, Secretary)
• No one can serve in more than one officer position.
• How many ways to select offiers?
( ______ , ______ , ______ , ______ ) [President] [Vice President] [Treasurer] [Secretary]
Counting as a Selection Process
• Select an element from a set to be counted
• Selection process is a sequence of steps. In each step, one more decision is made about the item to be selected.
• At the end of the process, the item to be selected is fully specified.
• If at each step, the number of choices is independent of the previous choices made – The number of items in the set is equal to the product
of the number of choices at each step.
Generalized Product Rule
• Set S of sequences of k items.
• Suppose there are: – n1 choices for the first item.
– For every possible choice for the first item, there are n2 choices for the second item.
– For every possible choice for the first and second items, there are n3 choices for the third item.
– For every possible choice for the first k-1 items, there are nk choices of the kth item.
• Then |S|=n1· n2 · · · · nk
Generalized Product Rule
• A group of software engineers must complete three modules in a software project. One programmer must be assigned to each module and there are 10 programmers in the group.
• How many ways are there to select the programmers to write the different modules?
[Module 1] [Module 2] [Module 3]
( _________ , _________ , _________ )
What if each programmer can be assigned to at most one module?
Generalized Product Rule
• A group of software engineers must complete three modules in a software project. One programmer must be assigned to each module and there are 10 programmers in the group.
• 7 of the members of the group are senior employees and 3 are junior employees.
• Module 1 must be written by a senior employee and module 2 must be written by a junior employee.
• How many ways are there to select the programmers to write the different modules?
[Module 1] [Module 2] [Module 3]
( _________ , _________ , _________ )
What if each programmer can be assigned to at most one module?
r-Permutations
• Definition: an r-permutation is a sequence of r items with no repetitions selected from the same set.
– Example: S = {a, b, c, d, e, f, g, h, i}
– (g, a, b, e) is a 4-permutation
– (a, e, b, g) is a different 4-permutation (order matters)
• How many ways are there to select an r-permutation from a set of n elements?
Counting r-permutations
• The number of ways to select an r-permutation from a set of n items is:
n·(n-1) ·(n-2) ···(n-r+1)
Counting r-permutations
• The number of ways to select an r-permutation from a set of n items is:
n·(n-1) ·(n-2) ···(n-r+1) = 𝑛!
(𝑛−𝑟)! = P(n,r)
Counting r-permutations
• Four different tasks are distributed to computers in a distributed system of 20 computers.
– How many ways are there to assign the tasks to computers with no restrictions on the number of tasks assigned to any one computer?
– How many ways are there it assign the tasks if each computer gets assigned at most one task?
Counting r-permutations
• Three kids (Larry, Curly, and Moe) select prizes from a bin with 30 different prizes. How many ways are there for the kids to select the prizes?
Permutations
• A permutation is a sequence that contains each element of a finite set exactly once
• Example: S = {a, b, c}. The permutations of S are:
The number of permutations of a set with n elements is P(n, n) = n!
(a, b, c) (b, a, c) (c, a, b)
(a, c, b) (b, c, a) (c, b, a)
Counting Permutations
• The number of permutations of the set
S = {a, b, c, d, e} is:
How many permutations in which b and e are next to each other?
Counting Permutations
• The number of permutations of the set
S = {a, b, c, d, e} is:
How many permutations in which b comes immediately before e?
Counting Permutations
• The number of permutations of the set
S = {a, b, c, d, e} is:
How many permutations in which b comes somewhere before e (but not necessarily immediately before e)?