# Multivariable Calculus: Green's Theorem

## Green's Theorem

Transcript: OK, so last time we've seen the curl of the vector field with components M and N. We defined that to be N sub x minus M sub y. And, we said this measures how far that vector field is from being conservative. If the curl is zero, and if the field is defined everywhere, then it's going to be conservative. And so, when I take the line integral along a closed curve, I don't have to compute it. I notes going to be zero.

But now, let's say that I have a general vector field. So, the curl will not be zero. And, I still want to compute the line integral along a closed curve. Well, I could compute it directly or there's another way. And that's what we are going to see today. So, say that I have a closed curve, C, and I want to find the work. So, there's two options. One is direct calculation, and the other one is Green's theorem.

So, Green's theorem is another way to avoid calculating line integrals if we don't want to. OK, so what does it say? It says if C is a closed curve enclosing a region R in the plane, and I have to insist C should go counterclockwise. And, if I have a vector field that's defined and differentiable everywhere not only on the curve, C, which is what I need to define the line integral, but also on the region inside.

Then -- -- the line integral for the work done along C is actually equal to a double integral over the region inside of curl F dA. OK, so that's the conclusion. And, if you want me to write it in coordinates, maybe I should do that. So, the line integral in terms of the components, that's the integral of M dx plus N dy. And, the curl is (Nx-My)dA. OK, so that's the other way to state it. So, that's a really strange statement if you think about it because the left-hand side is a line integral.

OK, so the way we compute it is we take this expression Mdx Ndy and we parameterize the curve. We express x and y in terms of some variable, t, maybe, or whatever you want to call it. And then, you'll do a one variable integral over t. This right-hand side here, it's a double integral, dA. So, we do it the way that we learn how to couple of weeks ago. You take your region, you slice it in the x direction or in the y direction,

and you integrate dx dy after setting up the bounds carefully, or maybe in polar coordinates r dr d theta. But, see, the way you compute these things is completely different. This one on the left-hand side lives only on the curve, while the right-hand side lives everywhere in this region inside. So, here, x and y are related, they live on the curve. Here, x and y are independent. There just are some bounds between them.

And, of course, what you're integrating is different. It's a line integral for work. Here, it's a double integral of some function of x and y. So, it's a very perplexing statement at first. But, it's a very powerful tool. So, we're going to try to see how it works concretely, what it says, what are the consequences, how we could convince ourselves that, yes, this works, and so on. That's going to be the topic for today.

Any questions about the statement first? No? OK, yeah, one remark, sorry. So, here, it stays counterclockwise. What if I have a curve that goes clockwise? Well, you could just take the negative, and integrate counterclockwise. Why does the theorem choose counterclockwise over clockwise? How doesn't know that it's counterclockwise rather than clockwise? Well, the answer is basically in our convention for curl.

See, we've said curl is Nx minus My, and not the other way around. And, that's a convention as well. So, somehow, the two conventions match with each other. That's the best answer I can give you. So, if you met somebody from a different planet, they might have Green's theorem with the opposite conventions, with curves going clockwise, and the curl defined the other way around. Probably if you met an alien, I'm not sure if you would be discussing Green's theorem first, but just in case.

OK, so that being said, there is a warning here which is that this is only for closed curves. OK, so if I give you a curve that's not closed, and I tell you, well, compute the line integral, then you have to do it by hand. You have to parameterize the curve. Or, if you really don't like that line integral, you could close the path by adding some other line integral to it, and then compute using Green's theorem.

But, you can't use Green's theorem directly if the curve is not closed. OK, so let's do a quick example. So, let's say that I give you C, the circle of radius one, centered at the point (2,0). So, it's out here. That's my curve, C. And, let's say that I do it counterclockwise so that it will match with the statement of the theorem. And, let's say that I want you to compute the line integral along C of ye^(-x) dx plus (one half of x squared minus e^(-x)) dy.

And, that's a kind of sadistic example, but maybe I'll ask you to do that. So, how would you do it directly? Well, to do it directly you would have to parameterize this curve. So that would probably involve setting x equals two plus cosine theta y equals sine theta. But, I'm using as parameter of the angle around the circle, it's like the unit circle, the usual ones that shifted by two in the x direction.

