# Multivariable Calculus: Line Integrals

## Line Integrals

**Transcript:** The other thing is the last lecture before the break ended a bit abruptly because I ran out of time, so just to summarize what the main point was, I mean probably you figured this out if you looked at the notes. It is not that important, but anyway. I just wanted to remind you, just to clarify what happened at the end, we got the diffusion equation from two bits of information. I mean the unknown, in this partial differential equation, is a function that we call u that corresponds to the concentration of some substance. And we used a vector field that represents the flow of whatever the substance is whose diffusion we are studying.

And so we got two bits of information, one that came from physics that said the flow goes from high concentration to smaller concentration. And that told us that the flow is proportional to a negative gradient of a concentration. And the second piece of information that we got was from the divergence theorem, and that was the one I spent time trying to explain. And that one told us that the divergence of F is actually negative partial u over partial t. When you combine these two relations together that is how you get the diffusion equation. Sorry, I should say this is not the statement of a divergence theorem.

This is something that would derive from it with quite a few steps involved. And so what we got out of that is a diffusion equation because we end up getting that partial u over partial t is minus div F, which is therefore positive k times divergence of grad u, which is what we denoted by del square u, the Laplacian. So, that is how we got the diffusion equation. Anyway, I will let you have a look at the notes that were handed out in case you really want to see more. I just wanted to give the missing part of the last lecture. Let me just switch gears completely and switch to today's topic, which is line integrals and work in 3D.

That is going to look a lot like what we did in the plane, except, of course, there is a z coordinate. You will see it doesn't change things much when it comes to computing a line integral. It changes things quite a bit, however, when it comes to testing whether a field is a gradient field. That is why we have to be more careful. Let's start right away with line integrals in space. Let's say that we have a vector field F with components P, Q and R. We should think of it maybe as representing a force.

And let's say that we have a curve C in space. Then the work done by the field will be the line integral along C of F dot dr. That is a familiar formula. And what we do with that formula is also familiar, except now, of course, we have a z coordinate. We are going to think of vector dr as a space vector with components dx, dy and dz. When we do the dot product of F with dr that will tell us that we have to integrate Pdx Qdy Rdz. But it is still a line integral so it is still going to turn into a single integral when you plug in the correct values.

So the method will be exactly the same as in the plane, namely we will find some way to parameterize our curve, x plus x, y z in terms of a single variable, and then we will integrate with respect to that variable. The way that we evaluate is by parameterizing C and express x, y, z, dx, dy, dz in terms of the parameter. Let's do an example just to convince you that you actually know how to do this, or at least you should know how to do this.

Let's say that I give you the vector field with components yz, xz and xy. And let's say that we have a curve given by x equals t^3, y equals t^2, z equals t for t going from zero to one. The way we will set up the line integral for the work done will be -- Well, sorry. Before we actually set up the line integral, we need to know how we will express everything in terms of t and dt. x, y and z, in terms of t, are given here. We just need to do also dx, dy and dz. By differentiating you get dx is 3t^2 dt. That is the derivative of t^3, dy will be 2t dt and dz will just be dt.

And we will evaluate the line integral for work. That will be the integral of yz dx xz dy xy dz, which will become -- yz is t^3 times dx is 3t^2 dt plus xz is t^4 times dy is 2t dt plus xy is t^5 dt. That just becomes the integral from, well, I guess t goes from zero to one, actually. And we are integrating three plus two plus one. That is 6t^5 dt which, I am sure you know, integrates to t^6, so we will just get one. It is the same method as usual. And if you are being given a geometric description of a curve then, of course, you will have to decide for yourself what the best parameter will be.

It might be some time parameter t like here. It might be one of the coordinates. Here we could have used z as our parameter because, in fact, this curve is x equals x3 and y equals z2. And we could also have used maybe some angle. Well, not here, but if we had been moving on a circle or something like that. Any questions so far? No. OK. Well, because we can do a bit more practice, let's do another one where we do the same vector field F but our curve C will be going from the origin to the point (1, 0, 0) along the x-axis. Let's call that C1. Then to (1, 1, 0). Let's call that C2 by moving parallel to the y-axis. And then up to (1, 1, 1) parallel to the z-axis, let's call that C3.

