 So, today we will start a new topic which given everything that we have been doing so far that is basically we have been looking at one dimensional flow may be a little different. It is in some fashion connected to the material that we did right in the beginning of the course when we talked about representation of functions and so on okay. So, it is I want to give you a flavor for variational techniques some of you may have encountered these variational techniques in different courses earlier variational principles are used right have been used principles of virtual work and so on you may have seen these before. So there is a whole area of study called calculus of variations you happen to take the elective it is good but I think the last time I asked nobody is really dealt with calculus of variations before. So, what I will do again in the spirit of this introductory course I will try to give you a flavor for calculus of variations it is I am not going to do any finite element method as I said in right of the class of techniques I have basically looked at finite difference method I have mentioned hand waved a little on finite volume method but this is in a sense of foundation for finite element method okay in the sense it is basically the foundational material for finite element method. So, the idea is very simple what I am going to do is I am going to set up the relevant theorem the important theorem that we need I am going to do it in parts okay so mathematics normally the way we prove something is that we take intermediate steps which are called lemmas and then you prove your theorem based on that lemma the logical sequence. So the other reason why I want to do this is also to give you in case you have not had this before a flavor of proving something okay. So you may have seen you may have you know so in calculus maybe you have manipulated perform manipulations and so on but just so that at a more mature stage again you see right these techniques of proving something so that is basically the driving motive for these set of classes is that fine. So there are two ways that I could do this one of course I could give you the motivation right up front or we could go with the lemmas I do not know what is the we will try out what the lemmas like and then maybe we can see whether motivation is required I will give you the motivation is that fine okay. So the first lemma this is by the way I am following calculus of variations by Gelfand and Foreman that very readable book you can check it out a library has it. So the first lemma okay basically says if a of x is a continuous function on an interval AB so I would write that as a of x belongs to AB so this is a shorthand notation right that is the whole point about mathematics that you are learning a language I hope all of you are familiar with this. So CAB is like this big bowl and the bowl contains continuous function so you can stick your hand and take out a function right from that bowl am I making sense the AB indicates that it is over the these are it is a bowl of functions defined on the domain AB on the interval AB is that fine is that okay right this is just matter of notation so alpha of x belongs to C so I am taking an alpha from this and I will have another function h of x which belongs to some more notation so I am basically going to be introducing I am using this opportunity to introduce this kind of notation. So C0AB and what I mean by this putting this 0 in between is that h is not only continuous on the interval it is defined it is a function on the interval AB but it is 0 at the end points what I mean by this is h of A equals h of B equals 0 the integral of over AB alpha of x h of x dx if it equals 0 for any h normally if you look at Gelfand this statement would come afterwards you basically say alpha of x belongs to this and the integral AB alpha of x h of x dx equals 0 for any h of x coming from here then alpha of x is identically 0 okay fine so if you if so the way mathematics works if you are taught about this is basically a conversation between two individuals right all you have to have a split personality right so essentially what I am saying the statement of this theorem what I am saying is look I will give you an alpha of x the alpha of x will be defined on the interval AB it will be continuous right so I am going to give you a continuous alpha of x such that alpha of x AB integrated this integral will be 0 now the other individual you can pick any h of x that you want you pick any h of x that you want which is 0 at the end points and is continuous and I guarantee and I guarantee right that this integral will be 0 fine to which then you say no your alpha must be 0 am I making sense that is a conversation right so it is like a discussion I am basically saying look I give you I will pick an alpha of x I do not tell you what and I am guaranteeing this is 0 and you get to pick the h of x you pick any h of x that you want as long as it is continuous and h A equals h B equals 0 okay right so it is like a conversation to which you basically say if you if you tell me that then I insist that you must be picking an alpha it cannot be that oh I have just picked some alpha your alpha has to be 0 that is what you are insisting your alpha has to be 0 is that fine okay so the there are lots you know typically mathematicians will look for different ways by which the straightforward way would be that you assume that you give me the benefit of the doubt you say okay Ramakrishna there is it possible you can actually find there is we will give you right there is a place there is an there is alpha is not 0 everywhere it is not identically 0 okay alpha is not ideal we will go with you let us see where you go right basically you say I will give you what you want we will get you in trouble that is the idea right so alpha of x is not equal to 0 at some at some psi there is some point psi there is some point psi in the interval A B there is some point psi in the interval A B right where alpha is not 0 alpha being a continuous function there is a small neighborhood around that point where it is not 0 basically okay let us see idea there is a small neighborhood where it is not 0 that is why that is why the continuity component is important you would make sure that I use every bit that I have stated here right so it is if the function is continuous if the function is continuous you cannot just have the value 1 you cannot just have a non-zero value here and 0 everywhere else that does not make sense right. So there has to be a neighborhood in which it is non-zero and we can assume that without loss of generality as they say that it is positive you can make the same argument assuming that it is negative is that fine okay so I finished my part of the story now your part of the story see now you have to get me into trouble so your part of the story would be okay we need to pick an H we need to pick an H you get to pick the H right see what I am saying is for any H this is true you have to just pick one H for which it fails that is all that you need to do so your hunt now is to find an H that gets me into trouble is that fine. So you pick an H in such a fashion you pick an H in such a fashion that it is 0 everywhere and non-zero on this interval that is the idea am I making sense okay so you can pick an H so if this happens to be say x1 and that happens to be x2 there is an interval over which it is non-zero right so if I pick an H H of x which equals and there are different ways by which we could do this of course we know another way by which we can construct it but anyway I will just write x-x1 times x2-x pick this cleverly for x and x1 x2 you understand what I am saying right so I in my mind I said well if the point is in between I want something positive times something else that is positive right so x2 is greater than x if it is in that interval x1 is less than x if it is in that interval so x-x1 times x2-x is positive right that is why I picked that am I making sense and it is 0 at the end points x equals x1 it is 0 x equals x2 it is equals 0 okay we could have used our hat functions also we could have put a small hat function there instead of this but it does not matter equals 0 otherwise equals 0 otherwise so then what I substitute integral a to b alpha of x H of x dx equals integral x1 to x2 where it is non-zero alpha of x H of x dx not equal to 0 violating my guarantee you understand violating my guarantee so which means that I cannot guarantee the only way I can guarantee this is if alpha of x equals 0 identically everywhere is that fine this lemma is just sort of warm up to get your feeling as to where we are going okay I am not going to use this directly but the next law we will use directly okay fine questions okay let us try let us try one more see where that goes if alpha of x is in CAB same thing and H of x is in now I am going to change it I will say is C1 AB the superscript 1 indicates now H has also got derivatives okay now I am just now I am not talking about functions that are continuous right the function can be continuous but there may be points where the derivative is not defined okay now I am saying now the derivative is there everywhere this is the bowl of functions which are which can be differentiated everywhere okay this earlier this is a set of functions which were just continuous now we are basically saying no that is not that is not it this is a set of functions which is not only continuous but also has derivatives okay with it is just it is just notation that basically tells you see it you have to get comfortable with it and very quickly it looks like oh it gets messy but if you imagine look at how compact that notation is defined on the interval AB 0 at the end points has derivatives you understand right it is continuous derivative fine okay if alpha of x H prime of x where H prime indicates differentiation with respect to H then what do you expect it will turn out that alpha of x is identically a constant okay it will turn out that alpha of x is identically a constant is that fine now we have the same we have the same strategy now we have to figure out a strategy before we start off obviously what you are going to say is we have the same discussion right it is obvious that I am saying I am going to give you a alpha which is come from this bowl of continuous function so I am going to dip my hand in and take out an alpha and I will take that alpha and I guarantee to you for the alpha that I have got I take a look at that alpha and say you know what for the alpha that I have this will always be true you get to choose the H this will always be true to which again your response will be if that is a fact then your alpha must be a constant okay right and again we go through the same argument saying well okay maybe my alpha is not a constant right you give me the benefit of the doubt one more time and say okay alpha is not a constant alpha is a function of x so if alpha varies if alpha varies your your business now is to give me an H that will get me into trouble right so that it will force me to concede that alpha is a constant am I making sense okay is that fine so our objective is now to construct an H further not only construct an H H which has a derivative we need to construct an H which has a derivative with what we have in our hands what we have available to us we need to construct an H which has derivatives okay so it is a good idea to define H as the integral of something you already give you see there is a there is a logic that pushes us okay so these are these are standard tools that you would use when you are looking for something there is one there is inspiration it strikes you saying oh I see the I see the proof the other is that you sit down and you actually work through systematically so these are clues that you get these are clues that you have so it has equal a constant so we will start by defining a constant as the average of the alpha okay and I do that the average value of the alpha right then if I say alphas you understand what I am saying alpha is a constant it will be the average value obviously so the average value of alpha I have called that I will say constant I will define C as what is the average value integral a to b alpha of x dx 1 divided by b-a let us see average value we will start there we will start with that constant okay so if your alpha is identically so what I want all we have now come to is I have to prove that alpha is identically that constant fine so this can be rewritten actually this is b-a times C b-a times C which suspiciously looks like integral CDx between a to b okay so b-a times C so this looks like integral CDx a to b right which I take over to the other side the average in a sense I mean you may have seen this normally people will just do it directly so you say the average and you put a semicolon there so alpha of x so I define a C in that fashion that is just the average it is the same thing I have just manipulated it started off the average multiplied by b-a recognize that is the integral the average that is essentially what it means right the integral of the function and the integral of the average of the same and that is essentially what we are saying integral of the function and the integral of the average of the same fine right so I said oh I need an H that is differentiable I have an integral right so I can define an H now so I say H of x okay so what is H of a 0 what is H of b 0 and the derivative exists you understand what I am saying so we have got what we want is that fine now I have to somehow involve this in that I have to involve this in this integral I have to get an integral of this form right I have I have this I have to somehow get an integral of that form so I say okay let me look at x H prime dx okay which is nothing but integral okay so this is 0 because this is Hb-ha this is just Hb-ha C times Hb-ha that is 0 this is what we want and what is this this I am guaranteeing to be 0 this is what I claim is 0 I have given this to I said oh you pick any H I guarantee this will be 0 right so this is 0 fine that is a given that is 0 that is my guarantee and what is this what is H prime alpha-c so now I have integral a to b alpha-c whole squared right alpha of x-c whole squared dx equals 0 and this is a positive quantity the integral of this positive quantity is 0 therefore the thing itself has to be 0 there is no choice integrand is positive is greater than or equal to 0 alpha of x-c squared is greater than or equal to 0 this tells us that that is possible since this right hand side equals 0 alpha of x has to be a constant has to be that particular constant is that fine so it is not bad I mean we can work through we can work through and the all always when you are reading these theorems you should always look at it as a conversation right at least it helps me I do not know whether it helps you it always helps me right to look at it as a conversation okay now let us see if we can get to the third lemma lemma 3 before we get to the actual theorem okay the third lemma says I have two functions now if alpha of x and beta of x belong to CAB the two functions that I have alpha of x and beta of x that come from CAB right so and H of x again maybe I need to erase this belongs to CAB which is 0 at the end points first derivative exists the integral A to be alpha of x H of x plus beta of x H prime of x Bx equals 0 so this is a neat relationship then this is remember that I picked alpha and beta from the bowl of continuous functions this is 0 right then you can assert you can tell me look you must have picked beta which is actually got a derivative and that derivative is alpha if I guarantee this if I guarantee this and you can tell me you must have picked a beta that has a derivative right and that derivative is alpha okay is that fine so again we look here we look for clues just like we did last time clearly clearly we will have to figure out something to do with this integral now it has H and H prime so we either have to convert it to something that has H or something that has H prime we have done we have done a lemma before which had an H prime right we done a lemma before way before that which had an H so if you could somehow convert this to something that is completely H prime or something that is completely H we could apply one of the two previous lemmas okay that is one thing that is clear am I making sense see this is strange the first one had only H in it the second one had H prime in it this is as both okay so I am thinking well yeah if I want to convert this to an H prime I know one rule that will introduce a derivative when we are doing integration by parts we have products of things right so I know one rule by which we can guess I know one mechanism by which we can do it integration by parts will get me a derivative see we are working out strategy now right so integration by parts will give me a derivative so that is fine okay the second thing is I want beta prime to be alpha so it looks like I need the integral of alpha in some fashion so we start by defining a function which is the integral of alpha so a of x is the integral a to x alpha of x dx okay so that is a potential candidate for beta you see what I am saying so I have no because I look at this and I say okay let us let us get the let us lay the foundation first right so we have that then what would we do integration by parts so we start with alpha of x h of x so the integral a to b alpha of x h of x dx equals integral how should I do this a to x integral that is a of x h of x between the limits a to b actually I want that but you know you understand what I am saying I basically want and minus the integral a of x h prime of x dx that is not bad right that is not bad we can just go back now and substitute for alpha of x h of x I can just make this an indefinite integral if you want but anyway it is okay I leave it as it is since I have it I leave it and therefore we apply lemma 2 you understand I have some function of x times h prime of x dx equals 0 and our second lemma basically said this quantity must be a constant okay am I making sense see that is the idea of that is why you do these lemmas are small small results along the way they are like they are the programming equivalent of writing small functions that you can use to build the reach the bigger objective okay that is the idea so this tells me that beta of x minus a of x equals a constant or beta of x is I differentiate beta prime of x is alpha of x okay that is that is 3 lemmas this belongs to as I said the segment of the course that I call 3 lemmas in the theorem so we have done the 3 lemmas what about the theorem for the theorem I will give you a motivation right why have we done all of this what is the point okay so we had said in the beginning as I said I will tie this up to the material we have what we have talked about in the beginning of this semester as we said in the beginning what we are looking at is functions the solutions that we are looking at right our functions the problems that we have at hand the solutions that we seek are all functions a simple example now would be you are at your dining hall or whatever having breakfast this morning you wanted to come to this class there are any number of paths that you can take any number of paths that you can take from your dining hall to the class am I say making sense and each one of those paths is a function of in this case x, y, z right since we are on the third floor in this case x, y, z right so you start off you walk along or you bike along but we will assume that you walked along you walk so you start walking there are different ways by which you can get here okay some of you may forget make a turn near chemistry building and head out head out in the wrong direction and then maybe come through humanities and sciences block and come here so it is a long winded path right so you have the question that we have now nice so there are lots of paths right it is nice to know that there are lots of paths one block block path is blocked you can come by another path so but the question that we ask now right which makes this interesting is is there a shortest path is there a safest path right is there a most energy efficient path summer is coming is there a path that is the coolest path so you have metric you have measure to say to like this is like a residue to say that yes I have what I want okay so you can ask this question so there is an issue of optimality here what is the optimal path what is the best path in some sense okay so if you say that you have the best what is what do you do normally in calculus if you say I have the maximum or minimum what is it that we normally do no no before you get to the derivative derivative comes later we will go towards something that looks like the derivative derivative comes later you perturb it you disturb it so if you think that you have a minimum you disturb it and the disturbance should cause the value of whatever that you have the function that the measure that you are looking at to increase am I making sense so if you say I am looking for the shortest path if you disturb the path if you disturb the path then the length should increase it should no longer it should be longer than the shortest path any other path should be longer than the shortest path so the length should increase is that make sense okay but clearly you always want to start whatever the disturbance that you do you always want to start at the dining hall and end up in this classroom if you create a disturbance that takes you from the dining hall and takes you to a wrong to the wrong classroom that does not help right so that explains why h of a equals h of b equals 0 h is the disturbance right to explain why y is this function what is this peculiar function that I am talking about where I keep saying the end points are 0 and it is a continuous function it continues here you are not going to teleport from one point to another point you are not going to it would be nice but you are not going to sort of walk along and suddenly zap and then you appear at some other point right there is no discontinuity the path is a continuous path okay so the path is a continuous path so you are going to start at one point always end up at the other point these points are the same you can change the path but end points do not change okay so what you do is you have h of a equals h of b equals 0 a is the starting path b is the ending path am I making sense and you have continuous functions and you can perturb with this h that is the idea okay fine so in calculus of variations the usual way by which we do this maybe I will leave that there so we look at I might as well use the standard notation in calculus of variations functional it is a function its argument is a function I am going to give you a path a whole path you understand the argument is a function so this thing is a function of a function right it is a functional equals integral a to b f of x, y, y prime dx where as earlier y prime is dy dx obviously y is a function of x what we want is we want j y we want that y you want to find a function y so that j y is a minimum is an extremum or a maximum right this could be some function j y could be your profits you want to maximize your profit right this could be some function it could be the distance between 2 points and j y is the distance measure of the distance you want to minimize the distance or it is the time right or you want to maximize this is a function it is the measures it gives you j y is the amount of time that an airplane flies you want to maximize it to get endurance then y is the function that will tell you what is the long longest maximize that you understand you can these are all these are all basically they take a function as an argument and it returns a number it returns a number it is a map it maps a function given a function it maps the function into a number you understand what I am saying so if our if our function y this is y prime there is a derivative if our function happens to come from c 1 defined on a b it maps it to the real line am I making sense that is what this is doing it is taking a function and giving you a number just like a norm did that is what our norm did norm of the function that is what it did the norm of the function basically swallowed a function and spit out a number the same thing okay that is what our norm did so it is not very different from something that we have seen before okay so we want to take derivatives we think back derivatives the perturbed we perturbed j y plus h what is h h is our earlier friend h 0 at the end points you understand and continuous a to b f of x y plus h y prime plus h prime dx okay just like we do when we define a derivative I subtract this from this I subtract that so I get j of y plus h minus j y is the integral a to b f of dx so far so good what can I do now left hand side there is nothing much we want we want to find that out right hand side is only thing there is not anything that we can do here so we look at this Taylor series you look at this you think Taylor series right since I am thinking in terms of derivatives since I am thinking do not ignore the fact that we are talking about functions ignore the fact that this is a map from functions to real number right now since we are thinking about derivatives since we are thinking about derivatives what is the derivative what is the general sort of symptom or definition that I gave for a derivative it is a linear transformation in the direction we know the direction I have perturbed it in the direction of h we want the linear transformation corresponding to that getting out of that right we want to get the linear transformation not corresponding to that but getting out of that so we have the difference we want to we want so what it basically means is I am going to expand this using Taylor series and keep only the linear term right keep it only till linear because that is what I want I want the linear transformation so what do I have integral a to b f of x y y prime plus what is the second term of Taylor series h times f of dou f dou f dou y plus h prime times dou f dou y prime minus is that fine if you want I am just blindly doing Taylor series just manipulate the ink marks manipulate the chalk does do not worry about over this is the derivative all of that kind of stuff remember what we did when we did flux Jacobian substituting q 1 q 2 q 3 if it helps you replace this by x y and z instead of y prime okay think of it as x y and z right so then this would be h times dou f dou y z delta z times you understand what I am saying dou f dou z that is it this is a Taylor series right and I have chopped it off at the linear term this of course cancels giving me the integral a to b h dou f dou y plus h prime dou f dou y prime dx since it is a linear part we call it the first variation given the symbol delta j called the first variation for the first variation it is a change the first variation like they sound like first derivative like the first variation and if it is an extremum this variation will be 0 if it is an extremum this variation will be 0 an extremum the variation will be 0 now we are ready to apply lemma 3 lemma 3 basically says that if you have alpha of x h of x plus beta of x h prime of x dx equals 0 it is 0 for any h that you give right any perturbation that you give then beta prime of x equals alpha of x that is beta prime is d by dx dou f dou y prime equals dou f dou y is that fine everyone these equations are called we have seen this maybe in your physics or something of that sort Euler Lagrange equations Lagrange in your physics most probably you heard about it as a Lagrange equation you have to define the Lagrangian and so on right. So that comes from the analytic dynamics point of view but yeah so they are called the Euler Lagrange equation is that fine are there any questions so we have managed we have managed this is an interesting thing that is happened here so this is a differential equation right in some sense this is like a derivative. So we have managed basically to go from an integral variational form right integral variational form which was where which was here we want to manage to go from an integral variational form j y which we want to minimize or maximize or get the extrema right get either the maxima or minima you manage to go from this form through this process to a differential equation. So we have gone from something that looks like something that looks so this is like differentiating differentiating it in some fashion like taking a derivative and setting it equal to 0 that is basically what we have done we wanted an extrema from that functional we wanted an extrema for that functional and we have managed by some process of differentiation to get a differential equation is that okay everyone is that fine of course there is the equivalent you could ask the question if I give the differential equation can I go back to the variational form okay and just like differentiation and integration going from there to here is easier than going from here back there right because now you have to guess you have to come up with a variational problem and then turn around and say if I take the first variation of that go I get the equation that I have at hand. So the integration the equivalent of the integration form again involves guessing right so the direct thing going from the variational problem the optimization problem to here is relatively easy fine relatively straightforward very often there are times you can ask the question why would you want to go from here to there there are times when this is very messy and the variational form looks is quite simple and elegant okay maybe I will give you an example of that little later let me see if we can I will just set this up you will see how far we can take this today so what is the example that we talked about we talked about distance between two points right. So I will take the distance between two points A and B that is A that is B this is the x axis I do not write A and B there right and what we want is we want y equals y of x such that length of the path I should not say distance between two points length of the path is shortest the length of the path is shortest okay the shortest path then you could identify as the distance between two points and I have actually changed though I gave the example as from your dining hall to here in a subtle way change the problem however I change the problem there are no obstacles here this is truly the straight line there are no buildings in between and then there is no you cannot there are no obscenities this is you can just walk the straight line path which is what we should get right you can just walk the path am I making sense so what is the length of this path y of x what is the length of this path what is J of y integral A to B remember square root of 1 plus y prime squared dx okay this is the square root of ds squared ds squared is dx squared is dy squared finally write it this way and f happens to be capital F happens to be okay what is dou F dou y 0 fine what is dou F dou y prime 2y prime by square root of 1 plus y prime square oops y prime by right the 2 and the half cancel so the Euler Lagrange equation tells us that dou F dou y is 0 Euler Lagrange equation tells us that d by dx of y prime by square root of 1 plus y prime squared is 0 or y prime divided by square root of 1 plus y prime squared is a constant and this is C the different ways we could do this but anyway we can start from here integrating appropriately or we can do indefinite integrals you solve for y prime y prime squared equals C times 1 plus y prime squared therefore you have to always be careful when you square things allow for spurious roots therefore y prime is y prime squared if you want you want me to keep it simple y prime squared is C divided by 1 minus C okay the other thing that you can do is the other thing that you can do is you can integrate this between a to x right and see integrate this between a to x then you will get a lower limit which is this quantity at a and then you can manipulate if you feel more comfortable doing that so this tells you basically y prime is a constant or y equals y of x is a straight line is that fine okay right thank you.