150 likes | 592 Views
6/10/2012 10:29:59 PM. Binomial Coefficients. The Binomial Theorem Gives the coefficients of the expansion of powers of binomial expressions. A binomial is simply the sum of two terms such as x y.Example: Find the expansion of (x y)3.Theorem Let x and y be variables, and let n be a no
E N D
1. CpE602: Applied Discrete Mathematics Counting:
Binomial Coefficients
Generalized Permutations and Combinations
Generating Permutations and Combinations
2. 6/11/2012 7:11:16 AM Binomial Coefficients The Binomial Theorem Gives the coefficients of the
expansion of powers of binomial expressions. A binomial is
simply the sum of two terms such as x + y.
Example: Find the expansion of (x + y)3.
Theorem Let x and y be variables, and let n be a
nonnegative integer. Then,
3. 6/11/2012 7:11:16 AM Binomial Coefficients Example: What is the expansion of (x+y)4?
Example: What is the coefficient of x12y13 in the expression (x+y)25?
[5,200,300]
Example: What is the coefficient of x12y13 in the expression (2x-3y)25?
Corollary. Let n be a nonnegative integer. Then
Corollary. Let n be a positive integer. Then
Corollary. Let n be a nonnegative integer. Then
4. 6/11/2012 7:11:16 AM Binomial Coefficients Pascals Identity and Triangle
Theorem. Let k and n = k be positive integers. Then
Pascals Identity along with the fact that C(n,0)=C(n,n)=1 can be used
to recursively compute binomial coefficients.
1
1 1
Pascals 1 2 1
Triangle 1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
.
5. 6/11/2012 7:11:16 AM Binomial Coefficients Identities of the Binomial Coefficients
Theorem (Vandermondes Identity). Let m, n and r be nonnegative
integers with r not exceeding either m or n. Then
Corollary. If n is a nonnegative integer, then
Theorem. Let r and n = r be nonnegative integers. Then
6. 6/11/2012 7:11:16 AM Generalized Permutations and Combinations Permutations with repetition
Example: How many strings of length r can be formed from the English
alphabet?
Theorem. The number of r-permutations of a set of n objects with
repetition allowed is nr.
Combinations with repetition
Example: How many ways are there to select four pieces of fruit from a
bowl containing apples, oranges and pears if the order in which the
pieces are selected does not matter, only the type of the fruit and not
the individual piece matters, and there are at least four pieces of each
type of fruit in the bowl?
7. 6/11/2012 7:11:16 AM Generalized Permutations and Combinations Example: How many ways are there to select five bills from
a cash box containing one, two, five, ten, twenty, fifty and
hundred dollar bills? Assume that the order in which the
bills are chosen does not matter, that the bills of each
denomination are indistinguishable, and that there
are at least five bills of each type.
Theorem. There are C(n+r-1, r) = C(n+r-1, n-1)
r-combinations from a set with n elements when repetition
of elements is allowed.
8. 6/11/2012 7:11:16 AM Generalized Permutations and Combinations Example: Suppose that a cookie shop has four different kinds of
cookies. How many different ways can six cookies be chosen? Assume
that only the type of cookie, and not the individual cookies or the order
in which they are chosen, matters.
Example: How many solutions does the equation x1+x2+x3 = 11 have,
where x1, x2 and x3 are nonnegative integers?
Example 6 in the textbook.
9. 6/11/2012 7:11:16 AM Generalized Permutations and Combinations Permutations with indistinguishable objects
Example: How many different strings can be made by
reordering the letters of the word SUCCESS ?
Theorem. The number of different permutations of n
objects with n1 indistinguishable objects of type 1, n2
indistinguishable objects of type 2, , and nk
indistinguishable objects of type k, is
10. 6/11/2012 7:11:16 AM Generalized Permutations and Combinations Distributing Objects into Boxes
Distinguishable objects and distinguishable objects
Example: How many ways are there to distribute hands of 5 cards to
each of four players from the standard deck of 52 cards?
Theorem. The number of ways to distribute n distinguishable objects
into k distinguishable boxes so that ni objects are placed into the ith
box equals
11. 6/11/2012 7:11:16 AM Generalized Permutations and Combinations Indistinguishable objects and distinguishable boxes
Example: How many ways are there to place 10 indistinguishable balls
into eight distinguishable bins?
There are C(n+r-1, r) ways to place r indistinguishable objects into n
distinguishable boxes.
Distinguishable objects and indistinguishable boxes
Example: How many ways are there to put four different employees into
three indistinguishable offices, when each office can contain any
number of employees?
12. 6/11/2012 7:11:16 AM Generalized Permutations and Combinations There is no simple formula for the number of ways to distribute n
distinguishable objects into j indistinguishable boxes. A rather complex
formula exists:
where is a Stirling
number of the second kind.
Indistinguishable objects and indistinguishable boxes
Example: How many ways are there to pack six copies of the same
Book into four identical boxes, where a box can contain as many as six
books?
No simple formula exists.
13. 6/11/2012 7:11:16 AM Generating Permutations and Combinations Generating Permutations
Any set of n elements can be place in one-to-one and onto
correspondence with {1, 2, 3, , n}. Hence, we need to construct an
algorithm for finding the permutations of {1, 2, , n}.
Lexicographic (or dictionary) ordering. The permutation a1a2an
precedes the permutation b1b3bn if there is a k such that ai=bi for
i < k, and ak < bk.
Examples: 23415 precedes 23514
41532 precedes 52143
14. 6/11/2012 7:11:16 AM Generating Permutations and Combinations Given a permutation a1a2an, we can find the next permutation using
the following procedure.
- Starting at an, search backwards to find an index j such that aj < aj+1
and aj+1> ak for k = j+2 to n.
- Let al be the smallest of {aj+1, , an} that is greater than aj.
The next permutation is a1aj-1ajaj+1an where aj=al and
aj+1an is constructed by ordering the elements {aj, , an} - {al}
in increasing order. [the pseudocode is given in the textbook]
Example: What is the next permutation in lexicographic order after
362541?
Example: Generate the permutations of the integers 1, 2 and 3.
15. 6/11/2012 7:11:16 AM Generating Permutations and Combinations Generating combinations
Algorithm: Generating the Next Larger Bit String
procedure next bit string (bn-1b1b0: bit string different from 111)
i := 0
while bi = 1
begin
bi := 0
i := i+1
end
bi := 1
Example: Find the next bit string after 10 0010 0111.
16. 6/11/2012 7:11:16 AM Generating Permutations and Combinations Algorithm: Generating the Next r-Combination in Lexicographic Order.
procedure next r-combination({a1, , ar}: proper subset of
{1, 2, , n} not equal to {n-r+1, ,n} with a1<a2<<ar)
i := r
while ai = n r + i
i := i - 1
ai := ai + 1
for j := i+1 to r
aj := ai + (j - i)
Example: Find the next 4-combination of the set {1,2,..,6} after {1,2,5,6}.
Example: Generate the 2-combinations of {1,2,3,4}.