I am sure that some of you at least are suspecting what I am getting at here, but let's not spoil it for those who don't see it yet. OK. If we want to compute the line integral along this guy then we have to break it into a sum of three terms. Well, maybe I should call that C', not C, because that is not the same C anymore. I want to do the sum of the line integrals along C1, C2 and C3. And, well, if I look at C1 and C2 they take place inside the x, y plane.

In fact, you know that z will be zero and dz will also be zero on both of these. And if you just look at the formula for line integral in the role of yz dx plus xz dy plus xy dz, well, it looks like if you plug z equals zero and dz equals zero you will just get zero. These are actually very fast. Let me write it. This is going to be zero, this is going to be zero, this is going to zero, and we will get zero. Now, if we do C3, well, there we might have to do some calculation, but it won't be all that bad.

C3, well, x and y are both equal to one. And, of course, because they are constant that means dx is zero and dy is zero. On the other hand, z varies from zero to one. If I look at the line integral on C3 -- The first two terms, yz, dx and xz dy go away because the dx and dy are zero, so I am just left with xy dz. But because x and y are one it is just the integral of dz from zero to one, and that will just end up being one. If add these numbers together, zero plus zero plus one, I get one again.

And, of course, it is not a coincidence because this vector field is a gradient field. I am sure some of you have already figured out what it is the gradient of. Otherwise, we will figure it out together. And so that is why we get the same answer for these two paths going both from the origin to (1, 1, 1). Maybe I should point out, to make it clear, that if you plug t equals zero in up there you will get (0, 0, 0).

If you plug t equals one, you will get (1, 1, 1). In fact -- F that we have here happens to be conservative. And, if you plug the two curves together -- Well, I am not really sure if I know how to plot this correctly. It is not exactly how it looks. Whatever. The first curve C goes from the origin to this point, and so does C ', just in a slightly more roundabout way. They both go from the origin to (1, 1, 1). It is not a surprise that you will get the same answer for both line integrals.

And how do we see that? Well, actually here it is not very hard to find a function whose gradient is this vector field. Namely, the gradient of x, y, z looks like it should be exactly what we want. If you take partial of this with respect to x, you will get yz, then with respect to y, xz, and with respect to z, xy. And so, in fact, what was the easier way to compute these line integrals was to use the fundamental theorem of calculus.

Once we have this remark, we don't need to compute these line integrals anymore. We can just use the fundamental theorem. If we know this fundamental theorem -- -- for line integrals, that tells us that the line integral of a gradient field is equal to the value of the potential at the final point minus the value of the potential at the starting point. And that, of course, only applies if you have a potential.

So, in particular, only if you have a conservative field, a gradient field. Here, in our example, we have to look at, let's call little f of x, y, z that potential xyz, then we take f(1, 1, 1) - f(0, 0, 0). And that indeed is one minus zero which is one. Everything is consistent. All this stuff so far works exactly as in the plane. Any questions? No. OK. Let's try to see where things do get a little bit different.

And the first such place is when we try to test whether a vector field is a gradient field. Remember when we had a vector field in the plane, to know whether it was a gradient of a function of two variables we just had to check one condition, N sub x equals M sub y. Now we actually have three different conditions to check, and that means, of course, more work. OK. So what is our test for gradient fields? We want to know whether a given vector field with components P, Q and R can be written as f sub x, f sub y and f sub z for a same function F. And for that to possibly happen, well, we need certainly some relations between P, Q and R. And, as before, this comes from the fact that the mixed second derivatives are the same, no matter in which order you take them.

If that is the case then I can compute f sub xy, which is the same as f sub yx in two different ways. F sub xy should be P sub y. F sub yx, well, since f sub y is Q, that should be Q sub x. That is a part of a criterion that we already had when we had only two variables. But now, of course, we need to do the same thing when we look at x and z or y and z. That gives us two more conditions. P sub z is f sub xz, which is the same as f sub zx, so it should be the same as R sub x.

