 Where we left off, talking about vector fields, and so we have some F, some R in R, and this can give us the gradient vector field. It didn't really prove this, so I don't know, maybe it's obvious. So let's, so imagine that we have some, I'm going to compare these two actually, we need to put that aside. So I want to show that, not verb, so gradient of F is perpendicular to give sub what? Fx. No, next to the perpendicular symbol. So it's perpendicular, Bible set S, which contains. Oh, X naught, sorry, I just couldn't read that. So what I'm saying is, so let me draw a picture. So suppose that we have, I don't know, F is X squared plus Y squared, the easy example, and let's put it in here. Plus Y squared, which is for the contour graph, these are supposed to get closer together. Is it contour? This is Y. And the statement says that if I take any one of these level sets, I take this curve here, and I take any point in that level set. So as long as we're not at a point where the gradient is zero, the gradient here is perpendicular. Or the gradient here, this is really the same picture, is perpendicular to that level set. Now if we are in the case of a higher dimension dimensional thing, these level curves will be spheres. So here, I can't draw this contour graph, but I can sort of draw, I can't even draw that. You should imagine concentric spheres here. So any one of these spheres is a level curve. And I have a level curve, I have level surfaces. So in this case, I should have done something close to that. F of X, Y, Z equals constant. So I'll get a series of concentric spheres like that. And the gradients will be perpendicular to these spheres. So here this S is one of those. So imagine, you know, a little patch here of this sphere. On that patch, the gradient goes away from that patch. And it's perpendicular. So how would we prove that? Yeah? We could do is say whenever we got a vector, we could find the directional derivative of something by dotting a vector with a gradient. But we want the direction that we headed for the change to be zero. Because we don't want to go up and down or on a conical line. So in order for that to happen, we need something perpendicular to the gradient. The direction would be perpendicular to the gradient. Okay? And because that's the only way that the dot product will be zero. Yeah, so that's why the gradient is always perpendicular to the patchwork. Okay. I mean, you're sort of justifying the converse, but yeah. Right. So I mean, intuitively, it's just that, you know, if I have a level set like that, and that means this is the direction of no increase. And so the direction of maximal increase should be as quickly as you can get away from it. Now in this case, let me not draw the sphere. We just draw a piece of a surface where I have a level surface. So there's a piece of a level surface. So here, this is f of x, y, z with some constant. Then the gradient has to be perpendicular to this. So that means that, what does that mean? That means that if I take the tangent plane to this level surface, the gradient dotted with everything in the tangent plane will be zero. But it's maybe easier, instead of thinking about the tangent plane, because I don't have to worry about tangent planes and so on, is take any curve that lives in the surface. So this is some curve, gamma, which lives in certain, lives in the surface. Right. So if I take any curve so that this gamma of t satisfies of gamma is a constant, is this clear what I mean? I'm seeing a little bit of blankness here. People understand what I'm doing? No? Okay. So I have here some level surface. Here it is. And I want to prove that the gradient vector is perpendicular to this surface. But rather than trying to approximate this surface by something else, the statement which is completely equivalent is, I'll draw it on this side, it's like a right one. Here's my surface. No matter how I travel around in the surface, there's a tangent vector associated with that, and that tangent vector will be perpendicular to the gradient. That's the statement that I'm claiming here. So we take gamma to be some, so gamma here is some function from r to rn, which is my curve. And if it satisfies this, then that means that it's like one of these squiggly lines. It lives inside my surface because my surface is defined to be the stuff so that f is evaluated at that point. It's that constant, whatever that constant is. Okay? And so now I can prove this just by showing that the gradient of f, so I take some point. So let's assume that gamma of t naught is x naught. And the gradient of f at this point x naught, this pen is failing, surface with its curves in it, and here the gradient goes this way and the wrong side of nose. H is f of gamma. Everywhere on this level surface, f is some constant, let's call this constant just skis, some constant c. And now we can just take the derivative. So if we take the derivative of this equation, so h prime of t, get about this for a minute, derivative of c, which is zero, the constant derivative of constant is zero, but also it's the derivative of this. And that we did last time. That's the gradient, the derivative of the outside function, which is the gradient of f evaluated at the inside function, dotted with the derivative of the inside function. This is the tangent vector, and this is the gradient. And this is zero. The chain rule that we wrote last time, because I have exactly this setup, right? I have gamma takes to rn, and I have f, which takes rn. And last time we talked about the composition, growing that way, from r to r. We wrote a chain rule for such a composition. Okay? Any questions on that? I guess I didn't read that. So these are particularly important. The gradient vector field, this means that I have a vector field. I just wrote it over there. It's a vector field, although something like, well, here, this point corresponds to a high point. This would be another high point here. Here, here, my contour lines are going to be like circles or maybe ellipses. This point here, and then my contour lines are something like that. Right? So this is my graph in x, y plane of the contours of that. It's going to be this. I guess up is towards the dots here, the way I drew it. So my vector field here is going to flow inward, perpendicular to this, something like that. So it will be a vector field like that. Which corresponds to, so let me just take a particular line here, corresponds to always moving uphill as much as you can. Or more naturally, if you take the negative gradient, that will be like poured water on top and watch how the water goes down. Right? So I was going to change the sign and look at negative the gradient, which is flowing downhill. But, so in physics and in many applications, this function f is called a potential function. So gradient vector field means that you have some potential and the gradient vector field is the vector field that corresponds to the gradient for that potential. And these level curves that I drew are lines where the potential is constant. And then we can have, I had green, these solution curves that I'm drawing, something like, so this is following the flow lines here, that would correspond to something like this one there. So that's a solution curve to this different, to this vector field. So vector field corresponds in some very explicit sense to a differential equation here in the plane. And these solution, these flow lines here, so also one often uses the word flow instead of vector flow. So these lines here which correspond to the curves which are tangent to the gradient to the vector field are called solution curves or flow lines. And they're solutions of the differential equation, of the, of the vector field. So I just wanted to say a couple of words about that. We will definitely come back to looking at these kinds of vector fields later in like a month or maybe a little less, maybe a couple of weeks. Not just gradient ones but ones which are not gradients. So this, this is sort of like integration in the single variable case, right? The vector field is a way of specifying something about the derivatives, finding these curves, sometimes it's called finding an integral or solving the flow. So there's a, a close relationship there. Ortho 3. Yeah, the potential function is a function which, I mean you may not have an explicit formula for the function but it is a function. So for example in, you know, you might have potential energy. And so the energy is, can be conserved in which case you move on, on level curves of the potential. What is the intuition of the potential? Well, do you want intuition like intuition? Well, I don't know about this specific one. I guess, I guess if I flip it over, if I, if I make it, these are, these are down rather than up, then I could have two attracted, they have two gravity wells. And, and, and then, I could have this attract stuff and this attract stuff. And then you tend to go this way. So in this case, this, this potential could represent the, the potential of two mutually orbiting planets. And there is a point just between them where you exactly balance out, but it's quite unstable if you move a little bit, you'll fall into the orbit of the other guy. I mean there's, there's lots of applications here, right? So I, you can imagine that, well instead of putting in a rotating coordinate system, so I have a planet here and I have a planet here, stuff near this planet just crashes into it. But, but, you know, there is a place where far away you'll come in and then you're just to one side and the other so you go that way. That's exactly this kind of thing. But, you know, in general, potential can represent anything. Yeah, it's also, it can be the height on the surface. Okay, okay, so I want to come back to put vector fields away a little bit. Chain rule. So we have a chain rule already, this one from the old days. And then we also, this is the one where we take the gradient and we got it with, with the, this one is just, right, so let's call this H. So here we have d dt of h of t is, who's on the other side? G. G prime f of t times, and here again it's a single variable, d dt h of t is gradient of z times the tangent. And that needs to be a dot product. And, you know, we want, more generally, we go to our M, right, a general chain rule. Now, sometimes you have to be, we just point out, you have to be, and I'm going to be, we have to be a little careful about domains sometimes. Good question? Good question. So we have to be a little careful about positions. We have to have the same kind of care, but we can have the situation where we can find on some blob here, and so this is the domain of f. This is in, so in this case this is in Rm, this is in Rm. And maybe the domain of G doesn't include that whole thing. And so G only makes sense here. So this is the image of f. And so the composition obviously only makes sense on this overlap, which means it only makes sense on part of the domain. So sometimes you have to be a little bit careful. So maybe G takes its domain on this on blob, and then this image is just going to appear. We can only make sense of the composition, right? So you have, you sometimes have to take care. I don't know. When you have more variables, it's easy to lose track of that. I just want to point out, you have to pay attention to the domain. We already have a situation where we know what the chain rule should be in this, in this set. And that's the case where, in your function, we already know how that works. So if that linear is some matrix, so let's say f of my x vector is some matrix A times x. So in this case A would need to be, who is rich, m by n is some other matrix p by n. What is df? And the chain rule is just multiply the matrices. And the composition, composition here, G of f is just, well, first I compute A of f, I compute B of that. And the derivative of this composition, so there's like nothing interesting here, of course in general. So we already saw, so in the case of linear f and G, the derivatives are just matrices. The composition just corresponds to multiplying the matrices. Nothing to do. What works in general, because we already know that the derivatives are matrices. The composition, so I need f with the mixed partials equal. Continuously different, make the partials are continuously the same thing. Continuously differentiable near x0. And I need G to be, G composed with f to be defined on some region of any, this situation where x0 is saving. The composition has one fact. And furthermore, derivative of G, I guess I want to turn it into a matrix. So I evaluated at f of x0 in the matrix C way, provided that you remember that everything inside is a matrix and you multiply matrices. And one sloppiness that you can do in single variable calculus is you can take the derivative of the inside function first and then multiply it by the derivative of the outside function that you don't necessarily work here. It may not even make sense because the dimensions may be wrong but we can't multiply the matrices together. But even if n equals m equals p, these two matrices might not work here. So it's important that we do this one first. So maybe I should do an example. And I have an example that I want to have. Oh, we do the proof first. We do the proof first. So the proof is just stupid. The proof is just write everything down. Sure enough, it works. So I guess here I'm going to put everything. So in coordinates I'm going to assume, let's see, G is x1 up to xm. So the derivative of G will be partial, not of an f. If I take that and I plug in, partial of G1, G1 with respect to y. Two different letters, df at x1 and xdf. So there's the two derivative matrices. Multiply them there. Actually I'm not going to multiply them. Let's just look at what the ij guy looks like. So if I look at the product entry, this is just a sum, right? So to get ij, I take the i-throw here and the d-throw there and I'm going to get just the sum, d and ij place is just the product of the i-throw times the j-th column. So that's just the dot product of what? Well the i-throw is the gradient of G evaluated and I'm dotting that with, so let me write that as this variable when getting this column is giving me a tangent vector in the fk in the x direction, right? This is the tangent in the direction, so this is the tangent to the curve fj being fixed in all directions above 1. This is really xj. The same we saw before. So this is of G, right? Why? Why is it fj? So that's just the partial of GI. I can never keep track. Yes, it's evaluated in general with respect to xj. That's it? Yeah. So for the general, is every gradient dotted with any tangent? Yeah. Well, every tangent in each direction, right? You have a lot of tangents. So you take each coordinate and you dot it with the tangent in that coordinate direction. But I mean it's easier just to write down. So let's do an x squared minus y squared with respect to everything in sight. So the derivative of this with respect to u is v. Derivative of this with respect to v is u. Derivative of this with respect to u is 1. Derivative of u with respect to v is 1. So there's dG, df. I take the derivative of this with respect to x is 2x. With respect to y I get 2y. With respect to x I get 2x. With respect to y I get minus 2y. And let's compute the product at a point. So let's just compute the derivative of the composition at the point 1, 2. The book does 2 1. They use the same example but they do 2 1. Okay. So what do I need? I need to first figure out what is f of 1, 2? Because I'm going to need to know what v and u are. Right? So when x is 1, y is 2, then that tells me that u is 2 and v is negative 3. F of 1, 2. Why did I get 5 before? Because it is. I can't add. 5 is 5 negative 3. Right? 2 squared is usually 4 and not 1. Okay. So let's just plug in here and see that dG at the point I care about 5 negative 3 is the matrix. Negative 3 with matrix times this matrix. So that's negative 6. Yeah, negative 6 minus 10 is 4. Yeah, I got 4 last time. Negative 6 minus 10 is 4 and negative 12 minus 20 is negative 32. 2 plus 2 is 4. 4 minus 4 is 0. Question about that? Yeah. Here? Yeah, greater for the first term in the matrix. This times this. That's the row times the column. That will be negative 6 minus negative 6 plus 10. So this is negative 6 plus 10. It's the same 4 that I wrote but that's what it is. That minus 32 is not part of it. Okay? So that's, and that's the same derivative I got in my office so that's good. It means I can do it the same way twice. It doesn't mean I can do it right. Okay. So doing this guy first and this guy second. So I can, so the composition will be dt and dy here with t equals 0. I will take, so that means that UV, if I take this plug it into that. Now of course I could just do the composition and then take the derivative but let's do it the matrixy way. Here. So I'm going to call this map, have the situation r2 is just g is here, g is on the inside. Let's do df first. 2, 2, guys I get, just 1, 1, 1. And so now when I, it's easy. Those are, yeah, much better. Let's do it in two ways. We'll take the product of those two matrices which gives me in general what dx, dt, and dy, dt are. Then I use the unvaluated matrices, dt and dy, dt, the t times 2u plus 3v square, v e to the uv, u e to the v uv, 2u plus v e to the uv. I want the wrong system. What are they? It's g times. It's like, it'll be obvious. Yeah, and did I just get them backwards? Yes. I sure did, didn't I? Yeah. Yes. So this is also wrong. Yeah. But they get the same answer. Yeah. Because it's 0.1, so it doesn't matter. Yeah, okay. That's why it doesn't make any sense. That's much better. So it gives me 2u plus 3v plus 3v e to the t and v e to the uv plus u e to the t. If you don't want to mix t's and u's, then you can plug in. That's e to the t square with u to the t, e to the u is t plus 1 plus uv, t plus, so let's move on. So any questions about the same? This is saying I have some, I think just brought in terms of boxes, so I have some box here which I apply, my inner function is f for g. I guess I do f first. And it gives me something. f is some, they're very near this point, the image here, f is some kind of, let me draw it as a, some kind of linear stretch and compress. It's a matrix. So it's some kind of linear m. Okay, so let me give you the geometric definition in one variable and then you'll see it's the same. So in one variable, intervals, some regions, and the graph with f has some slope here. Well, that's another way of saying that near this point a, so I'm just thinking about the derivative at a single point, near this point a, I can also think of f as taking, this is slope m. It takes the line and stretches it by a factor of m. I'm going to draw it just like a line. It takes a to f of a, but it takes points near a, at least on a small zero end is like two. So it's stretched by g does a similar thing. If I take my little ruler here, based at f of a, and I have my, my little ruler which has already been stretched, or maybe it hasn't been stretched. g has some derivative, so this is f prime of a. g has some derivative, so I apply g here, and it stretches by some other factor q. So here, let's say maybe it's some kind of, well I'll just stretch it again. So g prime of f of a is multiplication by some number q. So this will stretch this stretching again by another factor times q. So the composition, well if I first stretch by a factor of m, and then I stretch by a factor of q, I can just go directly stretching by a factor of m times q. Same thing happens, now here I'm not going to even bother to draw it. The same thing happens when I have, I have some grid here. I apply f to this, at least on a very small scale. f looks like multiplication by a matrix. So f, so df is some matrix A. That means on a very small scale this grid is going to be, as though I acted on it by some matrix A, just maybe going to compress and shear a little bit and get something like this. That's the action of multiplying this grid, applying A to this grid. We get it from the center spot to the center spot. If I drew a new grid here, g to it, well g is going to be just like dg is like acting by a matrix B. And so that's going to take this green grid and do something to it. Maybe it's going to, I don't know, just rotate it. So it rotates the grid. Black grid inside the green grid, it gets rotated even more and compressed like that. And the composition here, so this is, so dg is some B. The composition is just squish the thing and then turn it. If the functions aren't linear, it doesn't matter because derivatives are the linear approximations to the function. So that means as long as I look really close to this point, I can't tell the difference or I can only approximately tell the difference between the linear function which is the derivative and the actual function which is the function. So I will have a different factor at different points which is what all of this craziness is, is to account, you know, here, sorry, here I just got numbers. I just got linear maps. That's because I was looking at one point. But if I look at a different point I get a different linear map. Here I get a whole collection of linear maps, each different at different points. And you can put them all together and get some kind of a function. But I'm thinking just of acting at a point. It's linear. It does some brushing. It does some stretching. It does a little twisting. Whatever. And so the composition is just do the squishing and the stretching and then the twisting and the squishing and all of those things one after the other. So that's the geometric intuition which is exactly the same as the calculation. The calculation is just writing down how much I squished by, how much I twisted by. So far, so let's just continue that sort of a story. I mean in fact this matrix was, suppose that my matrix, let's just take a 2 by 2 case, df. I'm not talking about the chain rule at the moment. I'm just talking about a derivative. What if the derivative at some point is a singular matrix like 1, 1, well that's not the one. About 1, 0, 0, 0. So this is not, this is on a very small, I apply f or df. What's the image of that box under that matrix? It's just a line and so the x axis, the x direction is completely preserved. The y direction is the killer. So all of the stuff in the y do this line. It's singular in this direction. And of course if I put some other stuff here, so if I do something like you know 1, 1 or 1, 2 being just smashed on that line, I'll be smashed onto the line of slope 2 but still I'm smashed in some direction here. If I have more dimensions, I might be compressed in other, you know, dependent. So if the matrix is not invertible, then that means that it's going to get compressed, I'm going to lose a dimension. Maybe several dimensions, sufficient for a moment. The matrix is invertible. This picture, I can undo the action. My matrix is invertible apart from this black thing and unstretch it. This means I have an inverse matrix. So near the point P, this is exactly the same as the one variable statement that says that if y equals f of x and here x is not 0 and it's defined, then x equals f. Did the sense is inverting like analogous to integrating your depth point? No. It's finding the, it's, it's, it's so, so here, right in the one variable case, focus on the one variable case for a second. So the one variable case, I have y equals x squared. And if I choose some near x equals minus one, y equals one, I know that x is the square root negative of y. I have an inverse function. So that's what I mean by inverse. So I have y equals x squared. And so here's negative one. So here, there's a branch of the square root. This is just a function. I sort of lay on my side on the other one. So here I can take this branch of the inverse and everything's okay. I need to know which of the two pieces I'm on. But as long as I just look around here and stay away from 0, I have an inverse function. And I can write a formula for it. I can't always write a formula, but I always have an inverse as long as I stay away from the place where the derivative is 0. Notice that near, near x equals 0. So I have a problem. f prime of x equals 0. And I can't make an inverse because I don't know which side to choose. I have to take both. So plus or minus square root x, this is not a function because the derivative is 0 here. I don't have an inverse. Now maybe if the derivative is 0 I can still make stuff work because maybe if you think about the example of the cube root, I'm okay. Right? With the cube. So this is sufficient but not necessary. If my function is y equals x cubed, things are still okay. I still have the ability to take a cube root and respond. This is f. This is f inverse. I'm okay. But if the derivative is not 0, for sure everything's okay. And the analog here isn't set. If the determinant is not 0, the determinant of the derivative is not 0, wow. Okay. Sorry, I'm waving high. If the determinant of the derivative is not 0 then I have an inverse. If it is 0 probably I don't have an inverse maybe kind of sort of unless I'm lucky. So let me write that as a theorem. Be the same dimension. So this is continuously differentiable. It is continuously differentiable. Here's some point p is not 0. Then there exists some function f with p sitting in our n here and some region where f is nice. f sends it over here to f of p. So then there's some region near here where I can go back by big f which I'll call an inverse. But it seems I won't.