And then, I would set dx equals minus sine theta d theta. I would set dy equals cosine theta d theta. And, I will substitute, and I will integrate from zero to 2pi. And, I would probably run into a bit of trouble because I would have these e to the minus x, which would give me something that I really don't want to integrate. So, instead of doing that, which looks pretty much doomed, instead, I'm going to use Green's theorem.

So, using Green's theorem, the way we'll do it is I will, instead, compute a double integral. So, I will -- -- compute the double integral over the region inside of curl F dA. So, I should say probably what F was. So, let's call this M. Let's call this N. And, then I will actually just choose the form coordinates, (Nx minus My) dA. And, what is R here? Well, R is the disk in here. OK, so, of course, it might not be that pleasant because we'll also have to set up this double integral.

And, for that, we'll have to figure out a way to slice this region nicely. We could do it dx dy. We could do it dy dx. Or, maybe we will want to actually make a change of variables to first shift this to the origin, you know, change x to x minus two and then switch to polar coordinates. Well, let's see what happens later. OK, so what is, so this is R. So, what is N sub x? Well, N sub x is x plus e to the minus x minus, what is M sub y, e to the minus x, OK?

This is Nx. This is My dA. Well, it seems to simplify a bit. I will just get double integral over R of x dA, which looks certainly a lot more pleasant. Of course, I made up the example in that way so that it simplifies when you use Green's theorem. But, you know, it gives you an example where you can turn are really hard line integral into an easier double integral. Now, how do we compute that double integral?

Well, so one way would be to set it up. Or, let's actually be a bit smarter and observe that this is actually the area of the region R, times the x coordinate of its center of mass. If I look at the definition of the center of mass, it's the average value of x. So, it's one over the area times the double integral of x dA, well, possibly with the density, but here I'm thinking uniform density one.

And, now, I think I know just by looking at the picture where the center of mass of this circle will be, right? I mean, it would be right in the middle. So, that is two, if you want, by symmetry. And, the area of the guy is just pi because it's a disk of radius one. So, I will just get 2pi. I mean, of course, if you didn't see that, then you can also compute that double integral directly. It's a nice exercise.

But see, here, using geometry helps you to actually streamline the calculation. OK, any questions? Yes? OK, yes, let me just repeat the last part. So, I said we had to compute the double integral of x dA over this region here, which is a disk of radius one, centered at, this point is (2,0). So, instead of setting up the integral with bounds and integrating dx dy or dy dx or in polar coordinates,

I'm just going to say, well, let's remember the definition of a center of mass. It's the average value of a function, x in the region. So, it's one over the area of origin times the double integral of x dA. If you look, again, at the definition of x bar, it's one over area of double integral x dA. Well, maybe if there's a density, then it's one over mass times double integral of x density dA.

But, if density is one, then it just becomes this. So, switching the area, moving the area to the other side, I'll get double integral of x dA is the area of origin times the x coordinate of the center of mass. The area of origin is pi because it's a unit disk. And, the center of mass is the center of a disk. So, its x bar is two, and I get 2 pi. OK, that I didn't actually have to do this in my example today, but of course that would be good review.

It will remind you of center of mass and all that. OK, any other questions? No? OK, so let's see, now that we've seen how to use it practice, how to avoid calculating the line integral if we don't want to. Let's try to convince ourselves that this theorem makes sense. OK, so, well, let's start with an easy case where we should be able to know the answer to both sides. So let's look at the special case.

Let's look at the case where curl F is zero. Then, well, we'd like to conclude that F is conservative. That's what we said. Well let's see what happens. So, Green's theorem says that if I have a closed curve, then the line integral of F is equal to the double integral of curl on the region inside. And, if the curl is zero, then I will be integrating zero. I will get zero. OK, so this is actually how you prove that if your vector field has curve zero, then it's conservative.

OK, so in particular, if you have a vector field that's defined everywhere the plane, then you take any closed curve. Well, you will get that the line integral will be zero. Straightly speaking, that will only work here if the curve goes counterclockwise. But otherwise, just look at the various loops that it makes, and orient each of them counterclockwise and sum things together. So let me state that again.