Finally, Q sub z, which is f sub yz, equals f sub zy equals R sub y. We have three conditions, so our criterion -- Vector field F equals

. And here, to be completely truthful, I have to say defined in a simply connected region. Otherwise, we might have the same kind of strange things happening as before. Let's not worry too much about it. For accuracy we need our vector field to be defined in a simply connected region. And example is just if it is defined everywhere. If you don't have any evil eliminators then you can just go ahead and there is no problem. It is a gradient field.

We need three conditions. Let's do it in order. P sub y equals Q sub x. And we have P sub z equals R sub x and Q sub z equals R sub y. How do you remember these three conditions? Well, it is pretty easy. You pick any two components, say the x and the z component, and you take the partial of the x component with respect to z, the partial of the z component with respect to x and you must make them equal. And the same with every pair of variables.

In fact, if you had a function of many more variables the criterion would still look exactly like that. For every pair of components the mixed partials must be the same. But we are not going to go beyond three variables so you don't need to know that. This you need to know so let me box it. That is pretty straightforward. Let's do an example just to see how it goes. By the way, we can also think of it in terms of differentials.

Before I do the example, let me just say in a different language. If we have a differential given to us of a form Pdx Qdy Rdz is going to be an exact differential, which means it is equal to df for some function F exactly and of the same conditions. That is the same thing. Just in the language of differentials. The example that I promised. Of course, I could do again the same one over there and check that it satisfies the condition, but then it wouldn't be much fun. So let's do a better one. Actually, let's do it in a way that looks like an exam problem. Let's say for which a and b is a xy dx plus --

Oh, it is not going to fit here. But it will fit here. a xy dx ( x^2 z^3) dy (byz^2 - 4z^3) dz, an exact differential. Or, if you don't like exact differentials, for which a and b is the corresponding vector field with i, j and k instead, a gradient field. Let's just apply the criterion. And, of course, you can guess that what will follow is figuring out how to find the potential when there is one.

Let's do it one by one. We want to compare P sub y with Q sub x, we want to compare P sub z with R sub x and we want to compare Q sub z with R sub y where we call P, Q and R these guys. Let's see. What is P sub y? That seems to be ax. What is Q sub x? 2x. Q is this one. Actually, let me write them down. Because otherwise I am going to get confused myself. This guy here, that is P, this guy here, that is Q and that guy here, that is R. This one tells us that a should be equal to two of the first product that you hold. OK.

Let's look at P sub z. That is just zero. R sub x? Well, R doesn't have any x either so that is zero. This one is not a problem. Q sub z? Well, that seems to be 3z2. R sub y seems to be bz2, so b should be equal to three. We need to have a equals two and, this is an and, not or, b equals three for this to be exact. For those values of a and b, we can look for a potential using the method that we are going to see right now. For any other values of a and b we cannot. If we have to compute a line integral, we have to do it by finding a parameter and setting up everything. Any questions at this point? Yes?

I see. Well, if I got the same answer, oh, did say bz^2 or 3bz^2? Well, 3bz^2, for example, I would need b to be zero because the only time that 3bz2 equals bz2 as not just at one point but everywhere, I need them to be the same function of x, y, z. Well, if a coefficient of z2 is the same that would be give b equals 3b, that would give me b equals zero. If you got bz2 on both sides then it would mean for any value of b it works, and you wouldn't have to worry about what the value of b is. Any other questions? No. OK. Now, how do we find the potential?

Well, there are two methods as before. One of them, I don't remember if it was the first one or the second one last time, but it really doesn't matter. One of them was just to say that the value of F at the point, let me call that x1, y1, z1, is equal to the line integral of my field along a well-chosen curve plus, of course, a constant, which is going to be the integration constant. And the kind of curve that I will take to do this calculation will just be my favorite curve going from the origin to the point x1, y1, z1.

