 In today's lecture we will learn how to solve 2nd order linear homogeneous recurrence relations with constant coefficients. Now as we have seen before that a 2nd order linear homogeneous recurrence relation with constant coefficients will have the form a n plus c 1 a n minus 1 plus c 2 a n minus 2 equated to 0 where c 1 and c 2 are fixed real numbers. Let us name this equation as 1 now the solution technique consists of starting with a trial solution of the form a constant C times r raise to the power n and substituting this in 1 we get the constant times r raise to the power n plus c 1 into the constant times r raise to the power n minus 1 plus c 2 the constant times r raise to the power n minus 2 which is equal to 0 and in the first step we note that a reasonable assumption is C not equal to 0. So assume that C not equal to 0 to obtain r raise to the power n plus c 1 times r raise to the power n minus 1 plus c 2 times r raise to the power n minus 2 equal to 0 and we name this equation to we can further simplify this again with the assumption that r is not equal to 0 to get this r raise to the power n minus 2 equal to r square plus c 1 r plus c 2 into 1 equal to 0 assuming r not equal to 0 we have r square plus c 1 r plus c 2 equal to 0 let us call this equation number 3 the equation 3 is called the characteristic equation of the recurrence relation 1 usually when we are solving the recurrence relations of this type we can directly write the characteristic equation and proceed ahead but in this lecture each time we will start with the trial solution obtain the characteristic equation and then solve the characteristic equation to obtain the solutions of the recurrence relation this way over and over again we will get the practice of solving recurrence relations from the basic definitions now the first observation that we have over here is that the recurrence relation has been transformed to a to an algebraic equation thus in a way the solution of 1 is transformed to the problem of solving 3 which is an algebraic equation and for which we have established methods of solution now we start with an example as before we consider a n equal to cr to the power n and substituting in let us call this 4 we have cr to the power n minus 7 cr to the power n minus 1 plus 12 cr to the power n minus 2 equal to 0 that is r to the power n minus 7 r to the power n minus 1 plus 12 r to the power n minus 2 equal to 0 call it 5 that is r square minus 7 r plus 12 equal to 0 call it 6 and of course here we are assuming that r is not equal to 0 so our problem at hand is to solve the algebraic equation r square minus 7 r plus 12 equal to 0 r square minus 7 r plus 12 equal to 0 we factorize the left hand side first we can write r square minus 3 r minus 4 r plus 12 equal to 0 that is r minus 3 minus 4 r minus 3 equal to 0 that is r minus 3 into r minus 4 equal to 0 therefore the solution is r equal to 3 or r equal to 4 now when we get two distinct real solutions of the characteristic equation of a recurrence relation then we write the general solution in the form general solution of 4 is of the form an equal to some constant k1 times 3 to the power n plus another constant k2 times 4 to the power n now there is a theory dealing with linear recurrence relations which tells us that if we get the roots of the characteristic equation and if the roots are distinct then the general solution that is the general form of any solution will be of the form a constant times nth power of one root plus another constant times nth power of the other root we cannot go into details of the theory right now but we can accept that for the time being in order to solve the recurrence relation our for a particular case we have to do something more very often a recurrence relation comes with the so-called initial conditions in this case let us assume that we have an initial condition a0 equal to 2 and a1 equal to 5 that is somebody tells me that we have a discrete numeric function given by an where n varies from 0 to infinity and an minus 7 an minus 1 plus 12 an minus 2 equal to 0 for all n greater than or equal to 2 which is the problem that we are solving right now the initial conditions a0 equal to 2 and a1 equal to 5 has to be given along with the recurrence relation if we want a particular solution now we take the general solution of the recurrence relation under consideration and then put the value n equal to 0 for n equal to 0 we have a0 which is equal to 2 equal to k1 plus k2 therefore we know that k2 is equal to 2 minus k1 for n equal to 1 we have a1 which is equal to 5 equal to 3 times k1 plus 4 times k2 we can always put the value of k2 in terms of k1 obtain 3k1 plus 2 minus k1 which is equal to 3k1 plus 8 minus 4k1 which is equal to minus k1 plus 8 well this is essentially k1 equal to 8 minus 5 which means 3 therefore we have obtained the value of k1 which is equal to 3 and k2 equal to 2 minus k1 and this gives me minus 1 thus the solution of the recurrence relation is an equal to 3 times 3 to the power n minus 4 to the power n therefore it is 3 to the power n plus 1 minus 4 to the power n next we question that what happens in case we do not get two distinct real roots now let us look at a at a recurrence relation of the form an minus 2 times an minus 1 plus 2 times an minus 2 equal to 0 this is example now again we take an equal to c times r to the power n to obtain the characteristic equation first we get this one c r to the power n minus 2 times c r to the power n minus 1 plus 2 times c r to the power n minus 2 equated to 0 so we get c times r to the power n minus 2 equal to r square minus 2 times r plus 2 equal to 0 which leads us to the characteristic equation r square minus twice r plus 2 equal to 0 now we solve it so this means that r equal to 2 plus or minus 4 minus 8 divided by 2 which is equal to 2 2 plus minus minus of 4 into the square root sign and this is 2 plus or minus i times 2 divided by 2 which is 1 plus or minus i therefore the general solution is an equal to some c 1 times 1 plus i raise to the power n plus c 2 times 1 minus i raise to the power n but at this point we will process 1 plus i raise to the power n and 1 minus i raise to the power n but we see that 1 plus i is equal to root 2 into 1 by root 2 plus i times 1 by root 2 which is equal to root 2 cos pi by 4 plus i times sin pi by 4 within parenthesis therefore 1 plus i raise to the power n is root 2 raise to the power n and cos pi by 4 plus i sin pi by 4 raise to the power n and at this point we will use demyber's theorem to write 1 by root 2 root 2 raise to the power n cos n pi by 4 plus i sin n pi by 4 similarly 1 minus i is root 2 1 by root 2 minus i 1 by root 2 which is equal to root 2 cos minus pi by 4 plus i sin minus pi by 4 1 minus i raise to the power n will be root 2 raise to the power n cos minus pi n by 4 plus i sin minus pi n by 4 which is equal to root 2 to the power n cos n pi by 4 minus i sin n pi by 4 now we will be replacing this and this expressions in in place of 1 plus i raise to the power n and 1 minus i raise to the power n let us go to the next page now let us recall that we have an expression in the form an equal to c 1 1 plus i raise to the power n plus c 2 1 minus i raise to the power n where we have worked out the expressions for 1 plus i raise to the power n and 1 minus i raise to the power n which we substitute now to get c 1 2 to the power n times cos n pi by 4 plus i sin n pi by 4 plus c 2 cos n pi by 4 minus sin i sin n pi by 4 and we have to multiply by 2 to the power root 2 to the power n therefore we get root 2 to the power n c 1 plus c 2 cos n pi by 4 plus root 2 to the power n i times c 1 minus c 2 into sin n pi by 4 now suppose somebody tells us that there is there are initial conditions in the form a 0 equal to 1 and a 1 equal to 2 then we will substitute these values in the general solution to obtain 1 equal to a 0 equal to c 1 plus c 2 we have to note here that if we look at the expression of a n root 2 to the power n if n is 0 is 1 the next factor is c 1 plus c 2 which survives and then cos 0 pi by 4 is cos 0 which is 1 plus again root 2 raise to the power n is 1 i into c 1 minus c 2 will be there but sin 0 is 0 therefore the second term does not appear in this expression and therefore we get that c 1 plus c 2 is equal to 1 now if I put n equal to 1 then we will get 2 equal to a 1 which is equal to root 2 into 1 because we already know that c 1 plus c 2 equal to 1 into cos pi by 4 plus again we have a root 2 then i times c 1 minus c 2 and sin pi by 4 which we know is root 2 in fact let me write sin pi by 4 here sin pi by 4 so in the next step we write root 2 into 1 by root 2 plus root 2 into i c 1 minus c 2 by root 2 so root 2 will cancel both expressions so I get i times c 1 minus c 2 is equal to 1 and please see here that we really do not need c 1 c 2 independently separately we just need i times c 1 minus c 2 and c 1 plus c 2 and both are once therefore we have a n equal to root 2 raise to the power n cos n pi by 4 plus root 2 raise to the power n sin n pi by 4 thus we see that ultimately the solution that we get after putting the initial conditions is real the discrete numeric function a n for all values of n will take real values although in between we got some intermediate solutions which are complex numbers now the natural question that occurs here is that given a polynomial of degree 2 an equation whose degree is 2 that is a quadratic equation in single variable we know that there are 3 possible cases the it may have 2 distinct real solutions or 2 distinct complex solutions and there is a third case that is the case when the solutions are repeated or it is sometimes called the roots are repeated now we will now look at that case in example 3 consider the recurrence relation a n plus 2 minus 4 a n plus 1 plus 4 n equal to 0 now if we apply the same technique put a n equal to c times r to the power n then we get here c times r to the power n plus 1 n plus 2 so we get c times r to the power n plus 2 minus 4 into c times r to the power n plus 1 plus 4 into c times r to the power n which is equal to 0 now first we take out c to get an equation of the form r to the power n plus 2 minus 4 times r to the power n plus 1 plus 4 times r to the power n equal to 0 this is important therefore let us number the equations we again start from 1 so on this page the recurrence relation will be referred to as the equation 1 and r to the power n plus 2 minus 4 r to the power n plus 1 plus 4 r to the power n will be referred to as equation 2 and then assuming that r is not equal to 0 we get r square minus 4 r plus 4 equal to 0 let us call it 3 which is the characteristic equation of 1 it is obvious that 3 is same as r minus 2 square equal to 0 therefore we have only one root repeated twice which is r equal to 2 therefore we have one solution as a n equal to some constant times 2 to the power n but at this point it is very important the theory tells us that we have to get so called another linearly independent solution of the equation 1 now roughly speaking when we say we need another linearly independent solution we mean that the discrete numeric function that we are talking about is not a constant multiple of the discrete numeric function that we have obtained here that is c times r to the power n because all the constant multiples have been already taken into account in fact the theory says that the general solution of a second order linear homogeneous equation will be of the form of C1 times 1 solution plus C2 times another solution which is not a multiple of the first one now from the characteristic equation we get no other solution that is why we consider the equation 2 now since equation 3 has a repeated route we know that if we take the derivative of the left hand side of the equation 3 which is a quadratic polynomial that repeated route will also be satisfied that derivative will be also satisfied by that repeated route let us check that so let us write f r as r square minus 4 r plus 4 the derivative of f r that is f dash r is 2 times r minus 4 now f dash 2 is 2 into 2 minus 4 which is equal to 0 this is 2 in general now we have equation 2 over here which is essentially some gr equal to r to the power n into f r now if we take the derivative of gr that is g dash r this is by the chain rule the sorry the product rule we get n into r to the power n minus 1 f r plus r to the power n f dash r now if we put 2 instead of r then we have n into 2 to the power n minus 1 into f 2 plus 2 to the power n into f dash 2 now we know that f f 2 is 0 we have already proved that and we have already also seen that f dash 2 is equal to 0 therefore this is equal to 0 now we we take the derivative again of 2 in the form given as the left hand side of the equation 2 if we do that then we get n plus 2 r to the power n plus 2 minus 1 minus 4 times n plus 1 r to the power n plus 4 into n r to the power n minus 1 is equal to 0 and I know that this is satisfied for r equal to 2 now since we know that r not equal to 0 I multiply by r both sides to get n plus 2 r n plus 2 minus 4 n plus 1 r to power n plus 1 plus 4 n r to the power n which is equal to 0 now here we observe a startling fact we see that we have already proved that this equation is satisfied for r equal to 2 therefore we can safely write that this means n plus 2 to the power n plus 2 minus 4 n plus 1 to the power n plus 1 plus 4 n to the power n equal to 0 that means that if I had taken a n as n r to the power n as a discrete numeric function that discrete numeric function will satisfy the linear recurrence relation given by one let us match it because we have here n plus 2 to the power n plus 2 which is a n plus 2 if a n equal to n r to the power n so I have a n plus 2 then minus 4 a n plus 1 plus 4 a n equal to 0 so by considering the fact that if a quadratic equation has repeated roots then that repeated root is going to satisfy the equation obtained by taking the derivatives of the quadratic equation and then by using that and the equation 2 over here we have obtained a another solution for the original recurrence relation now let us look at these two solutions let us recall again the recurrence relation that we are considering a n plus 2 minus 4 a n plus 1 plus 4 a n equal to 0 and the recurrence this is the recurrence relation and the solutions are a n equal to a constant times 2 to the power n another solution is a n equal to a constant times n 2 to the power n now general solution will be of the form a n equal to some c 1 times 2 to the power n plus c 2 times n 2 to the power n now initial conditions are given by a 1 equal to 3 let us see and a 0 equal to let us take a 0 equal to 1 then if I put n equal to 0 then 1 equal to a 0 equal to c 1 and 2 to the power 0 is 1 and the second term is going to be 0 because n equal to 0 so we get c 1 equal to 1 and if I put n equal to 1 then we get 3 equal to a 1 equal to c 1 is 1 so 2 to the power 1 plus c 2 into 1 into 2 to the power 1 therefore we get 3 plus 3 equal to 3 equal to 2 plus 2 times c 2 which means c 2 equal to 1 thus the solution is a n equal to 2 to the power n plus half of n 2 to the power n thus in this lecture we have discussed recurrence relation which are second order linear homogeneous with constant coefficients and we have seen that a general method of solution exists and it leads to solving quadratic equations and when we want to solve quadratic equations in one variable there are three cases to be considered one when the roots are distinct real to roots are complex and three repeated roots we have seen how to handle these three cases in the context of second order linear homogeneous equations with constant coefficients this is all for today thank you