So, OK, so a consequence of Green's theorem is that if F is defined everywhere in the plane -- -- and the curl of F is zero everywhere, then F is conservative. And so, this actually is the input we needed to justify our criterion. The test that we saw last time saying, well, to check if something is a gradient field if it's conservative, we just have to compute the curl and check whether it's zero.

OK, so how do we prove that now carefully? Well, you just take a closed curve in the plane. You switch the orientation if needed so it becomes counterclockwise. And then you look at the region inside. And then you know that the line integral inside will be equal to the double integral of curl, which is the double integral of zero. Therefore, that's zero. But see, OK, so now let's say that we try to do that for the vector field that was on your problems that was not defined at the origin.

So if you've done the problem sets and found the same answers that I did, then you will have found that this vector field had curve zero everywhere. But still it wasn't conservative because if you went around the unit circle, then you got a line integral that was 2pi. Or, if you compared the two halves, you got different answers for two parts that go from the same point to the same point. So, it fails this property but that's because it's not defined everywhere.

So, what goes wrong with this argument? Well, if I take the vector field that was in the problem set, and if I do things, say that I look at the unit circle. That's a closed curve. So, I would like to use Green's theorem. Green's theorem would tell me the line integral along this loop is equal to the double integral of curl over this region here, the unit disk. And, of course the curl is zero, well, except at the origin.

At the origin, the vector field is not defined. You cannot take the derivatives, and the curl is not defined. And somehow that messes things up. You cannot apply Green's theorem to the vector field. So, you cannot apply Green's theorem to the vector field on problem set eight problem two when C encloses the origin. And so, that's why this guy, even though it has curl zero, is not conservative.

There's no contradiction. And somehow, you have to imagine that, well, the curl here is really not defined. But somehow it becomes infinite so that when you do the double integral, you actually get 2 pi instead of zero. I mean, that doesn't make any sense, of course, but that's one way to think about it. OK, any questions? Yes? Well, though actually it's not defined because the curl is zero everywhere else.

So, if a curl was well defined at the origin, you would try to, then, take the double integral. no matter what value you put for a function, if you have a function that's zero everywhere except at the origin, and some other value at the origin, the integral is still zero. So, it's worse than that. It's not only that you can't compute it, it's that is not defined. OK, anyway, that's like a slightly pathological example.

Yes? Well, we wouldn't be able to because the curl is not defined at the origin. So, you can actually integrate it. OK, so that's the problem. I mean, if you try to integrate, we've said everywhere where it's defined, the curl is zero. So, what you would be integrating would be zero. But, that doesn't work because at the origin it's not defined. Yes? Ah, so if you take a curve that makes a figure 8, then indeed my proof over there is false.

So, I kind of tricked you. It's not actually correct. So, if the curve does a figure 8, then what you do is you would actually cut it into its two halves. And for each of them, you will apply Green's theorem. And then, you'd still get, if a curl is zero then this line integral is zero. That one is also zero. So this one is zero. OK, small details that you don't really need to worry too much about,

but indeed if you want to be careful with details then my proof is not quite complete. But the computation is still true. Let's move on. So, I want to tell you how to prove Green's theorem because it's such a strange formula that where can it come from possibly? I mean, so let me remind you first of all the statement we want to prove is that the line integral along a closed curve of Mdx plus Ndy is equal to the double integral over the region inside of (Nx minus My)dA.

And, let's simplify our lives a bit by proving easier statements. So actually, the first observation will actually prove something easier, namely, that the line integral, let's see, of Mdx along a closed curve is equal to the double integral over the region inside of minus M sub y dA. OK, so that's the special case where N is zero, where you have only an x component for your vector field.

Now, why is that good enough? Well, the claim is if I can prove this, I claim you will be able to do the same thing to prove the other case where there is only the y component. And then, if the other together, you will get the general case. So, let me explain. OK, so a similar argument which I will not do, to save time, will show, so actually it's just the same thing but switching the roles of x and y,