And so, typically the most common choice would be to go just first along the x-axis, then parallel to the y-axis and then parallel to the z-axis all the way to my point x1, y1, z1. I would just calculate three easy line integrals. Add them together and that would give me the value of my function. That method works exactly the same way as it did in two variables. Now, I seem to recall that you guys mostly preferred the other method. I am going to tell you about the other method as well, but I just want to point out this one actually doesn't become more complicated. The other one has actually more steps.

I mean, of course, here there are also a bit more steps because you have three parts to your path instead of two. You have three line integrals to compute instead of two, but conceptually it remains exactly the same idea. I should say it works the same way as in 2D. Not much changes. Let's look at the other method using anti-derivatives. Remember we want to find a function little f whose partials are exactly the things we have been given. We want to solve, well, let me plug in the values of a and b that will work. We said a should be two, so f sub x should be 2xy, f sub y should be x2 plus z3, and f sub z should be 3yz^2 minus 4z^3.

We are going to look at them one at a time and get partial information on the function. And then we will compare with the others to get more information until we are completely done. The first thing we will do, we know that f sub x is 2xy. That should tell us something about f. Well, let's just integrate that with respect to x. Let me write integral dx next to that. That tells us that f should be, well, if we integrate that with respect to x, 2x integrates to x^2, so we should get x2y.

Plus, of course, an integration constant. Now, what do we mean by integration constant. It means that for given values of y and z we will get a term that does not depend on x. It still depends on y and z. In fact, what we get is a function of y and z. See, if you took the derivative of this with respect to x you will get 2xy and this guy will go away because there is no x in it. That is the first step. Now we need to get some information on g. How do we do that? Well, we look at the other partials. F sub y, we want that to be x^2 z^3. But we have another way to find it, which is starting from this and differentiating.

Let me try to use color for this. Now, if I take the partial of this with respect to y, I am going to get a different formula for f sub y. That will be x^2 plus g sub y. Well, if I compare these two expressions that tells me that g sub y should be z3. Now, if I have this I can integrate with respect to y. That will tell me that g is actually yz^3 plus an integration constant. That constant, again, does not depend on y, but it can still depend on z because we still have not said anything about partial with respect to z.

In fact, that constant I will write as a function h of z. If I have this function of z and I take its partial with respect to y, I will still get z^3 no matter what h was. Now, how do I find h? Well, obviously, I have to look at f sub z. F sub z. We know from the given vector field that we want it to be 3yz^2 minus 4z^3. In case you are wondering where that came from, that was R. But that is also obtained by differentiating with respect to z what we had so far. Sorry. What did we have so far?

Well, we had f equals x^2y plus g. And we said g is actually yz^3 plus h of z. That is what we have so far. If we take the derivative of that with respect to z, we will get zero plus 3yz^2 plus h prime of z, or dh dz as you want. Now, if we compare these two, we will get the derivative of h. It will tell us that h prime is negative for z3. That means that h is negative z^4 plus a constant. And this it is at last an actual constant.

Because it does not depend on z and there is nothing else for it to depend on. Now we plug this into what we had before, and that will give us our function f. We get that f=x^2y yz^3 - z^4 plus constant. If you just wanted to find one potential, you can just forget the constant. This guy was a potential. If you want all the potentials they differ by this constant. OK. Just to recap the method what did we do? We started with --

And, of course, you can do it in whichever order you prefer, but you have to still follow the systematic method. You start with f sub x and you integrate that with respect to x. That gives you f up to a function of y and z only. Now you compare f sub y as given to you by the vector field with the formula you get from this expression for f. And, of course, this one will involve g sub y. Out of this, you will get the value of g sub y. When you have g sub y that gives you g up to a function of z only.

And so now you have f up to a function of z only. And what you will do is look at the derivative with respect to z, the one you want coming from the vector field and the one you have coming from this formula for f, match them and that will tell you h prime. You will get h and then you will get f. Any questions? Who still prefers this method? OK, still most of you. Who is thinking that maybe the other method was not so bad after all? OK. That is still a minority. You can choose whichever one you prefer. I would encourage you to get some practice by trying both on least a couple of examples just to make sure that you know how to do them both and then stick to whichever one you prefer.

