Chapter 5 - Set Theory

advertisement
The Division Rule
• Theorem: Suppose a set A has n elements and is
partitioned by the collection {A1, A2, ..., Ap},
where each partition set has m elements. Then:
p = n/m.
• In other words, if a set is partitioned into equalsized partition sets, then the number of partition
sets is the quotient of the size of the set with the
size of any partition set.
• For example, if a set has 100 elements and is
partitioned in 20-element subsets, then there must
be 5 subsets (equivalence classes).
Generalized Permutations
• Permutations teach us how to count the number of
orderings of the letters of COMPUTER (8!). What
about the number of orderings of the letters of
MISSISSIPPI?
• In this case, we note that not all the letters are
distinct. In particular,
MISSISSIPPI  IIIISSSSPPM,
so although we are still searching for an ordering
structures, there are sub-unorderings present,
induced by the repeated letters, for which we have
to account.
Generalized Permutations Take 1
• Let’s apply the Division Rule to negate the effect
of the unordering portions of the overall order
problem.
• This leaves us with a total count of 11!/4!4!2!.
• Here, the first quotient of 4! “mods” out the effect
of the unordered I’s, the second quotient of 4!
“mods” out the effect of the unordered S’s, and the
last quotient of 2! “mods” out the effect of the
unordered P’s.
Generalized Permutations Take 2
• If we model this problem, purely as a combination,
and not a permutation at all, we can reason the task
as:
1. Choose 4 slots from 11 for the I’s;
2. Choose 4 slots from the remaining 7
for the S’s;
3. Choose 2 slots from the remaining 3
for the P’s;
4. Place the M (only 1 way remaining).
• This yields: C(11,4)C(7,4)C(3,2)C(1,1) =
(11!7!3!)/(7!4!4!3!2!1!) = 11!/(4!4!2!).
Generalized Permutation Theorem
• Theorem: Suppose a collection consists of n
objects of which:
n1 are of type 1, indistinguishable from each other;
n2 are of type 2, indistinguishable from each other;
...
nk are of type k, indistinguishable from each other;
and n1 + n2 + ... + nk = n. Then the number of
distinct permutations of the n objects is:
C(n,n1)C(n-n1,n2)C(n-n1-n2,n3)...C(nk,nk) =
n! / (n1!n2!n3!...nk!).
Combinations with Repetition
• In the last section, we saw how to count
combinations, where order does not matter,
based on permutation counts, and we saw how to
count permutations where repetitions occur.
• Now, we shall consider the case where we don’t
want order to matter, but we will allow
repetitions to occur.
• This will complete the matrix of counting
formulae, indexed by order and repetition.
A Motivating Example
• How many ways can I select 15 cans of soda
from a cooler containing large quantities of Coke,
Pepsi, Diet Coke, Root Beer and Sprite?
• We have to model this problem using the chart:
Coke Pepsi Diet Coke Root Beer Sprite
A: 111 111
111
111
111 =15
B: 11
111111
111111
1 =15
C:
1111 1111111
1111
=15
• Here, we set an order of the categories and just
count how many from each category are chosen.
A Motivating Example (cont’d.)
• Now, each event will contain fifteen 1’s, but we
need to indicate where we transition from one
category to the next. If we use 0 to mark our
transitions, then the events become:
A: 1110111011101110111
B: 1100111111011111101
C: 0011110111111101111
• Thus, associated with each event is a binary
string with #1’s = #things to be chosen and #0’s =
#transitions between categories.
Counting Generalized Combinations
• From this example we see that the number of ways
to select 15 sodas from a collection of 5 types of
soda is C(15 + 4,15) = C(19,15) = C(19,4).
• Note that #zeros = #transitions = #categories - 1.
• Theorem: The number of ways to fill r slots from n
catgories with repetition allowed is:
C(r + n - 1, r) = C(r + n - 1, n - 1).
• In words, the counts are:
C(#slots + #transitions, #slots)
or
C(#slots + #transitions, #transitions).
Another Example
• How many ways can I fill a box holding 100
pieces of candy from 30 different types of candy?
Solution: Here #slots = 100, #transitions = 30 - 1,
so there are C(100+29,100) = 129!/(100!29!)
different ways to fill the box.
• How many ways if I must have at least 1 piece of
each type?
Solution: Now, we are reducing the #slots to
choose over to (100 - 30) slots, so there are
C(70+29,70) = 99!/70!29!
When to Use Generalized
Combinations
• Besides categorizing a problem based on its order
and repetition requirements as a generalized
combination, there are a couple of other
characteristics which help us sort:
– In generalized combinations, having all the slots filled
in by only selections from one category is allowed;
– It is possible to have more slots than categories.
Integer Solutions to Equations
• One other type of problem to be solved by the
generalized combination formula is of the form:
How many non-negative integer solutions
are there to the equation a + b + c + d = 100.
• In this case, we could have 100 a’s or 99 a’s and
1 b, or 98 a’s and 2 d’s, etc.
• We see that the #slots = 100 and we are ranging
over 4 categories, so #transitions = 3.
• Therefore, there are C(100+3,100) = 103!/100!3!
non-negative solutions to a + b + c + d = 100.
Integer Solutions with Restrictions
• How many integer solutions are there to:
a + b + c + d = 15,
when a  3, b  0, c  2 and d  1?
• Now, solution “strings” are 111a0b011c01d,
where the a,b,c,d are the remaining numbers of
each category to fill in the remaining slots.
• However, the number of slots has effectively been
reduced to 9 after accounting for a total of 6
restrictions.
• Thus there are C(9+3,9) = 12!/(9!3!) solutions.
More Integer Solutions & Restrictions
• How many integer solutions are there to:
a + b + c + d = 15,
when a  -3, b  0, c  -2 and d  -1?
• In this case, we alter the restrictions and equation
so that the restrictions “go away.” To do this, we
need each restriction  0 and balance the number
of slots accordingly.
• Hence a  -3+3, b  0, c  -2+2 and d  -1+1,
yields a + b + c + d = 15+3+2+1 = 21
• So, there are C(21+3,21) = 24!/(21!3!) solutions.
Summary
• Theorem: The number of integer solutions to:
a1 + a2 + a3 +...+ an = r,
when a1  b1, a2  b2, a3  b3 , ..., an  bn is
C(r+n-1-b1-b2-b3-...-bn , r-b1-b2-b3-...-bn).
• Theorem: The number of ways to select r things
from n categories with b total restrictions on the r
things is C(r + n - 1 - b , r - b).
• Corollary: The number of ways to select r things
from n categories with at least 1 thing from each
category is C(r - 1 , r - n) (set b = n).
Download