# Multivariable Calculus: Path Independence

## Path Independence

**Transcript:** So, let me remind you, yesterday we've defined and started to compute line integrals for work as a vector field along a curve. So, we have a curve in the plane, C. We have a vector field that gives us a vector at every point. And, we want to find the work done along the curve. So, that's the line integral along C of F dr, or more geometrically, line integral along C of F.T ds where T is the unit tangent vector,

and ds is the arc length element. Or, in coordinates, that they integral of M dx N dy where M and N are the components of the vector field. OK, so -- Let's do an example that will just summarize what we did yesterday, and then we will move on to interesting observations about these things. So, here's an example we are going to look at now. Let's say I give you the vector field yi plus xj. So, it's not completely obvious what it looks like, but here is a computer plot of that vector field.

So, that tells you a bit what it does. It points in all sorts of directions. And, let's say we want to find the work done by this vector field. If I move along this closed curve, I start at the origin. But, I moved along the x-axis to one. That move along the unit circle to the diagonal, and then I move back to the origin in a straight line. OK, so C consists of three parts -- -- so that you enclose a sector of a unit disk -- -- corresponding to angles between zero and 45°.

So, to compute this line integral, all we have to do is we have set up three different integrals and add that together. OK, so we need to set up the integral of y dx plus x dy for each of these pieces. So, let's do the first one on the x-axis. Well, one way to parameterize that is just use the x variable. And, say that because we are on the, let's see, sorry, we are going from the origin to (1,0).

Well, we know we are on the x-axis. So, y there is actually just zero. And, the variable will be x from zero to one. Or, if you prefer, you can parameterize things, say, x equals t for t from zero to one, and y equals zero. What doesn't change is y is zero, and therefore, dy is also zero. So, in fact, we are integrating y dx x dy, but that becomes, well, zero dx 0, and that's just going to give you zero.

OK, so there's the line integral. Here, it's very easy to compute. Of course, you can also do it geometrically because geometrically, you can see in the picture along the x-axis, the vector field is pointing vertically. If I'm on the x-axis, my vector field is actually in the y direction. So, it's perpendicular to my curve. So, the work done is going to be zero. F dot T will be zero. OK, so F dot T is zero, so the integral is zero.

OK, any questions about this first part of the calculation? No? It's OK? OK, let's move on to more interesting part of it. Let's do the second part, which is a portion of the unit circle. OK, so I should have drawn my picture. And so now we are moving on this part of the curve that's C2. And, of course we have to choose how to express x and y in terms of a single variable. Well, most likely, when you are moving on a circle, you are going to use the angle along the circle to tell you where you are.

OK, so we're going to use the angle theta as a parameter. And we will say, we are on the unit circle. So, x is cosine theta and y is sine theta. What's the range of theta? Theta goes from zero to pi over four, OK? So, whenever I see dx, I will replace it by, well, the derivative of cosine is negative sine. So, minus sine theta d theta, and dy, the derivative of sine is cosine. So, it will become cosine theta d theta.

OK, so I'm computing the integral of y dx x dy. That means -- -- I'll be actually computing the integral of, so, y is sine theta. dx, that's negative sine theta d theta plus x cosine. dy is cosine theta d theta from zero to pi/4. OK, so that's integral from zero to pi / 4 of cosine squared minus sine squared. And, if you know your trig, then you should recognize this as cosine of two theta. OK, so that will integrate to one half of sine two theta from zero to pi over four, sorry.

And, sine pi over two is one. So, you will get one half. OK, any questions about this one? No? OK, then let's do the third one. So, the third guy is when we come back to the origin along the diagonal. OK, so we go in a straight line from this point. Where's this point? Well, this point is one over root two, one over root two. And, we go back to the origin. OK, so we need to figure out a way to express x and y in terms of the same parameter.

So, one way which is very natural would be to just say, well, let's say we move from here to here over time. And, at time zero, we are here. At time one, we are here. We know how to parameterize this line. So, what we could do is say, let's parameterize this line. So, we start at one over root two, and we go down by one over root two in time one. And, same with y. That's actually perfectly fine.

