exam 2 pratice solutions

Upload: hungkg

Post on 03-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Exam 2 Pratice Solutions

    1/7

    MATH 387-01 Exam #2 Practice problem solutions

    7.1.2 Construct a generating function for an, the number of distributions of n identicaljuggling balls to

    1. Six different jugglers with at most four balls distributed to each juggler.

    We want our exponent on zto record the number of juggling balls distributedby every step of our process. Let the individual steps be the act of giving ballsto a single juggler. Since our balls are identical, our choices in a single step are:give no balls to the juggler (which can be done only one way), represented by thepolynomial 1z0 (or just 1); give one ball (which can be done in only one way),represented by the polynomial 1z1, and so forth up to giving 4 balls to a juggler.Thus, the act of giving a juggler up to 4 balls is represented by the polynomial1 + z+ z2 + z3 + z4. Doing so for each of six jugglers, we get (1 + z+ z2 + z3 + z4)6

    as our generating function.

    2. Five different jugglers with between three and seven balls (inclusive) distributed toeach juggler.

    As above, but the act of giving each juggler a collection of balls is rtepresentedby the polynomial z3 +z4 +z5 +z6 +z7; so doing so for each of five jugglers hasgenerating function (z3 +z4 +z5 +z6 +z7)5.

    7.1.5 Find a generating function for the number of integers whose digits sum to n among

    1. Integers from0 to 9999.

    An easy representation for these is as four-digit number-sequences with leadingzeroes allowed; so we represent 37 as 0037, for instance (note that this has noeffect on the digit sum). We break our selection of a number down into the four

    steps of picking individual digits. Since the information we most want to recordwith each step is the digit sum, we use the value of a digit as the exponent ofz.Thus, for each digit, we have ten choices zero through nine, and for each choice,we want to record the number of ways to make that choice (of which there is onlyone) as the coefficient, and the value of that choice as the exponent. We thusassociate with choice of a digit the polynomial 1z0 + 1z1 + 1z2 + + 1z9; doingso four times, we get the generating function (1 + z+ z2 + +z9)4.

    2. Four-digit integers.

    This is as above, but with the restriction that our first digit cannot be zero; thusthe first-digit selection polynomial omits the 1z0 term, giving us the generating

    function (z+ z2 + +z9)(1 +z+ z2 + +z9)3.7.1.6 Find a generating function for the number of ways to select n balls from an infinite

    supply of red, white, and blue balls subject to the constraint that the number of blueballs selected is at least 3, the number of red balls selected is at most 4, and an oddnumber of white balls are selected.

    Since we want to record the number of balls selected, we shall use that as the exponentof z. Our selection can be broken up into 3 independent procedures: selection of redballs, white balls, and blue balls. Our selection of red balls demands no more than 4,

    Page 1 of 7

  • 8/12/2019 Exam 2 Pratice Solutions

    2/7

    MATH 387-01 Exam #2 Practice problem solutions

    so there are 5 possibilities: we can select zero, one, two, three, or four. This step isthus representable by the polynomial 1 + z+ z2 + z3 + z4. The selection of white ballsdemands an odd number, so we may select one ball, or three, or five, and so forth:this yields the infinite series z1 + z3 + z5 + z7 + , since there is no constraint placedon how many white balls we take. Likewise, we may take any number of blue balls

    three or higher: we may take three, or four, or five, and so forth, yielding the seriesz3 + z4 + z5 + to describe this step. Multiplying all our steps gives us the generatingfunction for the process as a whole:

    (1 + z+ z2 +z3 +z4)(z+ z3 +z5 +z7 + )(z3 +z4 +z5 + )

    7.1.14 Find a generating function for the number of positive integer solutions of

    1. 2x1+ 3x2+ 4x3+ 5x4 = n.

    Let the exponent of z represent the total sum on the left side of the equation;

    then choice of x1 as 1, 2, 3, and so forth would increase the left side by 2, or 4,or 6, and so forth, so the contribution ofx1-selection to the generating functionis z2 +z4 +z6 +z8 + . Likewise selecting x2 to be a positive integer increasesour total by thrice its value, so selection of x2 may yield an increase of anymultiple of 3 in the total left-side sum, so x2-selection is associated with the seriesz3 +z6 +z9 +z12 + . Likewise, x4 and x5 are associated with the respectiveseries z4 +z8 +z12 +z16 + and z5 +z10 +z15 +z20 + .

    2. x1+ x2+ x3+ x4=n, where eachxi satisfies2 xi 5.Here we can freely choose x1 to be 2, 3, 4, or 5, which results in addition of 2, 3,4, or 5 to the total sum being kept track of; thus, our decision procedure for x1is represented by the polynomial z2 +z3 +z4 +z5; likewise for x2, x3, and x4, soour generating function is (z2 +z3 +z4 +z5).

    7.2.1. 1. Find the coefficient ofzk in(z4 +z5 +z6 +z7 + )5, k 20.We use the known series expansion 1

    (1z) =

    n=0

    n+11

    zn below:

    (z4 +z5 +z6 +z7 + )5 = (z4)5(1 + z+ z2 +z3 + )5

    = z20

    1

    1 z5

    = z20 n=0

    n+ 5 1

    5 1

    zn

    =n=0

    n+ 4

    4

    zn+20

    This is an acceptable but not entirely canonical representation of the generatingfunction: to be standardized (and useful for answering the question asked) wed

    Page 2 of 7

  • 8/12/2019 Exam 2 Pratice Solutions

    3/7

    MATH 387-01 Exam #2 Practice problem solutions

    like to change the exponent on z to be a single variable. So let k = n+ 20,replacing every n above with k 20:

    k20=0(k 20) + 4

    4 zk =

    k=20

    k 164 z

    k

    so the coefficient ofzk isk164

    for z 20 (and for z n is zero;

    this is not necessary, but actually makes our series manipulation easier, since weneed not worry about the upper limit of the sum:

    (z+ z3 +z5)(1 +z)n = (z+ z3 +z5)

    i=0

    ni

    zi

    =i=0

    n

    i

    zi+1 +

    i=0

    n

    i

    zi+3 +

    i=0

    n

    i

    zi+5

    Now we need to perform index-shifts on each sum to get our z-terms to match;so we introduce new indices k=i + 1, k=i +3, and k= i + 5 to the three sums:

    i=0

    n

    i

    zi+1 +

    i=0

    n

    i

    zi+3 +

    i=0

    n

    i

    zi+5

    =k=1

    n

    k 1

    zk +k=3

    n

    k 3

    zk +k=5

    n

    k 5

    zk

    =z+ nz2 +

    n

    2

    + 1

    z3 +

    n

    3

    +n

    z4 +

    k=5

    n

    k 1

    +

    n

    k 3

    +

    n

    k 3

    zk

    So despite all the special-casing necessary for k

  • 8/12/2019 Exam 2 Pratice Solutions

    4/7

    MATH 387-01 Exam #2 Practice problem solutions

    between three and five times, so the exponential generating functions representingeach individual selection is

    1

    z3

    3!

    + 1

    z4

    4!

    + 1

    z5

    5!

    =

    z3

    6 +

    z4

    24+

    z5

    120

    And the generating function for the process as a whole consists of six such processes,

    thus

    z3

    6 + z

    4

    24+ z

    5

    120

    6. The expansion of this form is difficult to calculate and rather

    unilluminating. For example, the initial term is z18

    46656, more canonically represented as

    137225088000 z18

    18!, which demonstrates that there are approximately 137 trillion distri-

    butions of a mere 18 objects under this scheme.

    7.4.10. Find the number of strings of length n that can be constructed using the alphabet{a,b,c,d,e} if:

    1. b occurs an odd number of times.

    Free selection of any number of instances of a particular letter yields generatingfunction 1

    z0

    0!

    + 1

    z1

    1!

    + 1

    z2

    2!

    + 1

    z3

    3!

    + =ez; selection of an odd number

    of instances of a particular letter yields 1

    z1

    1!

    + 1

    z3

    3!

    + 1

    z5

    5!

    + 1

    z7

    7!

    + =

    ezez2

    , as seen in problem 7.4.4. Thus, given exponential selection functions forall five letters which we want to mingle, we see that the generating function forthis process as a whole is

    (ez)4

    ez ez2

    =

    e5z e3z2

    =12

    n=0

    (5z)n

    n!

    n=0

    (3z)n

    n!

    =

    n=0

    5n 3n2

    zn

    n!

    so the number of ways to achieve an arrangement ofnletters is the coefficient ofzn

    n!, seen above to be 5

    n3n2

    .

    2. both a and b occur an odd number of times. Using the same processes in theprevious section, we get

    (ez)3

    ez ez2

    2

    = e5z 2e3z +ez

    4

    =1

    4

    n=0

    (5z)n

    n! 2

    n=0

    (3z)n

    n! +

    n=0

    zn

    n!

    =n=0

    5n 2 3n + 14

    zn

    n!

    so as above, the coefficient of zn

    n!gives us our desired formula, 5

    n23n+14

    .

    Page 4 of 7

  • 8/12/2019 Exam 2 Pratice Solutions

    5/7

  • 8/12/2019 Exam 2 Pratice Solutions

    6/7

  • 8/12/2019 Exam 2 Pratice Solutions

    7/7

    MATH 387-01 Exam #2 Practice problem solutions

    Input: words a1a2a3. . . an and b1b2b3. . . bmset i to 1;repeat

    if i > n and i > m then decide that a= b;if i > n and i

    m then decide that a < b;

    if i n and i > m then decide that a > b;if i n and i m then

    if ai < bi then decide that a < b;if ai > bi then decide that a > b;if ai= bi then set i to i+ 1 and make no decision;

    until we have made a judgment ;

    This algorithm is an expression of how we would compare words. The process is simplya matter of comparing the first letters (a1 to b1), and returning the result of that com-parison if unequal, and moving onto the next letter if impossible. irecords which letter

    we are on at each stage of the process, so it starts at 1, since we start by comparingthe first letters, and increments when a letter fails to provide an adequate comparison.The conditions at the beginning indicate what to do when we run out of letters fromone or the other string. If we run out on one, it means that string is shorter (e.g. antis lexicographically smaller than anteater); if we run out on both, it means weveexhausted both words without finding a way in which they differ, in which case thetwo words are identical.

    Page 7 of 7