6.04/18.06J Mathmatics for Computr Scic March 15, 005 Srii Dvadas ad Eric Lhma Problm St 6 Solutios Du: Moday, March 8 at 9 PM Problm 1. Sammy th Shar is a fiacial srvic providr who offrs loas o th followig trms. Sammy loas a clit m dollars i th morig. This puts th clit m dollars i dbt to Sammy. Each vig, Sammy first chargs a srvic f, which icrass th clit s dbt by f dollars, ad th Sammy chargs itrst, which multiplis th dbt by a factor of p. For xampl, if Sammy s itrst rat wr a modst 5% pr day, th p would b 1.05. (a) What is th clit s dbt at th d of th first day? Solutio. At th d of th first day, th clit ows Sammy (m + f)p = mp + fp dollars. (b) What is th clit s dbt at th d of th scod day? Solutio. ((m + f)p + f)p = mp + fp + fp (c) Writ a formula for th clit s dbt aftr d days ad fid a quivalt closd form. Solutio. Th clit s dbt aftr thr days is (((m + f)p + f)p + f)p = mp 3 + fp 3 + fp + fp. Gralizig from this pattr, th clit ows d d mp + fp dollars aftr d days. Applyig th formula for a gomtric sum givs: d+1 d p 1 mp + f 1 p 1 Problm. Fid closd form xprssios qual to th followig sums. Show your wor. =1
Problm St 6 (a) 9 i 7 i i=0 11 i Solutio. Split th xprssio ito two gomtric sris ad th apply th formula for th sum of a gomtric sris. i 9 i 7 i 9 7 i = 11 i 11 11 i=0 i=0 i=0 9 +1 7 +1 1 1 11 11 = 9 7 1 11 1 11 +1 +1 11 9 11 7 11 = + + 11 4 11 4 (b) i=1 3 4i+5 Solutio. Taig th logarithm rducs this product to a asy sum. 3 log 3( Q 3 4i+5 = i=1 34i+5 ) i=1 P = 3 i=1 4i+5 = 3 (+1)+5 (c) 1 j 5/3 1 j 1/3 j=1 i=0 i Solutio. This farsom looig sum is a papr tigr; w just apply th formula for th sum of a gomtric sris followd by th formula for th sum of a arithmtic sris. i 1 1 j 5/3 1 = j 5/3 j 1/3 j=1 i=0 j=1 1 1 j 1/3 = j = j=1 1 ( + )( + 1) 3 1
Problm St 6 3 Problm 3. Thr is a bug o th dg of a 1 mtr rug. Th bug wats to cross to th othr sid of th rug. It crawls at 1 cm pr scod. Howvr, at th d of ach scod, a malicious first gradr amd Mildrd Adrso strtchs th rug by 1 mtr. Assum that hr actio is istataous ad th rug strtchs uiformly. Thus, hr s what happs i th first fw scods: Th bug wals 1 cm i th first scod, so 99 cm rmai ahad. Mildrd strtchs th rug by 1 mtr, which doubls its lgth. So ow thr ar cm bhid th bug ad 198 cm ahad. Th bug wals aothr 1 cm i th xt scod, lavig 3 cm bhid ad 197 cm ahad. Th Mildrd stris, strtchig th rug from mtrs to 3 mtrs. So thr ar ow 3 (3/) = 4.5 cm bhid th bug ad 197 (3/) = 95.5 cm ahad. Th bug wals aothr 1 cm i th third scod, ad so o. Your job is to dtrmi this poor bug s fat. (a) Durig scod i, what fractio of th rug dos th bug cross? Solutio. Durig scod i, th lgth of th rug is 100i cm ad th bug crosss 1 cm. Thrfor, th fractio that th bug crosss is 1/100i. (b) Ovr th first scods, what fractio of th rug dos th bug cross altogthr? Solutio. Th bug crosss 1/100 of th rug i th first scod, 1/00 i th scod, 1/300 i th third, ad so forth. Thus, ovr th first scods, th fractio crossd by th bug is: 1 = H /100 100 =1 (This formula is valid oly util th bug rachs th far sid of th rug.) (c) Approximatly how may scods dos th bug d to cross th tir rug? Solutio. Th bug arrivs at th far sid wh th fractio it has crossd rachs 1. This occurs wh, th umbr of scods lapsd, is sufficitly larg that H /100 1. Now H is approximatly l, so th bug arrivs about wh: l 100 1 l 100 100 10 43 scods
4 Problm St 6 Problm 4. Us itgratio to fid lowr ad uppr bouds o th followig ifiit sum that diffr by at most 0.1. Show your wor. 1 1 1 1 S = + + + +... 1 3 4 To achiv this accuracy, add up th first fw trms xplicitly ad th us itgratio to boud all rmaiig trms. Solutio. Th sum of th first thr trms is: 1 1 1 49 s = + + = 1 3 36 A uppr boud o th rmaiig trms is: 1 1 dx = 3 x 3 Ad a lowr boud is: 1 1 dx = (x + 1) 4 3 Ovrall, w hav: 58 49 1 49 1 61 + = 36 36 + 4 S 36 3 36 Ths bouds diffr by 1/1 < 0.1. Th actual valu of th sum is π /6, though th proof is ot asy. Problm 5. A sasod MIT udrgraduat ca: Complt a problm st i days. Writ a papr i days. Ta a day road trip. Study for a xam i 1 day. Play foosball for a tir day. A day schdul is a squc of activitis that rquir a total of days. For xampl, hr ar thr possibl 7 day schduls: pst, papr, pst, foosball papr, study, foosball, pst, study road trip, road trip, road trip, study
Problm St 6 5 (a) Exprss th umbr of possibl day schduls usig a rcurrc quatio ad sufficit bas cass. Solutio. S(0) = 1, S(1) =. Ay schdul for > 1 days ds with o of 3 possibl day activitis or o of possibl 1 day activitis. So S() = S( 1) + 3S( ) for > 1. (b) Fid a closd form xprssio for th umbr of possibl day schduls by solvig th rcurrc. Solutio. Th charactristic polyomial for this liar homogous rcurrc is x x 3 = (x + 1)(x 3). Hc th solutio is of th form S() = a( 1) + b3. Lttig = 0, w coclud that a+b = 1, ad lttig = 1, w coclud a+3b =, so b = 3/4, a = 1/4, ad th solutio is: 3 +1 + ( 1) S() =. 4 Problm 6. Fid a closd form xprssio for T (), which is dfid by th followig rcurrc: T (0) = 0 T (1) = 1 T () = 5T ( 1) 6T ( ) + 6 for all Solutio. Th charactristic quatio is x 5x + 6 = 0, which has roots x = ad x = 3. Thus, th homogous solutio is: T () = A + B 3 For a particular solutio, lt s first guss T () = c: c = 5c 6c + 6 c = 3 Our guss was corrct; T () = 3 is a particular solutio. Addig this to th homogous solutio givs th gral solutio: T () = A + B 3 + 3
6 Problm St 6 Substitutig = 0 ad = 1 givs: 0 = A + B + 3 1 = A + 3B + 3 Solvig this systm givs A = 7 ad B = 4. Thrfor: T () = 7 + 4 3 + 3 Problm 7. Dtrmi which of ths choics Θ(), Θ( log ), Θ( ), Θ(1), Θ( ), Θ( l ), o of ths dscribs ach fuctio s asymptotic bhavior. Proofs ar ot rquird, but brifly xplai your aswrs. (a) + l + (l ) Solutio. Both > l ad > (l ) hold for all sufficitly larg. Thus, for all sufficitly larg : < + l + (l ) < + + So + l + (l ) = Θ(). (b) + 3 7 Solutio. Obsrv that: + 3 lim = 1 7 This mas, that for all sufficitly larg, th fractio lis, for xampl, btw, 0.99 ad 1.01 ad is thrfor Θ(1). (c) i=0 i+1 Solutio. Gomtric sums ar domiatd by thir largst trm, which is +1 = 4. This is Θ(4 ), which dos ot appar i th list providd. (d) l(!) Solutio. By Stirlig s formula:! π
Problm St 6 7 Taig logarithms givs: l(!) l( π ) = l( π ) + l Th first trm is tiy compard to th scod, which w ca rwrit as: l = l = Θ( l ) () 1 1 =1 Solutio. Th xprssio i parthss is always at last 1/ ad at most 1. Thus, w hav th bouds: 1 1 1 =1 =1 =1 Sic th first xprssio ad th last ar both Θ( ), so is th o i th middl. Problm 8. A triagular umbr is a itgr of th form whr is a positiv itgr. = 1 + + 3. +.. + = ( + 1) (a) Dscrib a solutio to th four pg Towrs of Haoi puzzl with ( + 1)/ diss that rquirs T movs, whr: Solutio. T 1 = 1 T = T 1 + 1 Mov all but th largst diss to aothr pg rcursivly. This rquirs T ( 1) movs. Mov th largst diss to aothr pg usig th thr pg stratgy. This rquirs 1 movs. Now mov all th othr diss o top of th largst diss rcursivly. This rquirs T ( 1) movs.
8 Problm St 6 Thus, with this stratgy, th total umbr of movs rquird to mov a stac of ( + 1)/ diss is T () = T ( 1) + 1. (b) Fid a closd form xprssio qual to T. Solutio. This is a ihomogous liar quatio. Lt s bgi by tryig to fid a particular solutio. Thr is both a xpotial trm ( ) ad a costat trm, so w might guss somthig of th form a + c: a + c = (a 1 + c) + 1 = (a + 1) + c 1 0 = + (c 1) Evidtly, th costat trm is c = 1, but th xpotial part is mor complicatd. Our rcip says w should xt try a particular solutio of th form a + b + 1: a + b + 1 = (a 1 + b( 1) 1 + 1) + 1 = (a b + 1) + b 1 Equatig th cofficits of th trms givs a = a b + 1, which implis b = 1. Thus, a + +1 is a particular solutio for all a. As log as w hav this dgr of frdom, w might as wll choos a so this solutio is cosistt with th boudary coditio T 1 = 1ad b do: a 1 + 1 1 + 1 = 1 a = 1 Thrfor, th solutio to th rcurrc is T = ( 1) + 1. (c) Approximatly how may movs ar rquird to solv th four pg, dis Towrs of Haoi puzzl as a fuctio of? Assum is a triagular umbr. (For styl poits, ma corrct us of asymptotic otatio.) 1 Solutio. W hav = ( 8 + 1 1) = + O(1). So th umbr of movs rquird is Θ( ).