Docsity

Homework 5 Solution for Math with Algorithm and Systems Analysis | CSE 21, Assignments of Computer Science

Toggle sidebar
bg1
CSE21 Summer 2007
Homework 5 Solutions
1. How many ways are there to place an order for 12 chocolate sundaes if there are 5 types of sundaes, and at most 4 sundaes of
one type are allowed?
We can order between 0 and 4 of each type of sundae, and there are 5 sundaes, leading to the generating function:
g(x) = (x0+x1+x2+x3+x4)5.
We want the coefficient of x12 in the above expression. g(x)can be rewritten as follows:
g(x) = 1−x5
1−x5
= (1 −x5)51
1−x5
.
Let f(x) = (1 −x5)5and h(x) = (1 −x)−5. Since the expansion of f(x)gives us only powers of xwhich are multiples of 5,
to find the coefficient of x12, we can either take all of the xs from h(x)and none from f(x), 5 from f(x)and 7 from h(x), or 10
from f(x)and 2 from h(x). This leads to the solution:
a12 =12 + 5 −1
12 −5
17+5−1
7+5
22+5−1
2
2. How many ways are there to divide five pears, five apples, five doughnuts, five lollipops, five chocolate cakes, and five candy
rocks into two (unordered) piles of 15 objects each?
This is equivalent to asking how many ways we can select 15 items (for the first pile) from the six types above, subject to the
constraint that there are at most 5 of each type. Each type can have between 0 and 5 chosen for the first pile, and there are six
types, so the generating function is
g(x) = (x0+x1+x2+x3+x4+x5)6=1−x6
1−x6
= (1 −x6)61
1−x6
,
and we want the coefficient of x15. Separating g(x)into f(x) = (1 −x6)6and h(x) = (1 −x)−6, we can either choose no xs
from f(x)and all 15 from g(x), 6 from f(x)and 9 from h(x), or 12 from f(x)and 3 from h(x). This leads to the solution:
a15 =15 + 6 −1
15 −6
19+6−1
9+6
23+6−1
3.
1
pf3
pf4

Partial preview of the text

Download Homework 5 Solution for Math with Algorithm and Systems Analysis | CSE 21 and more Assignments Computer Science in PDF only on Docsity!

CSE21 Summer 2007

Homework 5 Solutions

  1. How many ways are there to place an order for 12 chocolate sundaes if there are 5 types of sundaes, and at most 4 sundaes of one type are allowed? We can order between 0 and 4 of each type of sundae, and there are 5 sundaes, leading to the generating function:

g(x) = (x^0 + x^1 + x^2 + x^3 + x^4 )^5.

We want the coefficient of x^12 in the above expression. g(x) can be rewritten as follows:

g(x) =

1 − x^5 1 − x

= (1 − x^5 )^5

1 − x

Let f (x) = (1 − x^5 )^5 and h(x) = (1 − x)−^5. Since the expansion of f (x) gives us only powers of x which are multiples of 5, to find the coefficient of x^12 , we can either take all of the xs from h(x) and none from f (x), 5 from f (x) and 7 from h(x), or 10 from f (x) and 2 from h(x). This leads to the solution:

a 12 =

  1. How many ways are there to divide five pears, five apples, five doughnuts, five lollipops, five chocolate cakes, and five candy rocks into two (unordered) piles of 15 objects each? This is equivalent to asking how many ways we can select 15 items (for the first pile) from the six types above, subject to the constraint that there are at most 5 of each type. Each type can have between 0 and 5 chosen for the first pile, and there are six types, so the generating function is

g(x) = (x^0 + x^1 + x^2 + x^3 + x^4 + x^5 )^6 =

1 − x^6 1 − x

= (1 − x^6 )^6

1 − x

and we want the coefficient of x^15. Separating g(x) into f (x) = (1 − x^6 )^6 and h(x) = (1 − x)−^6 , we can either choose no xs from f (x) and all 15 from g(x), 6 from f (x) and 9 from h(x), or 12 from f (x) and 3 from h(x). This leads to the solution:

a 15 =

  1. If 10 steaks and 15 lobsters are distributed among four people, how many ways are there to give each person at most 5 steaks and at most 5 lobsters? We can treat this problem as two separate problems involving generating functions. First, we must find how many ways as to give each person at most 5 steaks. Then we must find the number of ways ato give each person at most 5 lobsters. Once we know these quantities from the coefficients of the generating functions, the answer should be their product: as × a. Each person can get between 0 and 5 steaks, and there are four people, so the generating function for the steak problem is

g(x) = (x^0 + x^1 + x^2 + x^3 + x^4 + x^5 )^4 =

1 − x^6 1 − x

= (1 − x^6 )^4 (1 − x)−^4 ,

and we want the coefficient of x^10. Breaking g(x) into f (x) = (1 − x^6 )^4 and h(x) = (1 − x)−^4 , we see that we can either take 0 xs from f (x) and 10 from h(x), or 6 from f (x) and 4 from h(x):

as =

Note that the only thing that changes in the lobster problem is which coefficient we’re interested in: x^15. The generating function is exacatly the same. Now we can still take 0 xs from f (x) and 15 from h(x), 6 from f (x) and 9 from h(x), or 12 from f (x) and 3 from h(x):

a` =

Putting it all together gives a total of:

as × a` =

  1. Find the exponential generating function, and identify the appropriate coefficient, for the number of ways to deal a sequence of 13 cards (from a standard 52-card deck) if the suits are ignored and only the values of cards are noted. Each value can be chosen between 0 and 4 times, and there are 13 values. Dividing out each term by the number of ways to permute that selection, we get the exponential generating function:

G(x) =

x^0 0!

  • x

1 1!

  • x

2 2!

  • x

3 3!

  • x

4 4!

and we would want the coefficient of x^13 /13!.

  1. How many ways are there to make an r-arrangement of pennies, nickels, dimes, and quarters with at least one penny and an odd number of quarters? (Coins of the same denomination are identical.) The exponential generating function is:

G(x) =

x^1 1!

x^2 2!

x^1 1!

x^3 3!

x^5 5!

x^0 0!

x^1 1!

x^2 2!

where the first factor describes the pennies, the second describes the quarters, and the last describes nickels and dimes (which are unconstrained). We want the coefficient of xr^ /r!. Using some identities of the exponential,

G(x) = (ex^ − 1)

ex^ − e−x 2

(ex)^2 =

e^4 x^ − e^2 x^ − e^3 x^ + ex

and the coefficient is 1 2

(4r^ − 2 r^ − 3 r^ + 1).

(b) 0 and 1 each appear a positive even number of times? We can have any number of 2s, but 0 and 1 must appear 2, 4, 6, etc. times:

G(x) =

x^2 2!

  • x

4 4!

x^0 0!

  • x

1 1!

ex^ + e−x^ − 2 2

ex

and we again want the coefficient of xr^ /r!. Multiplying out gives us

G(x) =

e^3 x^ − 4 e^2 x^ + 6ex^ − 4 + e−x

So the coefficient of xr^ /r! (for r 6 = 0) is 1 4

(3r^ − 4 × 2 r^ + 6 + (−1)r^ ).

If r = 0, we must include the constant term from the generating function:

1 4

30 − 4 × 20 + 6 − 4 + (−1)^0

4 (1^ −^ 4 + 6^ −^ 4 + 1) = 0