- Recall the counting principle.
- Example 1
The university constructs user names as follows
FDDDDDDL
F is the person's first initial
D is a digit
L is the person's last initial
How many different user names can the university generate?
26 * 10 * 10 *10 * 10 * 10 * 10 * 26 = 676,000,000
What if we decide that the same letter can not occur twice?
26 * 10 * 10 * 10 * 10 * 10 * 10 * 25 = 650,000,000
How about if we consider upper and lower
case letters for the first letter
52 * 10 * 10 * 10 * 10 * 10 * 10 * 26 = 1,352,000,000
- For this type of problem it is convenient to solve it using
blanks.
- Example 2
If I have 5 dice, how many different ways can I arrange them?
5 * 4 * 3 * 2 * 1 = 120
If I want to put the big red die first, how many ways can
I arrange them now?
1 * 4 * 3 * 2 * 1 = 24
How about if I want the big die on the ends?
2 * 3 * 2 * 1 * 1 = 12
- A permutation is any ordered arrangement of a given set of objects
- Consider two dice, There are two ways to arrange them
-
Red Blue or Blue Red
- Consider three shapes (*,#,$). There are six ways to arrange them
* $ # # $ * $ # *
* # $ # * $ $ * #
- There are three ways to select the first, two the second and only one the third.
- n! = n * n-1 * n-2 * n-3 ... * 3 * 2 * 1
- If we have n things, there are n! permutations.
- Example 3.
How many ways can we line up 6 things?
6! = 720
- If we want a permutation of 3 out of 5 things the formula is
5!
5P3 = ----- = 60
(5-3)!
- in general
n! n * n-1 * n-2 * ... * n - (r+1) * n-r * ... * 3 * 2 * 1
nPr = ----- = -----------------------------------------------------------
(n-r)! n-r * ... * 3 * 2 * 1
= n * n-1 * n-2 * ... * (n-r)+1
- If we have something with duplicates, the number of permutations changes slightly (if we can't tell the difference between the duplicates)
- Consider the arranging the numbers ABB
ABB
ABB
BAB
BBA
BAB
BBA
- The formula is
n!
------------
n1!n2! ... nk!
n = 3
n1 = 1
n2 = 2
3 * 2 * 1
------------- = 3
1 * 2 * 1