that if I integrate along a closed curve N dy, then I'll get the double integral of N sub x dA. And so, now if I have proved these two formulas separately, then if you sum them together will get the correct statement. Let me write it. We get Green's theorem. OK, so we've simplified our task a little bit. We'll just be trying to prove the case where there's only an x component. So, let's do it.

Well, we have another problem which is the region that we are looking at, the curve that we're looking at might be very complicated. If I give you, let's say I give you, I don't know, a curve that does something like this. Well, it will be kind of tricky to set up a double integral over the region inside. So maybe we first want to look at curves that are simpler, that will actually allow us to set up the double integral easily.

So, the second observation, so that was the first observation. The second observation is that we can decompose R into simpler regions. So what do I mean by that? Well, let's say that I have a region and I'm going to cut it into two. So, I'll have R1 and R2. And then, of course, I need to have the curves that go around them. So, I had my initial curve, C, was going around everybody. They have curves C1 that goes around R1, and C2 goes around R2.

OK, so, what I would like to say is if we can prove that the statement is true, so let's see, for C1 and also for C2 -- -- then I claim we can prove the statement for C. How do we do that? Well, we just add these two equalities together. OK, why does that work? There's something fishy going on because C1 and C2 have this piece here in the middle. That's not there in C. So, if you add the line integral along C1 and C2, you get these unwanted pieces.

But, the good news is actually you go twice through that edge in the middle. See, it appears once in C1 going up, and once in C2 going down. So, in fact, when you will do the work, when you will sum the work, you will add these two guys together. They will cancel. OK, so the line integral along C will be, then, it will be the sum of the line integrals on C1 and C2. And, that will equal, therefore, the double integral over R1 plus the double integral over R2, which is the double integral over R of negative My.

OK and the reason for this equality here is because we go twice through the inner part. What do I want to say? Along the boundary between R1 and R2 -- -- with opposite orientations. So, the extra things cancel out. OK, so that means I just need to look at smaller pieces if that makes my life easier. So, now, will make my life easy? Well, let's say that I have a curve like that. Well, I guess I should really draw a pumpkin or something like that because it would be more seasonal.

But, well, I don't really know how to draw a pumpkin. OK, so what I will do is I will cut this into smaller regions for which I have a well-defined lower and upper boundary so that I will be able to set up a double integral, dy dx, easily. So, a region like this I will actually cut it here and here into five smaller pieces so that each small piece will let me set up the double integral, dy dx.

OK, so we'll cut R in to what I will call vertically simple -- -- regions. So, what's a vertically simple region? That's a region that's given by looking at x between a and b for some values of a and b. And, for each value of x, y is between some function of x and some other function of x. OK, so for example, this guy is vertically simple. See, x runs from this value of x to that value of x.

And, for each x, y goes between this value to that value. And, same with each of these. OK, so now we are down to the main step that we have to do, which is to prove this identity if C is, sorry, if -- -- if R is vertically simple -- -- and C is the boundary of R going counterclockwise. OK, so let's look at how we would do it. So, we said vertically simple region looks like x goes between a and b, and y goes between two values that are given by functions of x.

OK, so this is y equals f2 of x. This is y equals f1 of x. This is a. This is b. Our region is this thing in here. So, let's compute both sides. And, when I say compute, of course we will not get numbers because we don't know what M is. We don't know what f1 and f2 are. But, I claim we should be able to simplify things a bit. So, let's start with the line integral. How do I compute the line integral along the curve that goes all around here?

Well, it looks like there will be four pieces. OK, so we actually have four things to compute, C1, C2, C3, and C4. OK? Well, let's start with C1. So, if we integrate on C1 Mdx, how do we do that? Well, we know that on C1, y is given by a function of x. So, we can just get rid of y and express everything in terms of x. OK, so, we know y is f1 of x, and x goes from a to b. So, that will be the integral from a to b of, well, I have to take the function, M.

And so, M depends normally on x and y. Maybe I should put x and y here. And then, I will plug y equals f1 of x dx. And, then I have a single variable integral. And that's what I have to compute. Of course, I cannot compute it here because I don't know what this is. So, it has to stay this way. OK, next one. The integral along C2, well, let's think for a second. On C2, x equals b. It's constant.