But that's unnecessarily complicated. OK, why is a complicated? Because we will get all of these expressions. It would be easier to actually just look at motion in this direction and then say, well, if we have a certain work if we move from here to here, then the work done moving from here to here is just going to be the opposite, OK? So, in fact, we can do slightly better by just saying, well, we'll take x = t, y = t.

t from zero to one over root two, and take, well, sorry, that gives us what I will call minus C3, which is C3 backwards. And then we can say the integral for work along minus C3 is the opposite of the work along C3. Or, if you're comfortable with integration where variables go down, then you could also say that t just goes from one over square root of two down to zero. And, when you set up your integral, it will go from one over root two to zero.

And, of course, that will be the negative of the one from zero to one over root two. So, it's the same thing. OK, so if we do it with this parameterization, we'll get that, well of course, dx is dt, dy is dt. So, the integral along minus C3 of y dx plus x dy is just the integral from zero to one over root two of t dt plus t dt. Sorry, I'm messing up my blackboard, OK, which is going to be, well, the integral of 2t dt, which is t2 between these bounds, which is one half.

That's the integral along minus C3, along the reversed path. And, if I want to do it along C3 instead, then I just take the negative. Or, if you prefer, you could have done it directly with integral from one over root two, two zero, which gives you immediately the negative one half. OK, so at the end, we get that the total work -- -- was the sum of the three line integrals. I'm not writing after dr just to save space.

But, zero plus one half minus one half, and that comes out to zero. So, a lot of calculations for nothing. OK, so that should give you overview of various ways to compute line integrals. Any questions about all that? No? OK. So, next, let me tell you about how to avoid computing like integrals. Well, one is easy: don't take this class. But that's not, so here's another way not to do it, OK?

So, let's look a little bit about one kind of vector field that actually we've encountered a few weeks ago without saying it. So, we said when we have a function of two variables, we have the gradient vector. Well, at the time, it was just a vector. But, that vector depended on x and y. So, in fact, it's a vector field. OK, so here's an interesting special case. Say that F, our vector field is actually the gradient of some function.

So, it's a gradient field. And, so f is a function of two variables, x and y, and that's called the potential for the vector field. The reason is, of course, from physics. In physics, you call potential, electrical potential or gravitational potential, the potential energy. This function of position that tells you how much actually energy stored somehow by the force field, and this gradient gives you the force.

Actually, not quite. If you are a physicist, that the force will be negative the gradient. So, that means that physicists' potentials are the opposite of a mathematician's potential. Okay? So it's just here to confuse you. It doesn't really matter all the time. So to make things simpler we are using this convention and you just put a minus sign if you are doing physics. So then I claim that we can simplify the evaluation of the line integral for work.

Perhaps you've seen in physics, the work done by, say, the electrical force, is actually given by the change in the value of a potential from the starting point of the ending point, or same for gravitational force. So, these are special cases of what's called the fundamental theorem of calculus for line integrals. So, the fundamental theorem of calculus, not for line integrals, tells you if you integrate a derivative, then you get back the function.

And here, it's the same thing in multivariable calculus. It tells you, if you take the line integral of the gradient of a function, what you get back is the function. OK, so -- -- the fundamental theorem of calculus for line integrals -- -- says if you integrate a vector field that's the gradient of a function along a curve, let's say that you have a curve that goes from some starting point, P0,

to some ending point, P1. All you will get is the value of F at P1 minus the value of F at P0. OK, so, that's a pretty nifty formula that only works if the field that you are integrating is a gradient. You know it's a gradient, and you know the function, little f. I mean, we can't put just any vector field in here. We have to put the gradient of F. So, actually on Tuesday we'll see how to decide whether a vector field is a gradient or not,

and if it is a gradient, how to find the potential function. So, we'll cover that. But, for now we need to try to figure out a bit more about this, what it says, what it means physically, how to think of it geometrically, and so on. So, maybe I should say, if you're trying to write this in coordinates, because that's also a useful way to think about it, if I give you the line integral along C,

so, the gradient field, the components are f sub x and f sub y. So, it means I'm actually integrating f sub x dx plus f sub y dy. Or, if you prefer, that's the same thing as actually integrating df. So, I'm integrating the differential of a function, f. Well then, that's the change in F. And, of course, if you write it in this form, then probably it's quite obvious to you that this should be true.

