 in today's lecture we will be studying recurrence relations our starting point is discrete numeric functions which we have discussed in last two lectures suppose a is a discrete numeric function which is written as a equal to a sequence of real numbers which we denote in general by a 0 a 1 a 2 and so on then a n minus 1 a n and onward now sometimes what happens is that the entry a n of the discrete numeric function can be related in certain ways to the previous entries for example let us look at this relation a n equal to a n minus 1 plus a n minus 2 for n greater than or equal to 2 and a 0 equal to 0 and a 1 equal to 1 now we start from a 0 and of course it is given that a 0 is 0 then we come to the next entry that is a 1 which is also given as a 1 is 1 and then a 2 according to my rule over here is a 1 plus a 0 which is equal to 1 again after that a 3 which is equal to a 2 plus a 1 which is 1 plus 1 equal to 2 then we have a 4 which is equal to a 3 plus a 2 which is 2 plus 1 that is 3 then a 5 equal to a 4 plus a 3 this is 3 plus 2 equal to 5 and we have to proceed in this way thus we have a sequence whose first few terms are 0 1 1 then 2 then 3 then 5 and then of course 8 and so on now this is an example how a discrete numeric function can be generated recursively and we get very interesting sequence sequences for instance the sequence that we have just seen is the famous Fibonacci sequence the relationship that we get here is called a recurrence relation and the conditions that we write down as a 0 equal to 0 and a 1 equal to 1 are called initial conditions now we can have many more examples of recurrence relations for example we could have written a n equal to 3 a n minus 1 minus 2 times a n minus 2 so I write a n equal to 3 times a n minus 1 minus 2 times a n minus 2 and I start from n greater than or equal to 2 and for a 0 and a 1 I have to choose some initial conditions like this we can have recurrence relations like a n equal to n minus 1 a n minus 1 plus n minus 1 into a n minus 2 or we could have had a n equal to a 0 a n minus 1 plus a 1 a n minus 2 plus and so on up to some a n minus 1 into a 0 where the corresponding discrete numeric function is a 0 a 1 and all that so we see that at each term over here we have a product of two entries of the discrete numeric function then we could have had a n square equal to a n minus 1 square minus 1 so we see that there are many many different discrete numeric functions but the essence of sorry there are many many different recurrence relations but the essence is that given a discrete numeric function a 0 a 1 a n minus 1 a n I try to build up a relationship involving a n equal to the previous terms some f of a 0 up to a n minus 1 our goal in this topic is to find out expressions of a n purely in terms of n so we would like to find out a function of n explicitly written in terms of n which gives me the values of a n for n let us say greater than or equal to some number n 0 now in general this is a difficult problem and there is no general technique of handling this problem if somebody gives us a general recurrence relation but we can restrict the class of recurrence relations that we consider and build up some strategies or some general techniques of solving those recurrence relations so now our job is to find out a special class of recurrence relations and these will be called linear recurrence relations so I go to the next page linear recurrence relation alright so in case of a linear recurrence relation we will write a n in terms of some coefficients and the previous values of the discrete numeric function so I have c 1 a n minus 1 plus c 2 a n minus 2 and so on up to ck a n minus k plus fn here in general the coefficients ci's can be functions of n but we further reduce this class to a more restricted one called linear recurrence relations with constant coefficients linear recurrence relations with constant coefficients are those linear recurrence relations for which the ci's are constants so in this case ci's are constant for all i equal to 1 2 and so on up to k and now one would like to ask that what is this k is of course something less than n and it k signifies the situation that we look back up to some steps but we stop at after after a while so k is called the order of the recurrence relation k is called the order of the recurrence relation for example if k is 1 the recurrence relation will be a 1 a n equal to c 1 a n minus 1 if k is equal to 2 then the recurrence relation will be a n equal to c a c 1 a n minus 1 plus c 2 a n minus 2 if k is equal to 3 then the recurrence relation will be a n equal to c 1 a n minus 1 plus c 2 a n minus 2 plus c 3 a n minus 3 so the first one will be called first order recurrence relation first order the second one is second order the third one is third order and so on so we see that when we are looking at the first order linear recurrence relation then we are just looking one step back and a n is some constant times the previous entry to a n when I am looking at the second order recurrence relation linear recurrence relation let us say with constant coefficients then a n is nothing but a constant multiplied to a n minus 1 plus another constant multiplied to a n minus 2 and similarly for the third or the fourth and so on then we question what about this fn this fn can be identically 0 that means it is possible that fn is 0 for all n now if fn is 0 for all n then we get a n equal to c 1 a n minus 1 up to c k a n minus k this recurrence relation is said to be a linear recurrence relation which is homogeneous or homogeneous linear recurrence relation now it can be with or without constant coefficients if fn is not 0 then we have a non homogeneous linear recurrence relation so we have a classification of recurrence relations so we started with general recurrence relations which can be absolutely anything but we restricted ourselves to linear recurrence relations and a sub class of linear recurrence relations called linear recurrence relations with constant coefficients and within recurrence relations there are two different classes linear recurrence relations get split up into non homogeneous linear recurrence relations and homogeneous linear recurrence relations now what we are going to do is to further restrict ourselves so we will restrict ourselves to k equal to 2 so the class that we are going to consider now is linear recurrence relations with constant coefficients having order 2 first we will check order 2 and in the process we will automatically understand what to do with order 1 now if we have this then the recurrence relation will be of the type a n equal to c 1 n minus 1 plus c 2 a n minus 2 plus fn now I further restrict I make fn equal to 0 so I take the homogeneous case which gives me a n equal to c 1 a n minus 1 plus c 2 a n minus 2 my m is to find a way to write a n purely as a function of n equal to some g n and let us see how to do that so we have a recurrence relation of this type where c 1 and c 2 are constants and a is are values from some discrete numeric function we have to find that function what we do is that we take a so-called trial solution we say that let a n is equal to some capital A times r to the power n I do not know r but I know that a is a constant and r is also some values that we would like to find out we place this in the equation above to get a r to the power n and we transpose the elements of the right hand side to left hand side so I get c 1 a r to the power n minus 1 plus c 2 a r to the power n minus 2 equal to 0 and from this we get r to the power n minus c 1 r to the power n minus 1 plus c 2 r to the power n minus 2 the whole thing inside a parenthesis and into a equal to 0 it is very reasonable to assume that a not equal to 0 because is the constant a is equal to 0 then we have nothing to do we have the solution a n equal to 0 and of course that is a solution but we can do very little with that that solution so we write the equation as there is a mistake here it will be minus instead of plus so I replace by minus here and this is also minus so now I have minus and here also this is minus so minus c 2 r n minus 2 this is equal to 0 now again we can do something that is we can take the common factor r to the power n minus 2 out from this expression so I have r to the power n minus 2 equal to r square minus c 1 r minus c 2 equal to 0 now again it is very reasonable to assume that r is not equal to 0 because if r is equal to 0 again we have the 0 solution which is of course a solution in this case but it is it is useless so we have r square minus c 1 r minus c 2 equal to 0 we see that proceeding as above we have arrived at a degree 2 polynomial equation and we know how to solve that so we can write the solution as r equal to 1 by 2 into c 1 plus or minus root over c 1 square plus 4 c 2 at this point we have the well-known theory of solving quadratic polynomial equations in one variables and we know that r has 3 choices r can have two different values for which this quadratic equation is satisfied or we can get a single value that is c 1 by 2 which satisfies this quadratic equation or this expression inside the square root can be a negative one and therefore r may admit only two complex roots complex that is the equation will be admitting only two complex solutions in this lecture we will restrict ourselves to the case where one two distinct real values of r are available to only one real value of r is available which is the repeated root the repeated root of the equation or one can say the polynomial r square minus r 1 c 1 r minus c 2 repeated root so there are two cases that we will be studying in this lecture now the first case is where I have got two different solutions I call them r 1 and r 2 so I know that r 1 square minus c 1 r 1 minus c 2 is equal to 0 I also know that r 2 square minus c 1 r 2 plus minus c 2 equal to 0 so what I see is that I if I go back to the if I let us say if I build two different solutions one as r equal to some capital A times r 1 n and r equal to some let us write a 1 and let us write a 2 r 2 n then I can replace each of them in the recurrence relation which is given by a 1 minus c 1 a n minus 1 minus c 2 a n minus 2 if I replace just I should write this as a n as we have taken as a solution it is not r but this is a n so this is a n and this is also a n what I want to say is that the a n has two possibilities so then if I put a n as the first possibility of a n in the recurrence relation I will see that a 1 r 1 raise to the power n minus c 1 a 1 r 1 raise to the power n minus 1 minus c 2 a 1 r 1 raise to the power n minus 2 which is equal to a 1 r 1 raise to the power n minus 2 r 1 square minus c 1 r 1 minus c 2 and this is of course equal to 0 so this of course satisfies the recurrence relation given by this and similarly the other solution also satisfies the recurrence relation but what is interesting is that if we add these two solutions and get something like this a 1 r 1 raise to the power n plus a 2 r 2 raise to the power n let us call this a n now if I replace this in my in the left hand side of the recurrence relation which is essentially this then I get a 1 r 1 raise to the power n plus a 2 r 2 raise to the power n minus c 1 times a 1 r 1 raise to the power n minus 1 plus a 2 r 2 raise to the power n minus 1 minus c 2 a 1 r 1 raise to the power n minus 2 plus a 2 r 2 raise to the power n minus 2 and rearranging the terms I will get the terms that we have already got that is a 1 r 1 raise to the power n minus n minus c 1 a 1 r 1 raise to the power n minus 1 minus c 2 a 1 r 1 raise to the power n minus 2 plus a 2 r 2 raise to the power n minus c 1 a 2 r 2 raise to the power n minus 1 minus c 2 a 2 r 2 raise to the power n minus 2 now this is of course 0 first first term is 0 we have already seen over here second term is also 0 that we can check because after all this is a solution so 0 plus 0 is equal to 0 thus we see that we can construct essentially an infinite number of solution by taking linear combinations of r1 raise to the power n and r2 raise to the power n I am essentially free to take any constant values for a1 and a2 thus we have obtained several solutions of the linear recurrence relation we started with but what is most surprising is that advanced theory of recurrence relations tells us that for the reconciliation under consideration these are essentially all the solutions of that one therefore the job that remains for us is to put the initial conditions and obtain the values of the constants which will give us the particular recurrence relations that we are looking at we will check the first recurrence relation that we built up which is corresponding to Fibonacci sequence the refer recurrence relation is an minus an minus 1 minus an minus 2 equal to 0 for all n greater than or equal to 2 along with the initial condition a0 equal to 0 and a1 equal to 1 now let us take the trial solution as a n equal to a constant times r to the power n and if I put this expression in the right hand left hand side I will get a r to the power n minus a r to the power n minus 1 minus a r to the power n minus 2 equal to 0 and then if I take the common factors of all the terms then I get a into r to the power n minus 2 multiplied by r square minus r minus 1 equal to 0 and we know that this means that I have to solve the quadratic equation given by r square minus r minus 1 equal to 0 and we can of course do that by writing the general form and which is r equal to 1 half of 1 plus or minus 1 plus 4 which is equal to 1 plus or minus root 5 by 2 therefore the general equation for the general solution of this recurrence elation is of the form an equal to some constant a1 times 1 plus root 5 divided by 2 raise to the power n plus a2 1 minus root 5 divided by 2 raise to the power n this is for n greater than or equal to 2 and for a 0 I know it is 0 and for a1 it is 1 now what I do here is that I try to fit the expression that I have got over here from n equal to 0 onward so I force a 0 equal to 0 and force the this expression in the right hand side to get a1 plus a2 and then 1 equal to a1 times 1 plus root 5 by 2 plus a2 times 1 minus root 5 by 2 that is all and so I have generated two equations suppose I am able to solve them and get the values of a1 a2 then I can plug in the values of a1 a2 in this equation to get a solution for the Fibonacci sequence reconciliation so what I do here is that from 1 we have a2 equal to minus of a1 substituting into we have a1 equal to 1 plus root 5 divided by 2 minus 1 minus root 5 divided by 2 which should be which should be equal to 1 and this is same as a1 times 2 dividing 2 root 5 equal to 1 2 gets cancelled so I have a1 equal to 1 by root 5 and a2 equal to minus 1 by root 5 therefore we have arrived at the solution of the recurrence relation that we are considering here we will say a n equal to 1 by root 5 into 1 plus root 5 by 2 raise to the power n minus 1 by root 5 1 minus root 5 by 2 raise to the power n for all n greater than or equal to 0 thus in today's lecture we have introduced the idea of recurrence relation then we have introduced linear recurrence relations and restricted though that to the class of constant coefficients we have introduced the classification homogeneous and non homogeneous recurrence relations linear recurrence relations and lastly we have considered a homogeneous linear recurrence relation with constant coefficients which corresponds to Fibonacci sequence and completely solved that relation this is all for today's lecture thank you