Download as pdf
Download as pdf
You are on page 1of 34
Recurrence Relations and Generating Functions ———— Recurrence Relation and Generating Function: Introduction to Recurrence Relation and Recursive algorithms, linear recurrence relations with constant coefficients, Homogeneous solutions, Particular solutions, Total solutions, Generating functions, Solution by method of generating functions. ee §5.1, Introduction : We know that a real sequence is defined as a function SEN = (1,23... 9 R Here we shall study the function f : {0,1,2,.....} 9 R i.e, from a set of non negative integers to a subset of R. Such function are called discrete numeric functions or briefly numeric function. Numeric functions are useful because most of the counting problems involve non negative integers. Discrete numeric functions are of particular nlerest to us because we encounter them very ofter in digital computation, §5.2. Discrete Numeric Function : Definition : A function — f:{0,1,2,...,}9R is called a discrete numeric function or briefly a numeric function, Notation : Numeric functions are denoted by bold face lower case italic letters of English alphabet viz a, b, G..... etc. A numeric function @ represents + M1 AY 500 where f(0)=a9, S(1)= a, £(2)=42.- Method of representing the numeric function : S(r)= (1) By listing its values in order (49.41.42, ..s47 Forexample, (1.4,9,16...00? ) is the numeric function a whose r th term a, is +. rz0 Osrsll r212 {* 1=3,5,7,9 3% 0, otherwise 3+r, Osrs4 4. d,=43-7, r>4, ris odd air r>4,_riseven Ex.1, An aircraft takes off after spending 10 minutes on the groud, climbs up at a unifory speed at an altitude 10 thousand meters in 10 minutes, starts ta descend uniformly after 2 hours of flying time and lands 10 minutes later. Find the numeric function. Sol. Let a, denote the altitude of an aircraft in thousands of meters, at the th minute then the numeric function a, of the altitude of the aircraft is given by 0, 0srsi0 r-10, lsrs20 a,=4 10, 21 2d. ges ‘The height reached by the ball in the second rebound 2 = Similarly the height reached by the ball in the rth rebound 4; = 2m 7 40 Thus the required numeric function @ = ate a The loss in height during the first rebound &, = (»-2 \w The loss in height during the second rebound 5, = (»-$ \n 2 Similarly the loss in height during the rth rebound 5, (« — Thus the required numeric function 0, =40— 18m = 40-a,. a ®-10m a The height reached by the first ball after the second rebound 10 Therefore numeric function corresponding to the first ball after second rebound 4, y 15 Similarly the numeric function corresponding to the second ball ¢ = yr & 15/2" 3 a, 10/2" 2 Now Ans. §5.3. Recurrence relation : Definition : A numeric function (9,4,542)-0.»5p-..) is described by specifying explicitly etc. anda relation for obtaining a, in terms ofits preceeding 2p Ex.L, a =1and a, =74,-1,7 21 describe the numeric function (12.77,7°, Ex.2, ag =1, a =1, 4, = 4-1 + 4r-2 r22 describe the numeric function 4 = (1,1,2,3,5,8,13,, This numeric function is called Fibonacci Numbers. ns eee ee a a ee {§5.4. Manipulation of Numeric Functions Al) Sum : Definition : Let a and b two numeric functions. Theh their sum (a +B) isq numeric function whose value at r is equal to the sum of the values of the two numeric functions aand batr For example, Consider the two numeric functions @ and 6 where Osrs2 r23 3-2", Osrsl 3 F and a r>2 Let the sum of numeric functions a and b i.e., a + b be denoted by c. Then 322" Osrsl c, =a, +b, =44 r=2 2 +r +7, r23 i. Let the numeric function S‘a be denoted by 6. Then pa[ % 9Srs(i-1) Eclage. 3 denotes the value of S'a at r. For example, consider the numeric function a where 1, Osrsi0 2, rein Then S7@ is a numeric function b whose value at r is given by 0, Osrs 0, osrs6_|” srs6 b= 27 =41 7srsi7 TD 2 zis. Numeric Function Sa . Definition : Let a be a numeric function and i a positive integer. Then Sa is a mumeric function Tnother words, S~fa is a numeric function b whose value at ris given by 6, where ; Orin 720. oe For example, let a bea numeric function, where Osrsl0. r2il Then S7Sa isa numeric function defined by {i osrss 419, r26 Where b, denotes the value of S~*a atr. (3) Accumulated Sum of a Numeric Function > z ve Let abe anumeric function. Then the accumulated sum of numeric function ais a numeric function b whose value at rie. b, is given by 4, =Sa, 20 i Example. A person deposits Rs. 100 every year in his saving account at an annual compound interest rate of 8 %. What is the total amount in the saving account after r years > Sol. In the earlier example it has already been shown that the total amount in the saving account at compound interest rate of 8% after r years is given by the accumulated sum of the numeric function a where a, = 100(1 + 0.8) =100(1.08)" Let the accumulated sum of a be b, Then b, = Ya, = Y,100(1.08)! = [¢-08y""-1}, r20 10 inO 08 gives the total amount in his saving account after r years. Ans, Ao The Forward Difference and the Backward Difference of a Numeric Function: Forward Difference : Definition : ‘The forward difference of a numeric function a is a numeric function denoted by Aa, whose value at r is given by Aa, =4,4)—4,, 720 Backward Difference : Definition : © The backward difference of a numeric function a is a numeric function denoted by Va whose value at r is given by | Va, =a,-a,4, 21. Ex. Leta be a numeric function such that 0, Osrs3 © |2ah43, red a then () the Forward difference ofa ic. Aa =b where Osrs2 r=3 r24 (ii) The Backward difference of a i.e. Ya =e , where ~4-4 0, Osrs3 =419, r=4 wt pes Convolution of Two Numeric Functions : Definition : \/ Let aand b be two numeric functions. The convolution of a and 6, denoted by a a numeric function ¢ such that +p, i8 44-1, Let a and b be the numeric functions where " -{ Os (©) Asymptotic Behaviour of Numeric Functions : Asymptotic behaviour of a numeric function means how the value of the function varies for larger The value of the numeric function a, =3, r20 remains constant for increasing -_, ~The value of the numeric function b, =3r, r20 increases for increasing r and is proportional tor. “The value of the numeric function » 720 symptotic Dominance : Let a and b be two numeric functions. Then a is said to be asymptotically dominating a or bis asymptotically dominated by a if there exist positive constants m and n such that : |olsma,, r2n Ex. Leta and b be two numeric function such that a, =2r+3, 720 and b, r20 then on taking m= 3 and 7=5,wehave 2 lels3er, for r25 This shows that numeric function a asymptotically dominates 6 Remark. A numeric function @ asymptotically dominates the numeric function b means a ia faster than b. It means for sufficiently large 7, the absolute value of b, does not exceed a fixed multiple of * Some Useful Results : (@) Forany numeric function a,|a| asymptotically dominates a. (®) Ifthe numeric function 6 is asymptotically dominated by a, then for any constant G, big also dominated by a. © two numeric functions b and ¢ are asymptotically dominated by a numeric function g, then for constants o. and the numeric function ab +Be is asymptotically dominated bya. > @ 1fthe numeric function cis asymptotically dominated by b and b is asymptotically dominate, by a then c is asymptotically dominated by a. (© "Ifthe numeric function b is asymptotically dominated by a then the numeric function Sb is asymptotically dominated by $a. ‘The proofs of these results are quite simple and left as an exercise for the readers. (8) The Big-oh Notation : Let O(a) denote the set of all numeric functions that are asymptotically ‘dominated by 4, O(a) is called “order a” or “big-oh of a”. Thus O(a) is a set consisting of all numeric functions which are asymptotically domainated by a. Symbolically, 6 € O(a) if we can find two positive constants m and k, such that |b-|Sma, whenever »>k If} € O(a) then we say that b is O(a). Remark. If is O(a) then we shall mean that b does not grow faster than a. However, it may be that 6 could grow much slower than a. For example, the numeric function b defined by 6, grows much slower than a, Some useful results : 1. Forany numeric function a, a is O(|a|). 2, Ifb is O(a), then for any constant 0,0 is also O(a). 3. Ifbis O(a), then for any integer i, sip is o(s'a) 4, If both b and care O(a), then for any constants o. and B,cib+Be is also O(a) 5, Ifcis O(b) andbis O(a), thencis O(a). 6 Ifbis O(a), then O(b)< O(a). So, ifb is O(a) and ais O(6), then O(a)=O(5)- 7. Foranya, O(a)+O(a)=O(a) & Ifbe O(a), then O(a)+O(b)=O(a). 9, Forany constant o,c.0(a)=O(aa)=O(a). 10. Forany aand b, O(a)O()=O(ab) 11, O(c O(logr) cO(r)< O(r')co(or)< O(r!) (9) Big-theta : Fora given numeric function a,©(a) (big-theta) is the set of all numeric function 6 for which there exists positive constants m,m and n such that ma, S|b,| Sma, for r2n ‘Thus if is ©(a) then it grows at the same rate as a. Ex.l. Leta be anumeric function given by 2, Osrs3 dar 4s, re4 Determine (a) S?q and Sa. (6) Aa and Va. Sol. (a) We have 0, Osrsl S’e=} 2, 2srss artes, r26 2 Oy. Determine dab. . Sol. Let c= ab then (r+ 2)2"41 (r+ 1)2" =[2(r+2)-(r +1)]2” =(r+3)2" ‘Ans, -Ex3, Let c=ab. Showthat Ac, = 4,44 (Ab,) +5, (Aq, ) Sol. Wehave Ac, = r= Cra Cp = inst Bra — Orb tr+t Prt — Arg By + p41 By — by = Ar (bra 5, ) +b, (drat ~47) = 441 (Ab, )+5, (Aa,) Hence Proved, Ex.4. Show that the numeric function awhere 4, Oy + Oyr + Or? +... yr” where a s are constantis O(r"). Sol. Wehave |a,|=|49 +yr+027" +... +0, fc +e] fog}? +.. § ({0o|+lou]+ Now, m=Joo|+0)|+. we have |a,|Smv” whenever p>1. Thus ais asymptotically dominated by ,”. Consequently, a is O(r”), Hence Proved. Ex.S, Every particle inside a nuclear reactor splits into two particles int each second. Suppose one particle is injected into the reactor every second beginning att = 0. How mat particles are there in the reactor at rth second? Sol. The number of particle at = a= The number of particle at = 1, a, =2.141=3 The number of particle at r= 2; The number of particle at ¢ = 3, By symmerty the number of particles at ¢ = r a, 2274, Ans Ex.6. showthat ¢, = ab, = 1°’? +0( Jr) sorwenne =a, =[r+0(!)] ¥e+o(})] = 4r0(4)+vro(t)+o(to(+) *+0(vF)eo(4)+9( 33} 1. Obtain the numeric function c made up of the letters (x,.7,04B, 7) with the first portion made of English letters and the second portion made up of Greet letters. 2 Leta bea numeric function given by 2 O0 Sol. The required generating function of the given numeric function is given by A(z)= de gos Levy) = dre Sarr ro As +627 Ex.S. Let a, 120. Find c=a*b. Ll =32 Sol. We have 4(z)= and B(z) i (1 Now CQ)= atdpte)s | oc o, =303Y ~ 202) = ye Ans. Ex6. Find the generating functions forthe infinite sequence 1.aa?,a?......, where a is posdcomstant. Sol. The generating function for the given sequence is A(z)=V 024022? +0823 + = A(z)-1=a2+0227 +0329 + A(z)-1 =l+azta7z? +037 ° az A(z)-1 Seale mm @) = AZ Hence the required generating function is Ans. Ex, 7, Find the generating function for the Fibonacci sequence {a} defined by 4, = 0,4 +d, 722 with ay =0, a =1. Sol. The generating function for the Fibonacci sequence {a,}, where 4, =4,4+4,-, 722 -) with a =0 and a =1 is given by A(z) = aq + 4,2+ 0927 +0523 +. ke a on) Multiplying both sides of (1) by 2” and summing from y= 2 to r= oo, we obtain Sa,2"= de 12+ Sage? r= r= > A(z)—ayz ag = 2[ (z)—ay ]+27A(2) [by] Since ay =0, a, =1, therefore A(z)-2=2A(z)+27A(z) > (1-2-2?) a(z)=2 = & z ence the required generating function is’ — >. ‘Ans. & Ex.8, Determine the discrete numeric function corresponding to each of the following ‘nerating functions : 4 @ A(z)= © A@)=F75 1-42? 2 2 Sola Us) we, 142? (1-22)(1F22) 1-22" 1s22 ‘Therefore, the required numeric function corresponding to A(z) is a, =2" +(-2)', r20 -| 0, ris odd 2, riseven . Ang (6) We have z4 (1-2 = 2,2 aah(l4224272 +...) 449542284. Therefore, the required numeric function is 0, Osrs4 Ola pes, : Ans . Find the generating functions of the following (0) 2-2,2,-2y en @) 1,0, 1,0, (2 0,1,-24,-8 . Find the generating function of cach of the following discrete numeric functions : (a) 0,1,-2,4,-8,.... (b) Ox1, 1x2, 2x3, 3x4..... 3. Find the generating function for 4, = 3, r20, |. Find the generating functions of the following numeric functions : rtd @ a, =2r+3, r=0,1,2,.. © «-( A } r=0,1,2, 1 po © * "tay" 1r=0, 1,24 Determine the generating function of the numeric function a such that Pe ris even -2", risodd it i ti ;. Determine the discrete numeric function corresponding to each of the following, generat functions : -—> © A@)= @ AG)" eat (-2) (© A(z)=(1+2)" +12)" » where is positive integer. 2r > 7. Show that the generating function for a, such that @- = (" } is (l-azy"? 8. Obtain the numeric function corresponding to the gencrating function i 9. Obtain the generating function of the numeric function a, =3"*?, r>0 §5.8. Recurrence Relation, Definition: For a numeric function (dp ,4,,......@y,-...) an equation which relates a, to one or more a; (i 2 Ex.3, Therelation a, =a,_) +a,-2, r22 Note that the Fibonacci sequence of numbers 11,23, 234, can be completely described by the above relation together with a =1 and a §5.9. Linear Recurrence Relations with Constant Coefficients. Definition : A recurrence relation of the form Cody + Chay + C20,-2 +n. = f(r) ol) where C;'s are constants, is called a linear recurrence relation with constant coefficients. \t Co and C;, both are non-zero, then the recurrence relation in (1) is known as k order recurrence relation. Ex, 1. A relation of the form 2a, + 5a, = 2" -Q) isa First order linear recurrence relation with constant coefficients. Ex, 2. Arelation of the form a, ~Ta,_2 =0 -B) 'sa Second order linear recurrence relation with constant coefficients, Ex. 3, Solve the following recurrence relation : 2a, — 5a, + 34,2 = 17 +5 with Boundary Conditions (BC) : a3 = 2 and ay =6 Sol. Let us compute as as ag = [5x6 +3x2-(5? +5)]=27 wecan then compute as as $x274+3x6-(62 +5)]=79 and so on. | We can also compute % =F laxo-sx2-(# +9)]-2 = 19 as ay =P [px2-sx!2G +3)|=28 fant 5x28 (ary 35 3 and so on. ‘Thus we conclude that the given equation with the values a5 =2 and ay =6, completely Specifies the discrete numeric function a = (49.0), 43,....,dp,..). § 5.10, Homogencous Solutions : Consider the difference equation Code + C1, + Czy g nnn #Cp Og = fC) afl) A homogeneous solution of a linear difference equation wi ‘ith constants coefficients is of the form Ao! where oy is called a characteristcroot andl isa constant determined by the BC Itisdenoted by a = (06,00... ,of,...) Now substituting 4q" for a, in the given difference equation (1) with the RES. of the equation set to 0, we get Coda" + Cac"! + Cpa"? +... C,da’# = 9 or A0§* (Coa + Gat" +. cao? tint GQ) =0 or Co + Qa!" 4. Cok? + Cy =0 ® which is called the characteristic equation of the difference equation (1). Therefore, if 0 i: one of the roots of the characteristic equation, Agy is a homogeneous solution of (1), Clearly, a characteristic equation of k" degree has k characteristic Toots. Now consider the various cases Case L. When the roots of the characteristic equation are all real and distinct, In this case it can easily be verified that is also a homogencous solution to (1), where t,t. Oy are the distinct characteristic rools I, are constants which are to be determined by the BC. and Ay pedir Case 11, When some of the roots of the characteristic equation are multiple real roots : Let 0 be @ roots of (2) of multiplicity m. We shall show that the corresponding romogenous solution is (4p Aye Ag ar Age + Ag JOE where the 4;'s are constants to be determined by the BC. Clearly, A,cef is a homogeneous solution of (1). Ay PO 48 also a homogeneous solution : Recall that cy not only is a root of the equation. Coa” + Cal! + Col? ++ Cae” but also is a root of the derived equation of (2); i.e. Coral + r= Dol? +. G(r Dal 4+ G(r ka = 0...) because 01, isa multiple root of (2). Multiplying (3) by 4,,_0: and replacing o: by « , weobtain 0 A CoA Ot + CA 1 (= Deaf! + Coda (= 20h? + + CA rr - kat-* =0 which clearly shows that 4,,_;rcrf_ is indeed a homogeneous solution. Since 04 also satisfies the second, third, ....., (mr ~ 1)th derived equation of (2), we can Ayr"lot are also homogeneous prove in a similar manner that 4,,_9r7af, Ay,3?°04 ... solutions of (1). ‘Case I, When the characteristic equation has non-repeated complex roots : Let &+/B be a complex root of (2), then by the theory of equation o—iB is also a root where of and B are real. So, in this case, A(o +iB)" + B(a—iB)* isasolution of(1), where A, and 4) are constants. Putting o + /B = p(cos® + isin8) and «iB = p(cos@—isin6), We obtain p" (4, cos/@ + A, sinr®) Where p= fq? 4p? and oxtanri(2), Case IV, When the characteristic equation has repeated complex roots: Let 0. +78 be the repeated (twice) root of the characteristic equation, then the solution will te: 9” [(A + Apr)cosr8 + (4s + Ayr)sinr® ], Where p=Vo2 +p? and onten(BY The method will be clear by the following illustrations. Ex.1. The recurrence relation for the Fibonacci sequence of numbers isin the form v | difference equation teat tp with BC: ag =0 and a, =1. Sol. The corresponding characteristic equation of the given difference equation is a -a-1=0 1-5 2 whose roots will be = and oy which are real ard distinct. Therefore the required solution which is called Fibonacci numbers given by where 4, and Ap are constants. Using BC, we have 0=4 +4, ese af) Solving these equations, we get a 1 A An and ame. Hence the Fibonacci numbers are given by oral) als) Ex. 2, Solve the difference equation : 4, = 6ay_y +124,» +8a,_3 =0 Sol. The characteristic equation of the given difference equation is oF +607 +120+8=0 (042) =0 a =-2,-2,-2 (i.e. Multiple roots) Here 0. = 2 isa triple characteristic root. Therefore the homogeneous solution is al! = (Ayr + Ay + Ayr? )(2Y Ex.3, Solve the difference equation : 4a, ~20a,_y +174, ~4a,_3 = 0 Sol. The characteristic root of the given difference equation is, 40° - 200? +174-4=0 > (a -4)(20-17 = Ans. | =4,,.,1 = a=4it. Thus, the characteristic roots are 4,1, Therefore, the homogeneous solution of the given difference equation is af) = A CAY + (4g + Agr)(4) Ex. 4. Solve the difference equation : a, ~Aa,_y + 13a,_) =0 Sol. The characteristic equation is a? ~4a+13=0 42 Vi6-3? | 2 which are non repeated conjugate complex roots. Hence, the Homogeneous solution of the given difference equation is 243 a, = (13)? (A, cosr 0+ 4g sinr 6) where 0 = tan"!(3) §5.11. Particular Solutions : There is no general procedure for determining the paricular solution of a difference equation. However, in simple cases, the solution can be obtained by the method of inspection. Forthis we first set up the general form of the particular solution according to the form of f(r) and then determine the exact solution according to the given difference equation, Pan) The method will be clear by the following illustrations, This is denoted as al) = (a(?), af?), Ex.1, Solve the difference equation a, + Sa,_4 + 6d,_2 = 3r? ol) Sol. Let us assume the general form of PS of (1) be Rr + PrP .Q where RP, and Py are constants to be determined. Substituting (2) into the LHS of (1), we obtain Br? + Pyrt Py SR(r-1P +5P,(r-1) +57, +6K (r= 1) +6P,(r-1)+6R Which simplifies to 12K)? ~ (34% -12P) )r + (29R -17P, +12P,) Comparing (3) with the R.H.S. of (1), we obtain the equations 12R =3; 342-127, =0 and 29R -17P, +127, =0 --G) which yield Therefore, the PS of (1) is 1a 17 us Pore 4 "24°" 288 In general, when f (ris of the form of a polynomial of degree in r Rr! + Fy hy the corresponding PS will be of the form + Fir + Fis Prk + Py" ot Birt Pay Ex,2. Solve the difference equation : a, +Sa,_4 + 6a,_y = 39? —2r +1 ay Sol. The PS of (1) is of the form al?) = By? + yrs Py @ Substituting (2) into (1), we obtain ab?) + sal?) + Gal?) = 3)? — 241 hey Ry? + Par + Py + SA (r+ 5, (r= 104 52, +67, (r- 2) +67, (r= 2)46R, = 3? — 2041 which simplifies to 12Rr? = (34% -12P,)r + (299 —17P, +12P,)= 37? - 2 +1 3) Comparing the two sides of (3), we obtain the equations 12R =3; 349 -12P, =2 and 29K -17P, +12P, =1 which yields ‘Therefore, the PS is Ex.3. Solvethe difference equation 4, +5d,_1+6q,, = 42.4" a) Sol. Let us assume the general form of PS be @ py @ ‘Substituting the expression in (2) into the L.H.S. of (1). we obtain Pa" + 5Pa"~! + 6par-2 par 5 which simplifies to 2py ‘ ‘Comparing (3) with the RHS of (1), we obtain P= 16. ‘Therefore, the PS is al?) = 16.47 —_ (0) <6. ns Ex4, Solve the difference equation : a, + a,_y = 3r @ Sol. Clearly, 2 is nota characteristic root of (1) So let us assume the general form of PS be (Art P,)2" --Q) Substituting (2) into (1), we obtain (Rr+)2" +[Ar-1)4+ B27 =3r2" which simplifies to 3 1 prez o(3A stay =a % Comparing the two sides of (3), we obtain the equations 3 1,3 2y=3 —n+28 = ZA=3 and -7A+5%=0 A=2, A=2 which yield 2)\or ‘Therefore, the Sis @{?) = (= +5 } For the case that B isa characteristic root of multiplicity m = =1, when f (7) is of the form (yl + yell rt Fe) BO and B isa characteristic root of multiplicity (m—1), the corresponding PS is of the form (Rpt + By et Rr+P1)B" Ex, 5, Solve the difference equation a, — Ad, + 44,2 =(r+ DY (a) particular solution is Sol. Since 2 is a double characteristic root, the general form of the --Q) (Ar + Py)?" Substituting (2) into (1), we obtain, after simplification : 6R rd =r! (6R +2P))2" = 2" Pel which yield 4 Thus, the PS is Ex. 6, Solvethe difference equation a, 4,4 +7 (I) Sol. Since 1 isa characteristic root of (1) and 7 can be written as 7.1” . the general form of PSis Pr. Substituting q(?) = py into(1), we obtain Pr=P(r-1)+7 that is, P=7 Ex. 7. Solve the difference equation : a, —Sa,_4 +6a,_, =2" +r Al) Sol. Since 2 isa characteristic root of (1) and f(r) is of the form f(r)-+ fy (r) where Si(r)=2! and fy (r)= r isa polynomial in of degree 1, it follows that the PS corresponding to f(r) must be of the form + Al 2* and corresponding to f(r) must be of the form Py + P) respectively, So, let us assume that the general form of the PS corresponding to f(r) = 2" +r is Ard +Pyr+Py +2) where A, P;, P3 are constants to be determined. Substituting (2) into (1), we obtain Prd! + Par + Py - SR (r-1)2" - 5, (-1)- 5, +67 (r —2)2!~? + 6P, (+ -2) 4+ 6P = 2! +r {r-$e-v+ 30-22 + Py{r-Sr=1)+6(r—2)} +20, = 2" +r ie, HZRQ + (2r 70,42 = 4r ie, -tR +2Ppr+(-7P,+2R)=2" +r, -Q) ‘Comparing both sides of (3), we obtain the equations —4q2"=2"; 2Rr=r and -7Py +2P, =0 1 which yield R=, mas r 1 7 Thus,the PSis a?) =r 2"! ttred §5.12. Total Solutions : The total solution of a given Ath order difference equation is the sunt of homogeneous solution and the particular solution and determine the undertermined coefficient jn the homogeneous solution. The k undetermined coefficients 4). 4, in the homogeneous solution can be determined by the BC Ay +A 41500-68441» for any’ rp Let the A* order difference equation be Coa, + C yap + Cp g Ho Chap = SN) ol) Suppose the characteristic roots 04, a. 1. of the difference equation are all distinct. Then the total solution of (1) is of the form 4, = Ah + 05 +... + Agar + pr) where p(r) is the PS, Thus, for r=1,7 +1, equations : sufy +k —1, we have the system of linear On? + Agr +... + Ager? + p(y) Ayo?! + A024 4 + Aoi" + p(y +1) =) tk rytk-l My ek—1 = Aya? : wt Ago + p(y +k -1) These k linear equations can be solved for 4.13. Ex, 1. Solve the equation a, + Sd,_y + 64,_9.= 42.4" v1) with BC a, = 278 and a3 =962 Sol. The total solution of (1) is a, = Ay (-2)" + Ap (-3)" 416.4" Now we are given the BC a) = 278 and a; = 962 Therefore (2) give the following equations : 278 = A (-2)? + Ay (-3) 416.4? ie, 278 = 44, +94y +256 ..Q) and 962 = A, (-2)° + 43 (-3) 416.4 ie, 962= = 27d, +1.024 a) Solving (3) and (4), we obtain 4) = 1, «ly =2 Thus, the total solution of the difference equation (1) is a, =(-2Y +2(-3) +164" Now there arises a natural question how we can be sure that solution of the & equations in ) are always unique. It can be shown mathematically that this is indeed the case. Ex. 2, Given that ay =1, a, = ~2 and a3 =1 satisfy the following recurrence relation a, + 3a, +3a,_y + 4,3 =0, forr>3. Determine a,. Sol. The characteristic equation of the given recurrence relation is o? +307 +30+1=0 = (a+ =0 3 a= ol Since the characteristic root —1 is of multiplicity 3, therefore, the general solution is a, =(Ayr? + gr + ay (=D Using the given BC ap = 1,” a =-2 and ay =1, we have l=ay=4; 3 4y=1 —2= a =(A tay +A > tty +g =2 1s ay = (44) +24y Ag )I? 9 44, + 24g +4 =1 Solving these equation, we obtain 4 =1, 4p =2, 4; =1 =(? 427 +10" ‘Ans Ex, 3, Solvethe recurrence relation Hence, the required solution is a, 4, — 24,4 + 34,7 — 4a,_3 +2a,_4 =0 Sol. The characteristic equation of the given recurrence relation is at - 203 +30? -da+2=0 > (a-1?(a2 +2)=0 9 = G=1LtiV2. ‘Thus, the homogencous solution is a, =(A + Agr) +p" (4; cosr0+ Aysinr@) where p= Jo? +B? = Vo? +2 = V2 and o=tan"(B )=tant(2)= tan Hence the required GS is & 2 a, =(4 +4yr)+2"?( tycos% +Ay sn) § 5.13. Solution by the method of Generating Functions : . ‘We can determine the generating function of the numeric function from the diflere™ equation. In many cases, once the generating function is determined an expression for thera of the numeric function can casily be obtained. This will be clear by the following illustrations () Ex.1. Solve the recurrence relation a, =3a,4 +2, r21 with BC ag =1- Sol. The given recurrence relation (1) is valid only for + >1. Note that for y = 0, the recurrence relation becomes ay = 3a_, +2 Since a_, is not defined, we cannot assume that the recurence relation is valid for r = 0. _ngeneral, fora given kth order difference equation that specifies a numeric function, we should “gaow for what values of r the equation is valid, First, we note that the equation is valid only if zk because, forr 1,weobtain san! +252 .G) A(z) = ay Note that Saye” = 230,42"! =2Ale) AA rl ie rl Thus, from (3) we obtain dz A) ~ ty =32A(2) + i (1-32)A(2)= 22 +1 [a9 =1] ie, 32, 2, Se 0 = 1 which simplifies to (1-3z)A(2)= is 221-32) !-(-2)" a 2(14 3243727 +0492" +.) te et ti) Ts, Bage’ = 3 (2.3" 12" r=0 r=0 Consequently, we have a, =2,3"-1, r20 Ans, Ex.2. Use generating functions to solve the recurrence relation in = yy +11 With BC ay =1. Sol. Multiply both sides of the given recurrence relation by 2” and summing over n oo, We gel = Lo X a2" n=l ¥ a, y2” +E ne” =I ft = AG) gaat) F Where A(z) = ay + az tag2? +... az" + = (=2)AG)=14 = AG)=—1 z (+9 =1 ° (=z) Un Gee vat) = A(z)=(1=2)' 420-2)? > a, =1+"*I¢, nl because coefficient of 2” in (y_ zy is andin 2(1~ 2)? is "*1C,_, But "*"c,_, ="*Ic, therefore, we can write @,=1+""C,, Ans, Ex.3. Using generating functions, solve the recurrence relation 1+, with a =2 and a, =3. Sol. Observe that ap is not given. Therefore, the recurrence relation is not valid for r= 2. and is valid only for + >3 From the given relation, wehave for r=2, a) =a, +a If we choose ap =1 then the given recurrence relation is valid for p > 2. In this case, multiply both sides of the given relation by 2° and summing fromr=2 to r= , we obtain Saye = Fa, y2"+ Fa,92" r=2 r=2 > [AG)~ ay ~ 2] = z[ A(z) = ag] + 27A(2) l+z = A= a =1, a =2) = cee) (where a= 3(1+ V5) and B= 4(1 -¥5)) = volglca}(tles) waa s+3y5 ay! ies 2 ao-(43 Ju-oer!-(=$405 opp! (34) -(4)r 70 10 a madicveerd edie Ex.d. A coin is tossed r times, Find out the number of sequences of outcomes in which ‘head never appear on successive tosses, Sol. Since in each tossing of a coin there are 2 possibilities : ‘We shall get either ‘Head’ or ‘Tail’, ‘Therefore, when we toss a coin r times there are 2” possible sequences of outcomes. Let a, denote the number of such sequences. To each sequence of »—1 heads and tails inwhich there are no consecutive heads, we can append a tail to obtaina sequence of r heads and tailsin which there are no consecutive heads. To each. sequence of » — 2 heads and tail in which there are no consecutive heads, we can append a tail and then a head to obtain a sequence of r heads and tails in which there are no consecutive heads, Obviosuly, these two types of sequences exhaust all sequences of r heads and tails in which there are no consecutive heads. So, wehave the recurrence relation a, =a, +4,_7 -) with BC: a =2, a =3. Note that the value of a has no physical significance and we may choose ag = 0 .1In this case, the difference equation (1) is not valid for p = and is only valid for » > 3 Multiplying both sides of (1) by 2" and summing from + = 3 to 2 =o, we obtain Dayz" = Ya y2" + Sage” 3 3 r 1, A(2)~ay2? ~ az ~ ag = 2[ A(z) - az — ay ]+2?[A(z)— ag] Which on simplification gives 2 Alsj= 2h 2e I. l+z ' (543¥5)/10 (-5+3V5)/10 =-l+ ( =-l+ 1 5)2)2 [0-822 ol ESOT Bel (sey 2-14 StS (14 V5 $3V5 # (1- V5 m5 i 2 } 10 3 (54J Thus Zen = 208 § (eB) y 238 § 10 2 eter both sides, we obtain Ss 7 A) 28-8). Since the value of ay has no physical significance, we can choose to set a= I (insted ot 0), so that (1) is valid for y > 2. In that case, we can multiply both sides of (1) by -7 and suming from y =2 to r= oo, weoblain ie, or which yields Ex.5. Solve by the method of generating functions the recurrence relation a, ~Sa,_,+6a,_2=2" +r, 722 with BC: dg =1 and ay =1. Sol. The given recurrence relation is a, — 50,4 +60, =I +r, 722 BC: ay =1, y= Let the generating function of the given sequence be Gl2)= $a,2" om) r=0 Multiplying both sides of (1) by 2” and summing from = 2 to r= 2» , weobiain Faz’ -5E 0,47 ” £65 apg = EU + Fre" r=2 rad rad r=? r=2 : oy 4,2! 53 a, yz") + 62" Ya, -92"~ = (22 +2 § re" r=? r=2 r=2 je, Glz)~ az - a9 ~ S2[Gx)- a9} + 62°G(2) I 5. Alege Fer ox i}+ (at i (1-524 62?)G(2)-1+ 42 = which simplifies to G(z)= (1-2) (227 (1-32) a4 W273 2 17/4 ee Z (l-z)) 1-22 (j-22" W327 fon resolving into partial fractions} = S27" 4 Lda? 301-227" 201-227? +a-xy! 252 +p bere 357 7 2Sorvre +E yy 4,50 0 oe eleen-sa 202 Lr] a r=0! Comparing (2) and (3), we obtain ‘ My. a, 5 lee -3.2" - 2042" + 42 Ex.6, Solve the recurrence relation a? ~2a7_,=1 withBC ag =2. Sol. Let 5” = a2,,, then the given relation becomes b, - 2b, =1 with by =4 Now multiplying both sides by 7" and summing from y =| 10 2, we obtain ze Foe" 25 42 rl rel = [B(z)- by ]- 228) > (1-22)B(z)= 4-32 “ BO) =a = beso | ke a, 35.2" -1 Ans, Ex. 7. [ The Tower of Hanoi problem ] : 1 circular rings of tapering sizes are slipped onto a peg I with the largest ring at, bottom, as shown in the following fig. These rings are to be transferred one at a time on, another peg II, and there is a IM peg available on which rings can be left temporarily, during the course of transferring the rings, no ring may ever be placed on the top of asmali, one, in how many moves can these rings be transferred with their relative position unchangeg, I 0 \—__ | S Sol. Let there be r disks initially on peg I. We can transfer the top ( » ~ 1) disks following the rules of puzzle to peg III using /,_, moves for. We keep the largest disk fixed during thes: moves. Then we use one move to transfer the largest disk to II peg. We can transfer the » — disks on peg III to peg II using H,_; additional moves placing them on top of the largest dist which always stays fixed on bottom of peg Il. The puzzle can not be solved using fever steps ‘Thus we have Hy =2H,4 +1. ‘The initial condition is #7, = 1 as one disk can be transferred from peg I to peg Il according to the nules of the puzzle, in one move. Now H, = 2H, +1 Hy =2H, +1 =2.1+1 Hy =2Hy +1 =2[24+1) =27 42 3 492 Hg =2Hy+1 =2[22+2+41] = +2°4+2 Hy aU eee Qel 22h ay Ex. 9, Find a recurrence relation and give initial conditions for the number of bit stti"8 of length r that do not have two consecutive O's. How many such bit strings are there of length 4? Sol. Let a, denote the number of bit strings of length r that do not have two consecutiv’ O's. The number of bit strings of length r that do not have two consecutive O & equals the nut of such bit strings ending with a 0 plus the number of such bit strings ending with a. We ™!! assume that r 23 sc that the bit string has at Icast 3 bits. The bit string of length r ending with 1 that do not have two consecutive O are the bit string of length r— 1 with no two consecutiN® Oswith a, added at the end. ‘Therefore there are a, —1 such bit strings. ‘The bit strings of length r ending with ay that do not have two consecutive O's must have 1 astheir (72 — 1) 4h bit otherwise they will end witha pair of O &. Therefore the bit strings of length ending with a O having no two consecutive 0 § are the bit strings of length ( — 2) with no two consecutive Os with 10 added at the end. So there are a,_2 such bit strings. Hence we have 4, =) +4,-2 for r23 The initial conditions are a; = 2. since both bit strings of length one 0 and 1 do not have consecutive Os and ay =3 since the valid bit string of length two are 01, 10 and 11. Now ay =a, +a =3+2 =5 and 44 = 4340, =54+3 =8, 1. Solvethe difference equation a, 7-1 + 64,2 [Raj. BE II Sem., 12] 2. Solve the difference equation a, - 6a,_, + 9a, =(r+1)3". 3. Solve the recurrence relation a, ~ 4a, +4a,_7 =0 given that ay =1 and a, =3 4, Solvethe recurrence relation a, =a,_, +2a,_» with ay =2 and a =10. 5. Solvethe difference equation a, =a,_; +6a,_ with a =3, a =6. {[Raj. BE, 14] 6 Solve by the method of generating functions the recurrence relation @, =34,), 721 withBC: ay =2 7. Solvethe recurrence relation a, = 2a, +3, 21 with IC: a =1. 8. Solve the difference equation a, = 8a, 1-1 +10" with IC : ag Exercise V (a) L a= Sars! i= 0, Osrsi 2@ sta=10, 2srss pari ae, r>6 g-2q 20 Osrsi arrays: r22 0, Osrs2 ) 6 =l17/16 r=3 —, bbeing thenumeric function of Aw -x+l), oo 3 @ ba, =3r% 42042 Wi) Ba, =6 C= ps & VG aor, ae 1+2" L @ fz] <1 2@ Zz 1+2z &@ if (0, ec a= 2". (0, a= 3-5, 9° 1-32 - 1, PS: alPat (+2274 On r is even Osrs4 res Exercise V(c) 2. Psid (Ei) 4 a =P 2s a, =2.3", r20 6. & [s" +10")

You might also like