I mean, in this form, actually it's the same statement as in single variable calculus. OK, and actually that's how we prove the theorem. So, let's prove this theorem. How do we prove it? Well, let's say I give you a curve and I ask you to compute this integral. How will you do that? Well, the way you compute the integral actually is by choosing a parameter, and expressing everything in terms of that parameter.

So, we'll set, well, so we know it's f sub x dx plus f sub y dy. And, we'll want to parameterize C in the form x equals x of t. y equals y of t. So, if we do that, then dx becomes x prime of t dt. dy becomes y prime of t dt. So, we know x is x of t. That tells us dx is x prime of t dt. y is y of t gives us dy is y prime of t dt. So, now what we are integrating actually becomes the integral of f sub x times dx dt plus f sub y times dy dt times dt.

OK, but now, here I recognize a familiar guy. I've seen this one before in the chain rule. OK, this guy, by the chain rule, is the rate of change of f if I take x and y to be functions of t. And, I plug those into f. So, in fact, what I'm integrating is df dt when I think of f as a function of t by just plugging x and y as functions of t. And so maybe actually I should now say I have sometimes t goes from some initial time, let's say, t zero to t one.

And now, by the usual fundamental theorem of calculus, I know that this will be just the change in the value of f between t zero and t one. OK, so integral from t zero to one of (df /dt) dt, well, that becomes f between t zero and t one. f of what? We just have to be a little bit careful here. Well, it's not quite f of t. It's f seen as a function of t by putting x of t and y of t into it.

So, let me read that carefully. What I'm integrating to is f of x of t and y of t. Does that sound fair? Yeah, and so, when I plug in t1, I get the point where I am at time t1. That's the endpoint of my curve. When I plug t0, I will get the starting point of my curve, p0. And, that's the end of the proof. It wasn't that hard, see? OK, so let's see an example. Well, let's look at that example again.

So, we have this curve. We have this vector field. Could it be that, by accident, that vector field was a gradient field? So, remember, our vector field was y, x. Can we think of a function whose derivative with respect to x is y, and derivative with respect to y is x? Yeah, x times y sounds like a good candidate where f( x, y) is xy. OK, so that means that the line integrals that we computed along these things can be just evaluated from just finding out the values of f at the endpoint?

So, here's version two of my plot where I've added the contour plot of a function, x, y on top of the vector field. Actually, they have a vector field is still pointing perpendicular to the level curves that we have seen, just to remind you. And, so now, when we move, now when we move, the origin is on the level curve, f equals zero. And, when we start going along C1, we stay on f equals zero.

So, there's no work. The potential doesn't change. Then on C2, the potential increases from zero to one half. The work is one half. And then, on C3, we go back down from one half to zero. The work is negative one half. See, that was much easier than computing. So, for example, the integral along C2 is actually just, so, C2 goes from one zero to one over root two, one over root two. So, that's one half minus zero, and that's one half, OK, because C2 was going here.

And, at this point, f is zero. At that point, f is one half. And, similarly for the others, and of course when you sum, you get zero because the total change in f when you go from here, to here, to here, to here, eventually you are back at the same place. So, f hasn't changed. OK, so that's a neat trick. And it's important conceptually because a lot of the forces are gradients of potentials, namely, gravitational force, electric force.

The problem is not every vector field is a gradient. A lot of vector fields are not gradients. For example, magnetic fields certainly are not gradients. So -- -- a big warning: everything today only applies if F is a gradient field. OK, it's not true otherwise. OK, still, let's see, what are the consequences of the fundamental theorem? So, just to put one more time this disclaimer, if F is a gradient field -- -- then what do we have?

Well, there's various nice features of work done by gradient fields that are not too far off the vector fields. So, one of them is this property of path independence. OK, so the claim is if I have a line integral to compute, that it doesn't matter which path I take as long as it goes from point a to point b. It just depends on the point where I start and the point where I end. And, that's certainly false in general, but for a gradient field that works.

