Massachusetts Institute of Technology 6.042J/18.062J, Fall 05: Mathematics fo Compute Science Novembe 21 Pof. Albet R. Meye and Pof. Ronitt Rubinfeld evised Novembe 27, 2005, 858 minutes Solutions to Poblem Set 8 Poblem 1. Find the coefficients of (a) 10 in ( + (1/)) 100 Solution. 55 (1/) 45 = 10 so the coefficient is ( ) 100 55 2 (b) k in ( (1/)) n. Solution. k must equal ( 2 ) j (1/) ( n j) fo some j whee 0 j n, in which case j = (n + k)/3. In such a case the coefficient is n ( 1) n j n = ( 1) (2n k)/3. j (n + k)/3 Poblem 2. Suppose a genealized Wold Seies between the So and the Cadinals involved 2n + 1 games. As usual, the genealized Seies will stop as soon as one team has won moe than half the possible games. (a) Suppose that when the So finally win the GSeies, the Cads have managed to win eactly games (so n). How many possible win loss pattens ae possible fo the So to win the GSeies in this way? Epess you answe as a binomial coefficient. Copyight 2005, Pof. Albet R. Meye.
Solutions to Poblem Set 8 Solution. ( ) n + 2 (1) Stas and bas, o bette S s and C s: we can epesent a win loss patten as a sequence of C s and n + 1 S s, whee an S in the ith position indicates that the So won the ith game. Howeve, the sequence must end with an S, so the numbe of such sequences is the same as the numbe of sequences of C s and n S s, namely (1). (b) How many possible win loss pattens ae possible fo the So to win the GSeies when the Cads win at most games? Epess you answe as a binomial coefficient. Solution. ( ) n + + 1 (2) We can epesent a win loss patten as a sequence of C s and n + 1 S s, as in pat (a). The numbe of C s which occu befoe the n + 1st (last) S is the numbe of games the Cads won when the GSeies ends. (c) Give a combinatoial poof that n + i n + + 1 =. (3) i i=0 Solution. The ighthand side of (3) is the numbe of pattens whee the Cads win at most games. But they can at most by winning eactly i games, whee 0 i. So by pat (a), the numbe of win loss pattens is given by the epession of the lefthand side of (3). (d) Veify equation (3) by induction using algeba. Solution. By induction on, taking (3) as P (). Poof. Base case ( = 0): n n + 1 = 1 =. 0 0
Solutions to Poblem Set 8 3 Inductive step: +1 ( ) n + i n + + 1 n + i = + i + 1 i i=0 i=0 n + + 1 n + + 1 = + (by Ind. Hyp.) + 1 ( ) n + ( + 1) + 1 = (Pascal s identity), + 1 Which poves P ( + 1). Poblem 3. (a) 1 Let a n be the numbe of length n tenay stings (stings of the digits 0, 1, and 2) that contain two consecutive digits that ae the same. Fo eample, a 2 = 3since the only tenay stings of length 2 with matching consecutive digits ae 11, 22, and 33. Also, a 0 = a 1 = 0, since in ode to have consecutive matching digits, a sting must be of length at least two. Find a ecuence fomula fo a n. Solution. Call a tenay sting with at least two consecutive matching digits a good sting. Let a n be the numbe of good stings of length n. Call the othe 3 n a n stings of length n the bad stings. Now fo n 2, a good sting of length n consists of (1) a good sting of length n 1 followed by any digit, o else (2) a bad sting of length n 1 followed by a digit that matches the last symbol of the bad sting. (Note that thee is such a last symbol because n 1 1.) Thee ae 3a n 1 stings of type (1) and 3 n 1 a n 1 stings of type (2), and these two types of stings ae disjoint. So a n = 3a n 1 + 3 n 1 a n 1 = 2a n 1 + 3 n 1. Also, a good sting must have at least two digits, so a 0 = a 1 = 0. (b) Show that + 1 2 (1 3)(1 2) is a closed fom fo the geneating function of the sequence a 0, a 1,... 1 Fom Rosen, 5th ed., 6.1, Eecise 34.
Solutions to Poblem Set 8 4 Solution. Fo n 1, the coefficient of n in the seies epansion of 2A() is 2a n 1, and the coefficient of n in 3 n + 3 2 + 3 2 + + n 1 3 + = (1 + 3 + (3) 2 + + (3) n 1 + ) = 1 3 is obviously 3 n 1. So in the seies fo A() 2A() /(1 3), all the coefficients of n fo n 2 ae zeo. This leaves A() 2A() 1 3 = (a 0 + a 1 ) 2a 0 =. So A() = 3 2 + =. (4) 1 2 (1 3)(1 2) (1 3)(1 2) (c) Find eal numbes and s such that 1 s = +. (1 2)(1 3) 1 2 1 3 Solution. Epessing the ighthand side of this equation as (1 3) + s(1 2), (1 2)(1 3) we need, s so the numeatos of the left and ighthand epessions ae equal, namely, so that 1 = (1 3) + s(1 2). So letting = 1/2, we conclude that 1 = ( 1/2) so = 2, and letting = 1/3, we conclude that 1 = s(1/3), so s = 3. (d) Use the pevious esults to wite a closed fom fo the nth tem in the sequence. Solution. Fom equation (4), the geneating function is 1 3 3 2 = 3 2 2 +. (1 2)(1 3) 1 2 1 3 So fo n 2, the coefficient of n in the geneating function is 3 ( 2) times the coefficient of n 2 in 1/(1 2), plus 3 3 times the coefficient of n 2 in 1/(1 3). Namely, a n = ( 3 2)2 n 2 + 3 2 3 n 2 = 3(3 n 1 2 n 1 ).
Solutions to Poblem Set 8 5 Poblem 4. Suppose thee ae fou kinds of doughnuts: plain, chocolate, glazed, and buttescotch. Wite geneating functions fo the numbe of ways to select the flavos of n doughnuts, subject to the following diffeent constaints. (a) Each flavo occus an odd numbe of times. Solution. Geneating function fo picking chocolate doughnuts is /(1 2 ), so fo all 4 doughnuts it is ( ) 4. 1 2 (b) Each flavo occus a multiple of 3 times. Solution. GF fo chocolate is 1/(1 3 ) so ( 1 ) 4 1 3 fo all 4 kinds. (c) Thee ae no chocolate doughnuts and at most one glazed doughnut. Solution. GF fo chocolate is 1, fo glazed 1 +, fo othes 1/(1 ), so fo all 4 it is 1 + (1 ) 2 (d) Thee ae 1, 3, o 11 chocolate doughnuts, and 2, 4, o 5 glazed. Solution. GF fo chocolate is + 3 + 11, fo glazed 2 + 4 + 5, and 1/(1 ) fo the othes, so ( + 3 + 11 )( 2 + 4 + 5 ). (1 ) 2 fo all. (e) Each flavo occus at least 10 times. Solution. GF fo chocolate is 10 /(1 ), so fo all 4. 40 (1 ) 4