Mathematics review for CSCI 303 Sprig 019 Departmet of Computer Sciece College of William & Mary Robert Michael Lewis Copyright 018 019 Robert Michael Lewis Versio geerated: 13 : 00 Jauary 17, 019
Cotets 1 Sums of powers of itegers 3 Solvig recurreces via backwards iteratio 4 1 Itroductio 4 Example: T (/) + c 4 3 Example: T ( 1) + 5 4 Example: /( + )T ( 1) 8 5 Exercises 9 3 Oe theorem to rule them all: the Master Theorem 11 31 Itroductio 11 3 Derivatio 11 33 Some techicalities 13 4 Liear homogeeous recurrece relatios 15 41 Itroductio 15 4 Solvig liear homogeeous recurrece relatios 15 5 Solvig recurreces via geeratig fuctios 17 51 Itroductio 17 5 Example: T (/) + c 17 53 Example: the Fiboacci umbers 18 54 Example: the Catala umbers 0 6 The harmoic series 61 The harmoic series 6 Asymptotic behavior of the harmoic series 7 Solvig recurreces via forwards iteratio 4 71 Itroductio 4 7 Example: T (/) + c 4 73 Example: 7T (/8) + 14 5
1 Sums of powers of itegers Let S k () deote the sum of the k-th powers of the first itegers: S k () = i=1 i k It is clear from the fact that S k ( + 1) = S k () + ( + 1) k that S k () is a polyomial of fiite degree Moreover, sice S k () = O( k+1 ) we ca see that S k () is a polyomial of degree of at most k + 1 This suggests oe approach to derivig formulae for S k () 1 Cosider S 1 () = i=1 i We surmise that this is a polyomial of degree : S 1 () = a + b + c We must have so or S 1 ( + 1) = a( + 1) + b( + 1) + c = S 1 () + ( + 1) = a + b + c + ( + 1), a( + + 1) + b( + 1) + c = a + b + c + ( + 1) a( + 1) + b = + 1, (a 1) + (a + b 1) = 0 For this equatio to hold for all we must have a = 1, b = 1, which yields the familiar formula S 1 () = i=1 i = 1 + 1 ( + 1) = 1 Oe of may there is a extesive literature o exact formulae for S k ()
Solvig recurreces via backwards iteratio 1 Itroductio A recursive fuctio is a fuctio that is defied i terms of itself via a recurrece relatio I order for the recursio to have a well-defied solutio, a iitial coditio ( base case ) eeds to be specified, as well I this chapter we review a techique for solvig recurrece relatios that we will call backwards iteratio 1 The idea of backwards iteratio is to apply the recurrece repeatedly util the expressio is reduced to explicitly kow quatities ad there is o loger ay recursive defiitio ivolved Here are some tips i coectio with this techique Typically, simplifyig expressios i backwards iteratio is ot a good idea sice it teds to obscure how thigs deped o the level of iteratio For istace, seeig a term such as 7 3 + 7 + 7 + 1 appear after four steps is more illumiatig that the simplified expressio 400 I recursios that arise i divide-ad-coquer strategies, eg, T ( ) + c, a commo mistake whe applyig backwards iteratio is to write T ( ) = T ( ) + c whe it should be T ( ) = T ( ) + c I a proof by iductio, you should make clear the iductive basis, the iductive hypothesis, ad what you eed to prove i the iductive step Example: T (/) + c Cosider 1 if = 1 iitial coditio, T (/) + c if recurrece relatio, where we assume is a power of : = k 1 Iteratio of the recurrece Start with the geeral recurrece as Iteratio 1: Iteratio : T ( ) + c Iteratio 3: Iteratio 4: ( ) + c ) + c = T ( ) + c ( 3 ) + c ) + c = T ( 3 ) + 3c ( 4 ) + c ) + 3c = T ( 4 ) + 4c At this poit the patter is clear: 1 There does ot seem to be a settled ame for this method
3 Example: T ( 1) + 5 Cojecture 1 At the ed of the m-th iteratio, T ( m ) + cm Proof of the cojecture Iductive basis Whe m = 1, T ( ) + c = T ( 0 ) + c 0 = T ( m ) + cm Iductive hypothesis Now suppose that for some m 1, T ( m ) + cm Iductive step We wish to show that T ( ) + c(m + 1) m+1 From the geeral recurrece we kow that T ( m+1 ) = T ( m ) + c Thus, from the iductive hypothesis we have ( ) T ( m+1 ) + c + cm = T ( + c(m + 1), m+1 which is what we wished to show 3 Reducig the recursive expressio Choosig m = k, the, sice = k (ad k = log ) we obtai T ( k ) + ck = T (1) + ck = 1 + clog 4 Coclusio Thus, the solutio of for = k is clog + 1 1 if = 1 iitial coditio, T (/) + c if recurrece relatio, 3 Example: T ( 1) + Cosider the followig recurrece relatio: 1 if = 1 iitial coditio, T ( 1) + if recurrece relatio
6 Chapter Solvig recurreces via backwards iteratio 31 Iteratio of the recurrece If we call the geeral recurrece Iteratio 1 (it does t matter how you umber your iteratios as log as you are cosistet), T ( 1) +, the applyig the recurrece repeatedly yields the followig Iteratio : Iteratio 3: Iteratio 4: [T ( ) + ( 1)] + = T ( ) + ( 1) + [T ( 3) + ( )] + ( 1) + = T ( 3) + ( ) + ( 1) + [T ( 4) + ( 3)] + ( ) + ( 1) + = T ( 4) + ( 3) + ( ) + ( 1) + By ow, the patter should be apparet: Cojecture 31 After the m-th iteratio, m 1 T ( m) + 3 Proof of the cojecture ( i) We prove the cojecture usig iductio o m Proof Iductive basis Whe m = 1 (ie, Iteratio 1), m 1 T ( 1) + = T ( m) ( i) Iductive hypothesis Now suppose that for some m 1, m 1 T ( m) + ( i) = T ( i) + m 1 ( i) Iductive step You should state what it is you eed to prove, so you will kow what you eed to prove, ad whe you ve proved it I this case we wish to show that T ( (m + 1)) + m ( i) By the iductive hypothesis, after m iteratios, m 1 T ( m) + ( i)
3 Example: T ( 1) + 7 Applyig the recurrece T ( 1) + yields T ( m) = T (( m) 1) + ( m) = T ( (m + 1)) + ( m) Applyig the iductive hypothesis yields m 1 [T ( (m + 1)) + ( m)] + which is what we wished to show ( i) = T ( (m + 1)) + m ( i), We ow kow that after m iteratios, m 1 T ( m) + ( i) However, we re ot doe yet we still have a recursive expressio 33 Reducig the recursive expressio For this recurrece, the iitial coditio is T (1) = 1 Whe we reach this case, we ca elimiate the recurrece etirely ad replace T (1) with the value 1 This occurs whe (( 1) i) = 1, or i = Thus, after 1 iteratios, T (1) + ( i) = 1 + ( i) = All that is left is to reduce this summatio 34 Reducig the summatio Observe that 1 ( i) 1 ( i) = ( 0) + ( 1) + + ( ( )) + ( ( 1)) = + ( 1) + ( ) + + + 1 = The formula for the sum of the first itegers the tells us that ( + 1) 35 Coclusio For > 1, the solutio of the recurrece 1 if = 1 T ( 1) + if, i=1 i is ( + 1)
8 Chapter Solvig recurreces via backwards iteratio 4 Example: /( + )T ( 1) Cosider 1 if = 1, T ( 1) if + 41 Iteratio of the recurrece Start with the geeral recurrece as Iteratio 1: Iteratio : Iteratio 3: T ( 1) + 1 T ( ) + + 1 1 + + 1 Iteratio 4: 1 + + 1 T ( 3) Now the patter has emerged: 3 T ( 4) 1 Cojecture 41 After the m-th iteratio, ( 1)( ) ( m + 1) ( + )( + 1) ( m + 3) m 1 ( i) T ( m) = m 1 ( i + ) T ( m) We could have simplified the product at each step, but that would have made the patter more difficult to discer 4 Proof of the cojecture We prove the cojecture usig iductio o m Proof Iductive basis Whe m = 1, + T ( 1) = 0 ( i) T ( 1)) ( k + ) = T ( 1) = m 1 + 0 ( i) m 1 ( k + ) T ( m)) Iductive hypothesis Now suppose that for some m 1, m 1 ( i) m 1 ( i + ) T ( m) Iductive step We wish to show that m ( i) T ( (m + 1)) ( i + ) m
5 Exercises 9 From the recurrece we kow that T ( m) = m) m + T ( m 1) Applyig the iductive hypothesis yields m 1 ( i) m 1 = m 1 m 1 ( i + ) T ( m) ( i) m+ ( i + ) T ( m 1) m + ( i) T ( (m + 1)), ( i + ) = m m k=0 which is what we wished to show 43 Reducig the recursive expressio If we choose m = 1, the m = 1 ad ( i) ( i + ) T (1) = Now it makes sese to simplify the quotiet: ( i) = ( 1) 5 4 3 ( i) ( i + ) ( i + ) = ( + ) ( + 1) ( 1) 5 4 All but the first two ad last two terms i each product cacel, so ( i) ( i + ) = 3 ( + )( + 1) 44 Coclusio For > 1, the solutio of the recurrece relatio 1 if = 1 iitial coditio, T ( 1) if recurrece relatio + is 5 Exercises 6 ( + )( + 1) Exercise 51 Solve the recurrece 1 if = 1, T ( 1) + ( 1) if > 1
10 Chapter Solvig recurreces via backwards iteratio Exercise 5 Solve the recurrece 1 if = 1, 9T ( ) + c for > 1 ad a power of Check your result agaist Theorem 311 Exercise 53 Solve the recurrece 1 if = 1, 3T ( ) + for > 1 ad a power of Check your result agaist Theorem 311 Exercise 54 Solve the recurrece 1 if = 1, T ( ) + log for > 1 a power of
3 Oe theorem to rule them all: the Master Theorem 31 Itroductio There is a geeral result, sometimes called the Master Theorem for recursios of the form ( at + f () b) Recursios of this form appear i the aalysis of divide-ad-coquer algorithms Here is a statemet of the theorem Theorem 311 Master Theorem Let T () be a odecreasig, oegative fuctio that satisfies ( at + f () for = b b) k, k = 1,, T (1) = 1, where a 1, b, ad c > 0 If f () = Θ( d ), the Θ( d ) if a < b d, Θ( d lg) if a = b d, Θ( log b a ) if a > b d This result is true whether oe chooses /b or /b as the meaig of /b If we apply the precedig solutio to the particular case of a recursio like that i mergesort, T ( ) + c, the a =, b =, ad f () = c The d = 1 sice f () = Θ() Sice a = b d, the theorem tells us that Θ(log ) 3 Derivatio The Master Theorem ca be derived by applyig backwards iteratio to the recurrece: ( at + f () for = b b) k, k = 1,, T (1) = 1, Assume for ow that = b k Start with the geeral recurrece as Iteratio 1: Iteratio : at ( b ) + f () a Iteratio 3: (at ( b ) + f ( b ) ) + f () = a T ( b ) + a f ( b ) + f () a ( at ( b 3 ) + f ( b ) ) + a f ( b ) + f () = a 3 T ( b 3 ) + a f ( b ) + a f ( b ) + f ()
1 Chapter 3 Oe theorem to rule them all: the Master Theorem Iteratio 4: a 3 ( T ( b 4 ) + f ( b 3 ) ) + a f ( b ) + a f ( b ) + f () = a 4 T ( b 4 ) + a3 f ( b 3 ) + a f ( b ) + a f ( b ) + f () We ca ow guess the patter: Cojecture 31 At iteratio m of this process, ( ) a m m 1 T b m + a i f ( b i ) 31 Proof of the cojecture Iductive basis Whe m = 0 (ie, o iteratios), at ( ( ) m 1 b ) + f () = am T b m + a i f ( b i ) Iductive hypothesis Now suppose that for some m 0, ( ) a m m 1 T b m + a i f ( b i ) Iductive step We wish to show that ( ) a m+1 T b m+1 + m a i f ( b i ) From the geeral recurrece we kow that ( ) ( ) T b m = at ( b m+1 ) + f b m The iductive hypothesis the yields ( a m ( )) at ( b m+1 + f b m as threateed m=1 + = a m+1 ( ) T ( b m+1 ) + am + f b m = a m+1 m T ( b m+1 ) + a i f ( b i ), ( ) a i f b i m=1 + ( ) a i f b i 3 Reducig the recursive expressio For simplicity we will oly solve the case f () = d The more geeral case f () = Θ( d ) follows from a very similar argumet usig upper ad lower bouds o f () i terms of d Recall we are assumig = b k If we choose m = k, the a k T ( b k ) + k 1 a i ( b i ) d = a k T ( b k ) + d k 1 ( a b d ) i
33 Some techicalities 13 For the first term we have a k T (1) = a log b = b log b a log b = b log b log b a = log b a If a b d = 1, the d k 1 We the have ( a b d ) i = d k = d log b log b a + d log b Sice a = b d, we have so log b a = log b b d = d, d + d log b = Θ( d log b a) This is case () i Theorem 311 Meawhile, if a b d 1, the the formula for a geometric sum yields d k 1 ( a b d ) i = d 1 ( a b d ) k 1 a b d Reasoig as above, we see that = d ( ) k a b 1 d a 1 b d ( a ) k a log b = b d b d log b = blogb a logb b d log b = logb a d Thus, if a b d 1, log b a + d logb a d 1 a b d 1 = log b a + logb a d a 1 b d If a < b d, the log b a < d, so log b a < d ad Θ( d ) This is case (1) i Theorem 311 O the other had, if a > b d, the log b a > d, so log b a > d ad Θ( log b a ) This is case (3) i Theorem 311 33 Some techicalities We proved the Master Theorem uder the assumptio that was a power of b What if it is t? Let T () be a odecreasig, oegative fuctio I this cotext we say T () grows saely if T () = Θ(T ())
14 Chapter 3 Oe theorem to rule them all: the Master Theorem That is, there exist m,m ad N such that mt () T () MT () for all N Fuctios like k ad lg satisfy this coditio O the other had, rapidly growig fuctios like ad! do ot We ow preset a series of propositios that assure us that it is OK to assume is a power of b i our complexity aalysis Propositio 331 Let T () be a saely growig fuctio, with mt () T () MT () The for ay iteger k 1, m k T () T () M k T () Proof Use iductio o k Propositio 33 Let T () be a saely growig fuctio The for ay iteger b, T (b) = Θ(T ()) Proof Let k be such that k 1 b k Because T is odecreasig, T (b) T ( k ) M k T () Similarly, m k 1 T () T ( k 1 ) T (b) Propositio 333 Let T () be a saely growig fuctio If Θ( f ()) for values of that are powers of b, where b, the Θ( f ()) for all Proof There exists M such that for all k sufficietly large we have T (b k ) M f (b k ) Give, choose k so that b k b k+1 Sice T is odecreasig, T (b k ) T () T (b k+1 ) M f (b k+1 ) Sice T is saely growig, there exists B such that The f (b k+1 ) = f (b b k ) B f (b k ) T () T (b k+1 ) MB f (b k ) MB f () The lower boud o T () i terms of f () ca be derived i a similar maer
4 Liear homogeeous recurrece relatios 41 Itroductio A liear homogeeous recurrece relatio of order k ivolvig a 1,a, is oe that ca be put i the form β k a +k + β k 1 a +k 1 + + β 1 a +1 + β 0 a = 0, where the β i are costats i depedet of For istace, cosider the Fiboacci umbers 0,1,1,,3,5,: 0 if = 0, F = 1 if = 1, F 1 + F if We ca write the geeral recurrece as F + F +1 F = 0, a liear homogeeous differece recurrece of order Liear refers to the fact that there are o oliear fuctios of ay of the a i appearig, ad homogeeous refers to the fact that the right-had side is zero 4 Solvig liear homogeeous recurrece relatios Liear homogeeous recurrece relatios ca be solved usig a trick that goes back to Lagrage i 1775 We try to fid solutios of the form a = cr for some r For istace, for the Fiboacci recurrece, if we try F = cr, we have F + F +1 F = cr + cr +1 cr = cr (r r 1) = 0 Thus, either r = 0 (which is ot iterestig) or r r 1 = 0, whece r = 1 ± 5 If r 1,r are the two roots of r r 1 = 0, r 1 = 1 + 5, r = 1 5, the we see that the geeral solutio to F + F +1 F = 0 is F = c 1 r 1 + c r We determie c 1,c by applyig the iitial coditios: F 0 = c 1 + c = 0 F 1 = c 1 r 1 + c r = 1
16 Chapter 4 Liear homogeeous recurrece relatios From the first relatio we see that c = c 1 Substitutio i the secod relatio yields c 1 r 1 c 1 r = 1 c 1 = 1 r 1 r = 1 5 Thus we arrive at the followig formula for the -th Fiboacci umber: [( ) ( ) ] F = 1 5 1 + 5 1 5 If you have see the solutio of liear homogeeous differetial equatios, the precedig solutio will look familiar If you have t see the solutio of liear homogeeous differetial equatios, there is still time
5 Solvig recurreces via geeratig fuctios 51 Itroductio Give a sequece a 0,a 1,a,, the associated (ordiary) geeratig fuctio is G(z) = k=0 a k z k (511) For ow, this is purely a formal power series at this poit we are ot worried about whether or ot the series coverges 1 Here is the strategery for solvig recurreces via geeratig fuctios: 1 Start with a recurrece relatio ivolvig the a k Tur this ito a relatio ivolvig the geeratig fuctio G(z) 3 Use the ew relatio to idetify G(z) 4 Fid the series expasio (511) for G(z) 5 The coefficiets of the series expasio of G(z) are the a k we seek 5 Example: T (/) + c Cosider Let a k = T ( k ) The a 0 = T (1) = c 0 a k = a k 1 + c 1 c0 if = 1 base case f ( ) + c1 if geeral case Multiply a k = a k 1 + c 1 by z k ad sum over k: so a 1 z = a 0 z + c 1 z a z = a 1 z + c 1 z a 3 z 3 = a z 3 + c 1 z 3 = a 1 z + a z + = (a 0 z + a 1 z + ) + c 1 (z + z + ) (a 0 + a 1 z + a z + ) a 0 = z(a 0 + a 1 z + a z + ) + c 1 z(1 + z + z + ) ad, fially, (1 z)g(z) = c 0 + c 1 z G(z) a 0 = zg(z) + c 1 z k=0 z k k=0 1 I more mathematical termiology, we are workig i the rig of formal power series over the reals z k,
18 Chapter 5 Solvig recurreces via geeratig fuctios Now we use the covergece of the series: if z < 1, so k=0 z k = 1 1 z, 1 (1 z)g(z) = c 0 + c 1 z 1 z, 1 G(z) = c 0 1 z + c 1 1z (1 z) However, 1 (1 z) = d 1 dz (1 z) = d dz so k=0 k=0 G(z) = 0 z k=0c k + c 1 c 1 kz k k=1 a k z k = c 0 + k=1 (c 0 + c 1 k)z k Equatig coefficiets, we see that c a k = 0 if k = 0, c 0 + c 1 k if k > 0 Sice a k = T ( k ), we have or, if = k T ( k ) = c 0 + c 1 k, c 0 + c 1 lg z k = k=1 kz k 1, 53 Example: the Fiboacci umbers We ca apply the method of geeratig fuctios to the Fiboacci umbers: 0,1,1,,3,5,8,13,, where the -th Fiboacci umber F is give by 0 if = 0, F = 1 if = 1, F 1 + F if Multiply a = a 1 + a by z ad sum over : a z = a 1 z + a 0 z a 3 z 3 = a z 3 + a 1 z 3 a 4 z 4 = a 3 z 4 + a z 4 = Techically, we eed to justify the iterchage of differetiatio ad ifiite summatio This iterchage is valid because of the uiform covergece of the series that is the putative derivative for a < 1 The uiform covergece of this series ca be cofirmed usig the Weierstrass M-test
53 Example: the Fiboacci umbers 19 so a z + a 3 z 3 + = z(a 1 z + a z + ) + z (a 0 + a 1 z + a z + ) (a 0 + a 1 z + a z + ) (a 1 z + a 0 ) = z(a 0 + a 1 z + a z + ) a 0 z + z G(z) Sice a 0 = 0 ad a 1, this reduces to whece G(z) z = zg(z) + z G(z), G(z) = z 1 z z G(z) (a 1 z + a 0 ) = zg(z) a 0 z + z G(z) We ca simplify the quotiet o the right usig partial fractios Before doig so, cosider the factorizatio of z + z 1 If the roots of this polyomial are r 1,r, the z + z 1 = (z r 1 )(z r ) = z (r 1 + r )z + r 1 r From this we see that r 1 r = 1, so z + z 1 = (z r 1 )(z r ) = r 1 r ( z r 1 1)( z r 1) = ( z r 1 1)( z r 1) = (r z 1)(r 1 z 1) Now we apply the method of partial fractios: we wat to fid c 1,c such that Sice we wat z 1 z z = z z + z 1 = c 1 r 1 z 1 + c r z 1 c 1 r 1 z 1 + c r z 1 = c 1(r 1) + c (r 1 1) z, + z 1 c 1 r + c r 1 = 1 c 1 + c = 0 Thus, c = c 1, ad c 1 r c 1 r 1 = 1 c 1 = 1 r 1 r It follows that ( z 1 G(z) = 1 z z = c 1 r 1 z 1 1 ) r z 1 Sice G(z) = =0 a z, = c 1 ( =0r 1 z =0 r z )
0 Chapter 5 Solvig recurreces via geeratig fuctios equatig like terms yields a = c 1 (r 1 r ) The roots of z + z 1 are Sice r 1 = 1 + 5 r = 1 5 c 1 = 1 r 1 r = 1 5, we obtai the formula [( F = 1 1 + 5 5 ) ( for the -th Fiboacci umber 1 ) ] 5 54 Example: the Catala umbers The Catala umbers C satisfy the recurrece C +1 = k=0 C 0 = 1 C k C k, 0, We will ecouter the Catala umbers i coectio with coutig biary trees ad groupigs of associative biary operatios Cosider the geeratig fuctio G(z) = =0 C z It is ot difficult to verify that G (z) = =0( k=0 C k C k )z, so from the recurrece we see that The G (z) = =0 C +1 z zg (z) = =0 1 + zg (z) = G(z) zg (z) G(z) + 1 = 0 C +1 z +1,
54 Example: the Catala umbers 1 Solvig for G(z) yields two possible solutios: G(z) = 1 ± 1 4z z Sice C 0 = 1, we must have G(0) = 1, so we choose the solutio that does ot blow up as z 0: G(z) = 1 1 4z z You ca verify that lim z 0 + G(z) = 1 usig L Hôpital s rule Recall the Taylor s series expasio for 1 + x: ( 1) 1 + x = ( ) =0 4 x (1 ) From this we obtai ( G(z) = 1 ( 1) 1 z =0 4 (1 ) = 1 ( ) 1 z z =1 ( 1) = 1 ( ) 1 z 1 ( 1) = 1 = 1 =1 =0 =0 =0 =0 =0 = 1 = = 1 ( + 1) 1 ( ) )( 4z) ( ) ( + 1) z ( + 1) 1 ( + )( + 1) + 1 ( + 1)( + 1) ( ) + z ( + 1)( + 1) ( ) + 1 z ( + 1)( + 1) 1 + 1 ( ) z ( ) z From this we coclude that the -th Catala umber is C = 1 ( ) + 1 Asymptotic growth of the Catala umbers Applyig Stirlig s approximatio, we obtai ( ) π e () π e ( 4 = π e ) ( = 4, π) e π so for large we have 4 C = 1 + 1 π From this we see that the Catala umbers grow very quickly
6 The harmoic series 61 The harmoic series The harmoic series is k=1 1 k = 1 + 1 + 1 3 + 1 4 + Deote by H the partial sum H = k=1 1 k H is called the -th harmoic umber You doubtless proved i a calculus course that H as 6 Asymptotic behavior of the harmoic series I fact, H l for large More precisely, Theorem 61 lim (H l) = γ = 05771566 The quatity γ is kow as Euler s costat or the Euler-Mascheroi costat Euler s costat remais a somewhat mysterious etity; for istace, it is ot kow if γ is ratioal or irratioal, much less trascedetal 61 The zeta fuctio For itegers m defie ζ (m) = j=1 1 j m Sice m, this is a absolutely coverget series, ad ζ (m) is fiite Observe that ζ is a decreasig fuctio of m: if m < m, the ζ (m) > ζ (m ) For istace, ζ () = 1 j=1 j > 1 j=1 j 7 = ζ (7) Aside More geerally, for s C with Re s > 1 the Riema zeta fuctio is defied to be ζ (s) = 1 j=1 j s There is a very famous usolved problem i mathematics kow as the Riema Hypothesis that cocers the zeta fuctio 1 1 Solve it ad you will wi $1,000,000
6 Asymptotic behavior of the harmoic series 3 6 Proof of the theorem The proof we give here follows Euler s origial argumet (1731) Defie H,m = Note that so j=1 lim H,m = 1 j m, m j=1 1 j m = ζ (m) The Newto-Mercator series says that for 1 < x 1, l(1 + x) = k+1 xk ( 1) k=1 k, ( ) 1 + 1 ( ) 1 1 ( ) 1 3 + l = 1 1 1 3 1 4 1 ( ) 1 + 1 ( ) 1 1 ( ) 1 3 + l 3 = 1 1 3 4 l 4 3 = 1 3 1 ( ) 1 + 1 ( ) 1 1 ( ) 1 3 + 3 3 3 4 3 l 5 4 = 1 4 1 ( ) 1 + 1 ( ) 1 1 ( ) 1 4 + 4 3 4 4 4 = If we sum the first equatios, o the left-had side we obtai l + l 3 + l 4 3 + l 5 4 + + l + 1 = l Meawhile, o the right-had side we obtai H 1 H, + 1 3 H,3 1 4 H,4 +, where we have summed terms by colums Thus, Sice l( + 1) = H 1 H, + 1 3 H,3 1 4 H,4 + H l( + 1) = 1 H, 1 3 H,3 + 1 4 H,4 H l (l( + 1) l) = 1 H, 1 3 H,3 + 1 4 H,4 lim (l( + 1) l) = 0, takig the limit as we obtai ( 3 4 3 5 4 + 1 ) = l( + 1) lim (H l) = 1 ζ () 1 3 ζ (3) + 1 ζ (4) 4 Sice the sum o the right is a alteratig series of strictly decreasig terms, the sum exists The limit is defied to be Euler s costat γ
7 Solvig recurreces via forwards iteratio 71 Itroductio A recursive fuctio is a fuctio that is defied i terms of itself via a recurrece relatio I order for the recursio to have a well-defied solutio, a iitial coditio ( base case ) eeds to be specified, as well Forwards iteratio ivolves 1 computig successive values of the recursively defied quatity startig from the iitial coditio, power-readig the resultig sequece to guess the geeral form of the solutio, ad 3 provig our guess is correct This approach is based o a large elemet of hope, it is ot systematic, ad is frequetly usuccessful For this reaso we do ot recommed it 7 Example: T (/) + c Cosider We have T (1) = 1 1 if = 1, T ( ) + c if T () = T (1) + c = c + T (4) = T () + c 4 = (c + ) + 4c = 8c + 4 T (8) = T (4) + c 8 = (8c + 4) + 8c = 4c + 8 T (16) = T (8) + c 16 = (4c + 8) + 16c = 64c + 16 If we re really observat, we will otice that the patter is or T ( m ) = cm m + m, clog + We ca cofirm this guess by iductio Whe = 1 we have c1log 1 + 1 = 1 = T (1) Now suppose that the result holds for some = m 1: T ( m ) = cm m + m We wish to show that T ( m+1 ) = c(m + 1) m+1 + m+1 By the recurrece ad the iductive hypothesis we have as desired T ( m+1 ) = T ( m ) + c m+1 = (cm m + m ) + c m+1 = cm m+1 + m+1 + c m+1 = c(m + 1) m+1 + m+1,
73 Example: 7T (/8) + 14 5 73 Example: 7T (/8) + 14 Next we look at a example that illustrates the limitatios of this approach Cosider 1 if = 1, 7T ( 8 ) + 14 if We have T (1) = 1 T (8) = 7T (1) + 14 64 = 903 T (64) = 7T (8) + 14 4096 = 63665 This time it is ot at all clear what the geeral patter is (it turs out to ivolve log 7