 So wat I'm going to do now is show you some something Beautiful, some beautiful mathematics. We can't do much in physics or we can't start this discussion properly as far as the gradients and Hamiltonians are concerned if we don't understand the concept of the minimum. Something is at a minimum and that is how nature decides what to do. Nature decides that the shortest distance between two points in a clean space is going to be a straight line, how does it decide that. is must be something underlying this decision in nature is the concept of the minimum and you've got to understand it through the concept of the calculus of variations so how do we do that it's going to be many boards and i'll have to have to wipe the board in between let's just have a look at this i have the x y plane and i have two points which is a starting point and a final point and there's various paths i can take through this so you could in space there's my x and there's my y i'm going to go from one point to the other point on some path you can imagine i can go to andromeda galaxy and back and there will still be one path if andromeda is is there at least if i can just go in a two-dimensional plane there is a straight there is many lines i can take between this but i want the shortest possible distance between those two the shortest possible distance now one way i can measure this any of the paths that i've that i can possibly choose is just to divide it into tiny little segments of say a specific length delta s so let's blow that up a little bit if i were to blow that up it's almost going to be a straight line you can most most lecturers would skip this button go straight just to the to the to the integral but this is good so this is going to be this arc length it has a length but it will have from that point to that point a delta y and a delta x so the length of delta s is very nearly going to be what well the square root of that percent this is by theory so that will be delta x squared plus delta y squared very beautiful and we know if i can let delta x approach what's limited the limit take the limit as this approaches zero this is going to become smaller this line segment will become shorter and right in the end i'm going to have this differential tiny little tiny little distance ds which is going to be the square root of dx squared plus dy squared we can all see that and i can rewrite this just want to show you how nice you can rewrite it of course you're going to say ds is going to equal the square root of i can take a dx squared out which will leave me one plus dy squared over dx squared it's beautiful i've just taken this out as a common factor if i would want to multiply those back in there of course i'm going to land back up there in other words ds i can write as the square root of one plus let's just call it y prime y with respect to x squared that's very ugly i should do that that you can see is the whole it's dy squared and dx squared okay so that and i'm just calling it y prime dx that's what i'm doing so that will be the length of an infinitesimally small little line segment there i've zoomed in so much but it actually is a straight line so i go from approximate to absolutely equal to and that is in the limit as delta x goes to zero and what i can i do how do we do integration if i have to just sum all of these together i take the integral of that so if i were to take the integral of both sides what am i left with s the total distance of this arc so this is this uh a line integral it's going to be this definite integral i'm going from x one to x sub x sub one to x sub two of the square root of one plus y prime square dx so there's my line integral okay and this is setting up distance but this needn't be distance i can set up many things in physics i might want to know what the shortest time is so there's going to be some path chosen that represents the shortest time i can have many things in here i can have not just distance but shape what would be the minimum surface area of something and i can do that by just setting up an equation for surface area okay so in what we do in in calculation of various calculations of variations is we're just going to call this i that is this group for not only length but surface area time anything is going to be something that i can now plot on a so there's needn't be distance in distance we can have something else but it's going to go from some initial point which i'll call x sub one and some final point which i'll call x sub two okay just to refer to the fact that there's something on one of the axes of some function and if i look at this function very carefully it's actually a function of x y and y prime with respect to that axis so it's from one point to other point on that axis so it's the f of x y and y prime now there's no x in there but that one might as well have been x to the power zero so there is and there's y there's no y just a normal y in there but that might also have been y to the power zero in effect this is a distance one so there was no x and y in there but there could be so there's a function of x y and y prime so anytime we can set this up it's called the it's called the functional this is called the functional that i'm going to do something and it's going to give me some scale of value and i'll clean the board and we're going to use this concept to prove to you that in your pleidian space you know it's not some funny space this flat space that the shortest distance between that point and that point is going to be a straight line we're going to develop this to prove that that is indeed so and through doing that hopefully i'll show you that that is what nature does and that's what we can do we're going to use the calculus of variation to show that there is something in here that is a minimum distance and or a minimum time or a minimum surface area and that is what nature chooses i'm going to clean the board and we'll carry on the board is clean let's have a look so there we go now imagine i'm going to construct something so imagine i knew the answer the equation for that curve between the two points which is the minimum imagine i knew that and in that solution was the y of x small y so of x now let's construct another function we'll call it capital y of x and that's going to include this small y of x plus some constant multiple of a second function called eta of x as most textbooks will do it this way and i'm going to pause the video here and just insert another video i made which is a screencast of how this is actually the absolute truth before i do that i just want to make two things abundantly clear and we're going to set this up this is like a magician setting up something specifically so that it works out for him or her and we're going to set this situation up so that it does work for us so there's for instance my one point in my other point and and we all know intuitively this is going to end up being a straight line but what if it isn't so i have this curve there and write at this x sub one and write at this x sub two i'm going to choose another curve and that's my curve eta of x such that at these points x one and x two it has a y value of zero and i can choose many of these just by changing this constant multiple eta if eta is one this would be one curve if eta is 1.5 it will be another curve if eta is negative three this will be another curve and this was my two answer which is a secret up till now but imagine i knew what it was and if i just add this at every point i just add these two then i was going to have something like this but you can imagine this capital y of x this capital y of x is is just these two added to each other but you imagine they are multiple for every eta of x i can choose any constant which will give me an infinite number of these little curves which means added to the real answer i can get many others and remember single variable just normal variable calculus if i just had a curve if i had a curve and i wanted to know the minimum the maximum well all these extreme points extreme would be at spots where the derivative the first derivative was going to be zero that is a minimum or maximum and i knew it was a minimum if i took the second derivative and if that answer was at that point was larger than zero i knew that to be a minimum and that's the same thing we're going to do to this we want a minimum we're going to take the derivative of this and set it equal to zero remember this is how i set up my distance i had s equals the definite integral going from x1 to x up to of the square root of one plus y prime square dx that was my distance i want to take the derivative of that and i want to set it equal to zero and if i do that i'm going to get to the minimum point and that's what we want i want to construct something that this line falls exactly on top of that line because if i do that there'll be some minimum and that will be the true result that i get there i'm ahead of myself so this is what we set up i'm going to pause the video here and insert that a little bit just to show you that this is an actual fact you can set this up many ways you can set this up and this is not this is not some trickery here that is mathematically unsound it's very sound you can set this up and i'll show you in the video so here we go let me show you i want to construct this capital y of x in terms of small y of x plus some other function eta of x and that eta of x i want to be able to multiply by some constant so i've set things some things up here let's have a look at them let's just take some of these away and let's just bring them back one by one so imagine just that this is my y of x i've made it a straight line it needn't be a straight line here's my eta of x and i'm just drawing in these two straight lines just to note that i've constructed eta x in this instance it is something here there we go there's my epsilon which i've called in here and it's this minus x minus four square plus one it's this little curve and i'll show you now why i put the n in there so what i'm saying is one thing i've got to construct this so that at x one and x two which is this spot here and that spot there i want that to correspond here to the same values that's why i've got the two straight lines and the fact that the y value for eta of x down here has got to be zero and zero at both points that's the way i want to set this up so what i have now is the capital y of x and the capital y of x between x one and x two has got to be the addition of these two and this is what we have right up here this is this green note though that because eta of x is zero at this point i'm not adding anything to small y of x and at that point i'm not adding anything to small y of x but there is the addition of these two curves at every point on the x axis between x one and x two if i added this value to that value i was going to get that top value that's what i'm saying but look at this if i put eta in front of it which here i've called in it doesn't matter what size i make eta it's just some constant multiple what epsilon i mean my small little my n here is epsilon sorry for that it doesn't matter what value i make epsilon it's a constant multiple it is a constant multiple of eta of x and these points still correspond to my little y of x and my little y of x there so it doesn't matter i i now have this almost well i can say indefinite number of capital y of x every time that i change epsilon i'm going to have a different capital y of x look at the green curve there are so many of them look how many of them there are that means to get from one point point one to point two there are many many paths that i can take and i've got to find the shortest one basically that's why i'm setting up this problem i want some minimum value en de problemen die we deal with obviously minimum arc length between these two points but just to show you that i can construct this capital y of x in the manner that i've done on the board and it makes absolute sense and you can just see it beautifully in this illustration good i hope you enjoyed that now this is beautiful mathematics stay with me you'll see where this is going so what we suggesting you remember that was my equation and i'm going to take the derivative of that and set it equal to zero that will give me the minimum value that's all we're going to do but i don't have this anymore i've changed it that refers to what i had in me the the real answer was going to come from that was going to come from that the distance the real distance was going to have some equation to some value to it but now i have this so what i en actual fact that now is a new function in x capital y in capital y prime that is what i have now so by constructing this addition i've changed it from x small y small y prime to x large y y prime so in some suggestion of this would be remember that was the square root of one plus y square y prime square the square root of one plus y prime square but if i do this to it i'm going to have this as my f of x i have this and i'm going to just do some preliminary work and you'll see you'll see shortly why i'm doing this preliminary work if i if i if i had this function imagine let me just write it outside the y of x equals the y of x plus epsilon eta of x what if i were to take the derivative of this with respect to this constant can you take a derivative with respect of constant of course you can because what is four other than four x to the power zero okay if i were to take the derivative with respect to x i can still take the derivative with respect to x that's probably not the best way a best way to to explain it let's let me rather do this can i say dy capital y of x d epsilon can i say that now i don't necessarily want to do that it's going to be a bit typical let's do the partial derivative of partial derivative with respect to that constant well it doesn't appear there so that's going to equal zero and i as i said i could have written this with an x to the power zero and what you can see this as basically i suppose is this the product of two functions so i can take the derivative of this times that and this times the derivative of that so i can actually have the the epsilon dy epsilon dy epsilon eta x plus eta times d and down whatever you want to pronounce it of eta x so what are we going to have here we're going to have the fact that's zero that is one so we will definitely have that so that'll be the eta x and there's no eta in there so the partial derivative of that with respect to epsilon so is zero zero times epsilon is zero so the derivative of capital y of x with respect to epsilon is just eta of x let's take y prime of x well it's just going to be that prime and you can put you can put the examples in here and just show it to yourself and what is going to happen here well it's with respect to x that i'm taking but i'm taking this derivative that is a function of x so this is very easy this is going to be epsilon eta prime of x in what way to happen if i took the partial derivative of y prime with respect to to epsilon okay there's definitely a partial derivative there's nothing in there that's going to be a zero and exactly the same thing has happened there it's going to happen here so we just going to have eta prime of x so that's all we going to have so these are the two equations it's some preliminary work i probably shouldn't have bought it in here because you want to why is he doing this why is he doing this let's clean the board and we'll carry on let's carry on now remember this thing back i had my equation which was this one plus y prime square square root of that what were to happen if i took the derivative of this of this function well i would have had to use the chain rule so when i had the f of x y and y prime i was going to have to use the the chain rule nothing changes if i have this if i have that function i'm also going to have the chain rule but because i have changed this into that i have a new i have a new function i which i now want to make a function of epsilon that is now going to be x of 1 to x of 2 of the f of x capital y capital y prime dx okay i have now changed when i went from my previous solution to this solution i have now made this a function of eta because i could get many y of x's by simply just just changing this constant so this now becomes a constant of this function and if i wanted to take the derivative of this if i wanted to take the derivative of this with respect to the epsilon why did i say it all the time you know what i mean when i write this when i write this with respect to take this derivative with respect to epsilon what is going to happen now that is why i chose things very carefully i also want to do it at a point where epsilon equals zero and that's why i set things up so remember what i showed you on the screencast that's why i chose things one of the reasons and there's another reason it's coming up i wanted to because of that equals zero then my large y of x this one will be exactly equal to this one they'll fall on top of each other and i'll have my solution okay and another thing is remember when i took the derivative when if that is zero i have the minimum so this is the secret to this whole thing i'm going to take the derivative so i've changed it to a function of eta i'm going to take the derivative with respect to eta exactly where eta is zero and if i set it equal to zero i know i have a minimum that is the calculation the calculus of of variations now just as we had here i would have had to use the chain rule let's use the chain rule of this because if i take the derivative of this it's actually this if i take the derivative of of i with respect to eta it's the same as is doing my integral and taking the derivative of this inside remember your first year calculus so what we're saying here that is going to equal the different integral going from this to that and i'll have to apply the chain rule so i'm actually going to have die f die small let's do that yeah die f die capital y times del y del epsilon please we must not make a mistake here and i'm going to have f with respect to y prime times y prime over epsilon all of that dx so don't get confused here this is just the chain rule of a function of any function remember if if you were to take the chain rule of something if you would take the first derivative of something as simple as this it would be very easy to do this was going to be to the power half you bring the half forward and that becomes negative a half and then you do the derivative of the inside function as well which is going to be to y prime so it's easy to do so for that for any function f of x y and y prime i was going to use the chain rule so yeah i'm also going to use the chain rule nothing different and that's exactly that's exactly what i have there and remember just a board before i did this and i did this so i know what this is this was remember what this was or that was this eight of x remember that rewind in your c and what was this it was eight of prime of x okay so that works for me and this has got to equal zero because if i set it equal to zero then i have a minimum okay we know we at once it's going to be a minimum it's going to be an extreme but let's call it a minimum for now because that is exactly what it is okay so we are there what i want you to realise is one thing i can do this as integration by parts remember the integration by parts i just have to decide which one is u and which one is v prime and that's very easy to do let's choose my v prime equal to this eight of prime of x that makes my v equal eight of prime eight of x and if this was that then that must mean this one is u di f di capital y prime and that makes my u prime the d dx of di f di y prime now i can just simply do integration by parts remember that will be this times that minus minus the integral of this one times that one remember integration by parts but i want to show you something very specific here as well and that's why i set things up i was a magician and i set things up that they work out specifically for me i said i want to do this around a point where eight equals zero and what's going to happen when eight equals zero when eight equals zero capital y of x and small y of x are going to be exactly the same thing they're going to be exactly the same thing so what we're going to have is the following so remember when i have the integral of the sum of two functions i can just do them separately so yeah i'm going to have x sub one to x sub two of del f del y i'm making it a small y now because i'm setting things up way epsilon equals zero so then i will have capital and lower case y y of x is being exactly the same times the eta of x dx plus now for this side i'm going to do this integration by parts so it's u times v so it's d these two so it's di f di y prime times eta of x and from x sub one to x sub two minus the integral of then from x sub one to x sub two of these two so it's d dx of del f del y prime eta oh yeah what was that eta of x dx and that's going to equal zero i hope you can still see that now remember also what i did here i let these two points be exactly the same so if i were to plug those in today i was going to get zero so this whole turn disappears this whole turn disappears and what am i left with this integral minus this integral is going to equal zero i can put them all together in the same integral because this is the difference between two functions and i can take these two out is a common factor and what am i going to be left with going from x sub one to x sub two of what well we're going to have del f del y minus the d dx of del f del y prime all of that times the eta of x all of that dx is going to equal zero in that low and behold is the way we were trying to get this is a thing of beauty now i want to set this up for any eta of x any eta of x because for a different integral to equal zero that means this inner part this integrand has got to be zero but i want it to be for any function of zero so any arbitrary function of eta and so that can't be zero it's being multiplied by this this has got to equal zero and that is the Euler Lagrange function and it states the following by f by y of del f del y minus the d dx of del f del y prime equals zero there we are where is the thing of beauty and remember when my f was this this was my f of x y and y prime if i were to take the derivative of this with respect to y and i took the derivative of this with respect to y prime and then the derivative of that and set it equal to zero i was going to get the answer for the shortest distance between those two points but i generalized it was i so it might be the shortest time it might be the shortest surface area i can use the Euler Lagrange equation to set up many physical problems if i can just through my physical problem develop this and we look at examples in the next video i might just show you proved you then that the shortest distance between two points is a straight line by solving this Euler Lagrange but this Euler Lagrange equation right here is absolutely a thing of beauty en we set it up right from here right from the start we used the simple fact that the first derivative we set it to zero you are going to get an extreme point and that extreme point is going to be a minimum value for you it's always going to work out in this instance to be a minimum let's call it a minimum instead of an extreme point and you're going to land up with this this is a real true a thing of mathematical beauty now let me prove to you that the shortest shortest distance between two points on the euclidean surface is just a straight line nature will always choose a straight line so you'll remember my equation for using integration a line integral for the length of any arc is that is my Euler Lagrange equation so let's just do that this is my if this is my function if function of x y and y prime let's get if time y what is that going to equal of just this bit well there's no y in there so that's just going to be zero that's a simple one what is time if by y prime well there is a y prime in there so i better do this properly and i've got to do it we said it before i've got to do it by the following method so what is that going to be i'm going to bring the half forward so that was going to be a half times again we we we were still going to have this square to the power negative for half and then i still have to multiply that by the inner which is going to be two times y prime that's really first year calculus except that this is a partial derivative but there is y prime in there so these two are going to go so what am i left with i'm left with y prime over the square root of one plus y prime squared that's what i'm left with and so they are left with zero so i have minus ddx of that which is now just this y prime over the square root of one plus y prime squared is going to equal zero which i can multiply both sides by negative one so this will disappear simply when is the derivative of any function equal to zero when that function is a constant isn't it so all of this all of this is some constant in other words y prime equals some constant times the square root of one plus y prime squared i can square both sides if i square both sides i get good of this and i square my constant which leaves me with another constant i can multiply this constant in there so i'm going to see plus some constant plus some constant of that i can bring this over to one side which means y prime i can get on its own which is then going to leave me with one one minus this squared remember i've squared this now to get rid of that and that is going to still equal some constant i'm going to divide this into that side which just gives me another constant and in the end i'm going to take the square root of that so y prime is going to be some constant in the end just run through that i've done in a very ugly fashion there but just do it for yourself you'll notice very quickly that y prime does equal some constant in when is the derivative how can a function of x y prime of x how can that be a constant well the only way that that can be is if the y of x equals ax plus b because if i were to take the derivative of that that would come forward so that's just my constant a is that x and a so that falls away and what is that an equation of a straight line proof that the shortest distance between any two points in euclidean two-dimension euclidean plane is a straight line how did i solve that i set up my differential here my equation here which is my my differential a and i used the calculation of the calculus of variations to set up the the grand jouallier equation i used to the grand jouallier equation and i proved that the shortest distance is there so if i set something else of the any physical system i'll have to set up this function f and if i can set that function of f with its time with its surface area i can use the grand jouallier equation and that will always always give me the minimum that is why i can set up a physical system where i can look at time what would be the shortest time i can set up the surface area and the most famous one of those is if you have two rings one smaller one larger and you put them in some of this bubbly soapy water and you bring them out and you'll separate them and that will form a very specific pattern between those two soapy bubble circles okay and nature chooses that and there's a reason nature chooses that because that will give you the minimum surface area that whole surface area of the of the soapy fluid material between these two you've got to make that a minimum and minimum and you can do it for volume as well why is this one a volume a sphere and nature does that because it is a minimum and some minimum is chosen en lastly from that who will come this fact if you have a ball that has to roll down a plane that has to roll down what is going to be the shortest time for that ball to roll down is it going to be a path that goes straight down in time or is it going to be one of these one of these parts that is called the brachistocroon problem brachie which means short chrome referring to time shortest time there's a reason why this ball will roll down will get from there to there faster than the ball rolling down that path there's a reason for that because nature can choose the minimum time that's what nature does it must choose the minimum time to get from there to there and that is why it will choose a specific path that will be the shortest path to get down you just have to work out en if of x for this problem