So if I have a point, P0, a point, P1, and I have two different paths that go there, say, C1 and C2, so they go from the same point to the same point but in different ways, then in this situation, the line integral along C1 is equal to the line integral along C2. Well, actually, let me insist that this is only for gradient fields by putting gradient F in here, just so you don't get tempted to ever use this for a field that's not a gradient field -- -- if C1 and C2 have the same start and end point.

OK, how do you prove that? Well, it's very easy. We just use the fundamental theorem. It tells us, if you compute the line integral along C1, it's just F at this point minus F at this point. If you do it for C2, well, the same. So, they are the same. And for that you don't actually even need to know what little f is. You know in advance that it's going to be the same. So, if I give you a vector field and I tell you it's the gradient of mysterious function but I don't tell you what the function is and you don't want to find out,

you can still use path independence, but only if you know it's a gradient. OK, I guess this one is dead. So, that will stay here forever because nobody is tall enough to erase it. When you come back next year and you still see that formula, you'll see. Yes, but there's no useful information here. That's a good point. OK, so what's another consequence? So, if you have a gradient field, it's what's called conservative.

OK, so what a conservative field? Well, the word conservative comes from the idea in physics; if the conservation of energy. It tells you that you cannot get energy for free out of your force field. So, what it means is that in particular, if you take a closed trajectory, so a trajectory that goes from some point back to the same point, so, if C is a closed curve, then the work done along C -- -- is zero.

OK, that's the definition of what it means to be conservative. If I take any closed curve, the work will always be zero. On the contrary, not conservative means somewhere there is a curve along which the work is not zero. If you find a curve where the work is zero, that's not enough to say it's conservative. You have show that no matter what curve I give you, if it's a closed curve, it will always be zero.

So, what that means concretely is if you have a force field that conservative, then you cannot build somehow some perpetual motion out of it. You can't build something that will just keep going just powered by that force because that force is actually not providing any energy. After you've gone one loop around, nothings happened from the point of view of the energy provided by that force. There's no work coming from the force,

while if you have a force field that's not conservative than you can try to actually maybe find a loop where the work would be positive. And then, you know, that thing will just keep running. So actually, if you just look at magnetic fields and transformers or power adapters, and things like that, you precisely extract energy from the magnetic field. Of course, I mean, you actually have to take some power supply to maintain the magnetic fields.

But, so a magnetic field, you could actually try to get energy from it almost for free. A gravitational field or an electric field, you can't. OK, so and now why does that hold? Well, if I have a gradient field, then if I try to compute this line integral, I know it will be the value of the function at the end point minus the value at the starting point. But, they are the same. So, the value is the same.

So, if I have a gradient field, and I do the line integral, then I will get f at the endpoint minus f at the starting point. But, they're the same point, so that's zero. OK, so just to reinforce my warning that not every field is a gradient field, let's look again at our favorite vector field from yesterday. So, our favorite vector field yesterday was negative y and x. It's a vector field that just rotates around the origin counterclockwise.

Well, we said, say you take just the unit circle -- -- for example, counterclockwise. Well, remember we said yesterday that the line integral of F dr, maybe I should say F dot T ds now, because the vector field is tangent to the circle. So, on the unit circle, F is tangent to the curve. And so, F dot T is length F times, well, length T. But, T is a unit vector. So, it's length F. And, the length of F on the unit circle was just one.

So, that's the integral of 1 ds. So, it's just the length of the circle that's 2 pi. And 2 pi is definitely not zero. So, this vector field is not conservative. And so, now we know actually it's not the gradient of anything because if it were a gradient, then it would be conservative and it's not. So, it's an example of a vector field that is not conservative. It's not path independent either by the way because,

see, if I go from here to here along the upper half circle or along the lower half circle, in one case I will get pi. In the other case I will get negative pi. I don't get the same answer, and so on, and so on. It just fails to have all of these properties. So, maybe I will write that down. It's not conservative, not path independent. It's not a gradient. It doesn't have any of these properties.

OK, any questions? Yes? How do you determine whether something is a gradient or not? Well, that's what we will see on Tuesday. Yes? Is it possible that it's conservative and not path independent, or vice versa? The answer is no; these two properties are equivalent, and we are going to see that right now. At least that's the plan. OK, yes? Let's see, so you said if it's not path independent, then we cannot draw level curves that are perpendicular to it at every point.