Any questions on that? No. I guess I already asked. Still no questions? OK. The next logical thing is going to be curl. And the theorem that is going to replace Green's theorem for work in this setting is going to be called Stokes' theorem. Let me start by telling you about curl in 3D. Here is the statement. The curl is just going to measure how much your vector field fails to be conservative. And, if you want to think about it in terms of motions, that also will measure the rotation part of the motion.

Well, let me first give a definition. Let's say that my vector field has components P, Q and R. Then we define the curl of F to be R sub y minus Q sub z times i plus P sub z minus R sub x times j plus Q sub x minus P sub y times k. And of course nobody can remember this formula, so what is the structure of this formula? Well, you see, each of these guys is one of the things that have to be zero for our field to be conservative.

If F is defined in a simply connected region then we have that F is conservative and is equivalent to if and only if curl F is zero. Now, an important difference between curl here and curl in the plane is that now the curl of a vector field is again a vector field. These expressions are functions of x, y, z and together you form a vector out of them. The curl of a vector field in space is actually a vector field, not a scalar function. I have delayed the inevitable.

I have to really tell you how to remember this evil formula. The secret is that, in fact, you can think of this as del cross f. Maybe you have seen that in physics. This is really where this del notation becomes extremely useful, because that is basically the only way to remember the formula for curl. Remember we introduced the dell operator. That was this symbolic vector operator in which the components are the partial derivative operators.

We have seen that if you apply this to a scalar function then that will give you the gradient. And we have seen that if you do the dot product between dell and a vector field, maybe I should give it components P, Q and R, you will get partial P over partial x plus partial Q over partial y plus partial R over partial z, which is the divergence. And so now what is new is that if I try to do dell cross F, well, what is dell cross F? I have to set up a cross-product between this strange thing that is not really a vector. I mean, I cannot really think of partial over partial x as a number. And my vector field

. See, that is really a completely perverted use of a determinant notation.

Initially, determinants were just supposed to be you had a three by three table of numbers and you computed a number out of them. These guys are functions so they count as numbers, but these are vectors and these are partial derivatives. It doesn't really make much sense, except this notation. If you try to enter this into a calculator or computer, it will just yell back at you saying are you crazy. [LAUGHTER]

We just use that as a notation to remember what is in there. Let's try and see how that works. The component of i in this cross-product, remember that is this smaller determinant, that smaller determinant is partial over partial y of R minus partial over partial z of Q, the coefficient of i. And that seems to be what I had over there. If not then I made a mistake. Minus the next determinant times z. Remember there is always a minus sign in front of a j component when you do a cross-product. The other one is partial over partial x R minus partial over partial z of P plus the component of z which is going to be partial over partial x Q minus partial over partial y P. And that is indeed going to be the curl of F.

In practice, if you have to compute the curl of a vector field, you know, don't try to remember this formula. Just set up this cross-product with whatever formulas you have for the components of a field and then compute it. Don't bother to try to remember the general formula, just remember this. What is the geometric interpretation of curl, just to finish? In a way, I will say just curl measures the rotation component in a velocity field.

An exercise that you can do, which is actually pretty easy to check, is say that we have a fluid that is just rotating about the x-axis uniformly. Your fluid is just rotating like that about the z-axis. If I take a rotation about the z-axis. That is given by a velocity field with components at angular velocity omega. That will be negative omega times y, then omega x and zero. And the curl of that you can compute, and you will find two omega times k.

Concretely, this curl gives you the angular velocity of the rotation, well, with a factor two but that doesn't matter, and the axis of rotation, the direction of the axis of rotation. It tells you it is rotating about a vertical axis. And, in general, if you have a complicated motion some of it might be, you know, there is a translation. And then within that translation there is maybe expansion and rotation and sharing and everything. And the curl will compute how much rotation is taking place.

It will tell you, say that you have a very small solid, I don't know like a ping pong ball in your flow, and it is just going with the flow, it tells you how it is going to start rotating. That is what curl measures. On Thursday we will see Stokes' theorem, which will be the last ingredient before the next exam. And then on Friday we will review stuff.