So, dx is zero, and you would integrate, actually, above a variable, y. But, well, we don't have a y component. See, this is the reason why we made the first observation. We got rid of the other term because it's simplifies our life here. So, we just get zero. OK, just looking quickly ahead, there's another one that would be zero as well, right? Which one? Yeah, C4. This one gives me zero.

What about C3? Well, C3 will look a lot like C1. So, we're going to use the same kind of thing that we did with C. OK, so along C3, well, let's see, so on C3, y is a function of x, again. And so we are using as our variable x, but now x goes down from b to a. So, it will be the integral from b to a of M of (x and f2 of x) dx. Or, if you prefer, that's negative integral from a to b of M of (x and f2 of x) dx.

OK, so now if I sum all these pieces together, I get that the line integral along the closed curve is the integral from a to b of M(x1f1 of x) dx minus the integral from a to b of M(x1f2 of x) dx. So, that's the left hand side. Next, I should try to look at my double integral and see if I can make it equal to that. So, let's look at the other guy, double integral over R of negative MydA. Well, first, I'll take the minus sign out.

It will make my life a little bit easier. And second, so I said I will try to set this up in the way that's the most efficient. And, my choice of this kind of region means that it's easier to set up dy dx, right? So, if I set it up dy dx, then I know for a given value of x, y goes from f1 of x to f2 of x. And, x goes from a to b, right? Is that OK with everyone? OK, so now if I compute the inner integral, well, what do I get if I get partial M partial y with respect to y?

I'll get M back, OK? So -- So, I will get M at the point x f2 of x minus M at the point x f1 of x. And so, this becomes the integral from a to b. I guess that was a minus sign, of M of (x1f2 of x) minus M of (x1f1 of x) dx. And so, that's the same as up there. And so, that's the end of the proof because we've checked that for this special case, when we have only an x component and a vertically simple region, things work.

Then, we can remove the assumption that things are vertically simple using this second observation. We can just glue the various pieces together, and prove it for any region. Then, we do same thing with the y component. That's the first observation. When we add things together, we get Green's theorem in its full generality. OK, so let me finish with a cool example. So, there's one place in real life where Green's theorem used to be extremely useful.

I say used to because computers have actually made that obsolete. But, so let me show you a picture of this device. This is called a planimeter. And what it does is it measures areas. So, it used to be that when you were an experimental scientist, you would run your chemical or biological experiment or whatever. And, you would have all of these recording devices. And, the data would go, well, not onto a floppy disk or hard disk or whatever because you didn't have those at the time.

You didn't have a computer in your lab. They would go onto a piece of graph paper. So, you would have your graph paper, and you would have some curve on it. And, very often, you wanted to know, what's the total amount of product that you have synthesized, or whatever the question might be. It might relate with the area under your curve. So, you'd say, oh, it's easy. Let's just integrate, except you don't have a function.

You can put that into calculator. The next thing you could do is, well, let's count the little squares. But, if you've seen a piece of graph paper, that's kind of time-consuming. So, people invented these things called planimeters. It's something where there is a really heavy thing based at one corner, and there's a lot of dials and gauges and everything. And, there's one arm that you move. And so, what you do is you take the moving arm and you just slide it all around your curve.

And, you look at one of the dials. And, suddenly what comes, as you go around, it gives you complete garbage. But when you come back here, that dial suddenly gives you the value of the area of this region. So, how does it work? This gadget never knows about the region inside because you don't take it all over here. You only take it along the curve. So, what it does actually is it computes a line integral.

OK, so it has this system of wheels and everything that compute for you the line integral along C of, well, it depends on the model. But some of them compute the line integral of x dy. Some of them compute different line integrals. But, they compute some line integral, OK? And, now, if you apply Green's theorem, you see that when you have a counterclockwise curve, this will be just the area of the region inside.

And so, that's how it works. I mean, of course, now you use a computer and it does the sums. Yes? That costs several thousand dollars, possibly more. So, that's why I didn't bring one.