I wouldn't necessarily go that far. You might be able to draw curves that are perpendicular to it. But they won't be the level curves of a function for which this is the gradient. I mean, you might still have, you know, if you take, say, take his gradient field and scale it that in strange ways, you know, multiply by two in some places, by one in other places, by five and some other places,

you will get something that won't be conservative anymore. And it will still be perpendicular to the curves. So, it's more subtle than that, but certainly if it's not conservative then it's not a gradient, and you cannot do what we said. And how to decide whether it is or not, they'll be Tuesday's topic. So, for now, I just want to figure out again actually, let's now state all these properties -- Actually, let me first do one minute of physics.

So, let me just tell you again what's the physics in here. So, it's a force field is the gradient of a potential -- -- so, I'll still keep my plus signs. So, maybe I should say this is minus physics. [LAUGHTER] So, the work of F is the change in value of potential from one endpoint to the other endpoint. [PAUSE ] And -- -- so, you know, you might know about gravitational fields, or electrical -- -- fields versus gravitational -- -- or electrical potential.

And, in case you haven't done any 8.02 yet, electrical potential is also commonly known as voltage. It's the one that makes it hurt when you stick your fingers into the socket. [LAUGHTER] Don't try it. OK, and so now, conservativeness means no energy can be extracted for free -- -- from the field. You can't just have, you know, a particle moving in that field and going on in definitely, faster and faster, or if there's actually friction,

then keep moving. So, total energy is conserved. And, I guess, that's why we call that conservative. OK, so let's end with the recap of various equivalent properties. OK, so the first property that I will have for a vector field is that it's conservative. So, to say that a vector field with conservative means that the line integral is zero along any closed curve. Maybe to clarify, sorry, along all closed curves, OK, every closed curve;

give me any closed curve, I get zero. So, now I claim this is the same thing as a second property, which is that the line integral of F is path independent. OK, so that means if I have two paths with the same endpoint, then I will get always the same answer. Why is that equivalent? Well, let's say that I am path independent. If I am path independent, then if I take a closed curve, well, it has the same endpoints as just the curve that doesn't move at all.

So, path independence tells me instead of going all around, I could just stay where I am. And then, the work would just be zero. So, if I path independent, tonight conservative. Conversely, let's say that I'm just conservative and I want to check path independence. Well, so I have two points, and then I had to paths between that. I want to show that the work is the same. Well, how I do that?

C1 and C2, well, I observe that if I do C1 minus C2, I get a closed path. If I go first from here to here, and then back along that one, I get a closed path. So, if I am conservative, I should get zero. But, if I get zero on C1 minus C2, it means that the work on C1 and the work on C2 are the same. See, so it's the same. It's just a different way to think about the situation. More things that are equivalent, I have two more things to say.

The third one, it's equivalent to F being a gradient field. OK, so this is equivalent to the third property. F is a gradient field. Why? Well, if we know that it's a gradient field, that we've seen that we get these properties out of the fundamental theorem. The question is, if I have a conservative, or path independent vector field, why is it the gradient of something? OK, so this way is a fundamental theorem.

That way, well, so that actually, let me just say that will be how we find the potential. So, how do we find potential? Well, let's say that I know the value of my potential here. Actually, I get to choose what it is. Remember, in physics, the potential is defined up to adding or subtracting a constant. What matters is only the change in potential. So, let's say I know my potential here and I want to know my potential here.

What do I do? Well, I take my favorite particle and I move it from here to here. And, I look at the work done. And that tells me how much potential has changed. So, that tells me what the potential should be here. And, this does not depend on my choice of path because I've assumed that I'm path independence. So, that's who we will do on Tuesday. And, let me just state the fourth property that's the same.

So, all that stuff is the same as also four. If I look at M dx N dy is what's called an exact differential. So, what that means, an exact differential, means that it can be put in the form df for some function, f, and just reformulating this thing, right, because I'm saying I can just put it in the form f sub x dx plus f sub y dy, which means my vector field was a gradient field. So, these things are really the same.

OK, so after the weekend, on Tuesday we will actually figure out how to decide whether these things hold or not, and how to find the potential.