Flash and JavaScript are required for this feature.

Download the video from iTunes U or the Internet Archive.

**Topics covered:** Divergence theorem (cont.): applications and proof

**Instructor:** Prof. Denis Auroux

Lecture 29: Divergence Theo...

## Related Resources

Lecture Notes - Week 12 Summary (PDF)

The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make a donation or to view additional materials from hundreds of MIT courses, visit MIT OpenCourseWare at ocw.mit.edu. OK, so remember we left things with this statement of the divergence theorem. So, the divergence theorem gives us a way to compute the flux of a vector field for a closed surface. OK, it says if I have a closed surface, s, bounding some region, D, and I have a vector field defined in space, so that I can try to compute the flux of my vector field through my surface. Double integral of F.dS or F.ndS if you want, and to set this up, of course, I need to use the geometry of the surface depending on what the surface is. We've seen various formulas for how to set up the double integral. But, we've also seen that if it's a closed surface, and if a vector field is defined everywhere inside, then we can actually reduce that to a calculation of the triple integral of the divergence of F inside, OK? So, concretely, if I use coordinates, let's say that the coordinates of my vector field are, sorry, the components are P, Q, and R dot ndS, then that will become the triple integral of, well, so, divergence is P sub x plus Q sub y plus R sub z. OK, so by the way, how to remember this formula for divergence, and other formulas for other things as well. Let me just tell you quickly about the del notation. So, this guy usually pronounced as del, rather than as pointy triangle going downwards or something like that, it's a symbolic notation for an operator. So, you're probably going to complain about putting these guys into a vector. But, let's think of partial with respect to x, with respect to y, and with respect to z as the components of some formal vector. Of course, it's not a real vector. These are not like anything. These are just symbols. But, so see for example, the gradient of function, well, if you multiply this vector by scalar, which is a function, then you will get partial, partial x of f, partial, partial y of f, partial, partial z, f, well, that's the gradient. That seems to work. So now, the interesting thing about divergence is I can think of divergence as del dot a vector field. See, if I do the dot product between this guy and my vector field P, Q, R, well, it looks like I will indeed get partial, partial x of P plus partial Q partial y plus partial R partial z. That's the divergence. and of course, similarly, when we have two variables only, x and y, we could have thought of the same notation, just with a two component vector, partial, partial x, partial, partial y. So, now, this is like of slightly limited usefulness so far. It's going to become very handy pretty soon because we are going to see curl. And, the formula for curl in the plane was kind of complicated. But, if you thought about it in terms of this, it was actually the determinant of del and f. And now, in space, we are actually going to do del cross f. But, I'm getting ahead of things. So, let's not do anything with that. Curl will be for next week. Just getting you used to the notation, especially since you might be using it in physics already. So, it might be worth doing. OK, so the other thing I wanted to say is, what does this theorem say physically? How should I think of this statement? So, I think I said that very quickly at the end of last time, but not very carefully. So, what's the physical interpretation of a divergence field? So, I want to claim that the divergence of a vector field corresponds to what I'm going to call the source rate, which is somehow the amount of flux generated per unit volume. So, to understand what that means, let's think of what's called an incompressible fluid. OK, so an incompressible fluid is something like water, for example, where a fixed mass of it always occupies the same amount of volume. So, guesses are compressible. Liquids are incompressible, basically. So, if you have an incompressible fluid flow -- -- well, so, again, what that means is really, given mass occupies always a fixed volume. Then, well, let's say that we have such a fluid with velocity given by our vector field. OK, so we're thinking of F as the velocity and maybe something containing water, a pipe, or something. So, what does the divergence theorem say? It says that if I take a region in space, let's call it D, sorry, D is the inside, and S is the surface around it, well, so if I sum the divergence in D, well, I'm going to get the flux going out through this surface, S. I should have mentioned it earlier. The convention in the divergence theorem is that we orient the surface with a normal vector pointing always outwards. OK, so now, we know what flux means. Remember, we've been describing, flux means how much fluid is passing through this surface. So, that's the amount of fluid that's leaving the region, D, per unit time. And, of course, when I'm saying that, it means I'm counting everything that's going out of D minus everything that's coming into D. That's what the flux measures. So, now, if there is stuff coming into D or going out of D, well, it must come from somewhere. So, one possibility would be that your fluid is actually being compressed or expanded. But, I've said, no, I'm looking at something like water that you cannot squish into smaller volume. So, in that case, the only explanation is that there is something it here that actually is sucking up water or producing more water. And so, integrating the divergence gives you the total amount of sources minus the amount of syncs that are inside this region. So, the divergence itself measures basically the amount of sources or syncs per unit volume in a given place. And now, if you think about it that way, well, it's basically the divergence theorem is just stating something completely obvious about all the matter that is leaving this region must come from somewhere. So, that's basically how we think about it. Now, of course, if you're doing 8.02, then you might actually have seen the divergence theorem already being used for things that are more like force fields, say, electric fields and so on. Well, I'll try to say a few things about that during the last week of classes. But, then this kind of interpretation doesn't quite work. OK, any questions, generally speaking, before we move on to the proof and other applications? Yes? Oh, not the gradient. So, yeah, the divergence of F measures the amount of sources or syncs in there. Well, what makes it happen? If you want, in a way, it's this theorem. Or, in another way, if you think about it, try to look at your favorite vector fields and compute their divergence. And, if you take a vector field where maybe everything is rotating, a flow that's just rotating about some axis, then you'll find that its divergence is zero. If you, sorry? No, divergence is not equal to the gradient. Sorry, there's a dot here that maybe is not very big, but it's very important. OK, so you take the divergence of a vector field. Well, you take the gradient of a function. So, if the gradient of a function is a vector, the divergence of a vector field is a function. So, somehow these guys go back and forth between. So, I should have said, with new notations comes new responsibility. I mean, now that we have this nice, nifty notation that will let us do gradient divergence and later curl in a unified way, if you choose this notation you have to be really, really careful what you put after it because otherwise it's easy to get completely confused. OK, so divergence and gradients are completely different things. The only thing they have in common is that both are what's called a first order differential operator. That means it involves the first partial derivatives of whatever you put into it. But, one of them goes from functions to vectors. That's gradient. The other one goes from vectors to functions. That's divergence. And, curl later will go from vectors to vectors. But, that will be later. Let's see, more questions? No? OK, so let's see, so how are we going to actually prove this theorem? Well, if you remember how we prove Green's theorem a while ago, the answer is we're going to do it exactly the same way. So, if you don't remember, then I'm going to explain. OK, so the first thing we need to do is actually a simplification. So, instead of proving the divergence theorem, namely, the equality up there, I'm going to actually prove something easier. I'm going to prove that the flux of a vector field that has only a z component is actually equal to the triple integral of, well, the divergence of this is just R sub z dV. OK, now, how do I go back to the general case? Well, I will just prove the same thing for a vector field that has only an x component or only a y component. And then, I will add these things together. So, if you think carefully about what happens when you evaluate this, you will have some formula for ndS, and when you do the dot product, you'll end up with the sum, P times something plus Q times something plus R times something. And basically, we are just dealing with the last term, R times something, and showing that it's equal to what it should be. And then, we the three such terms together. We'll get the general case. OK, so then we get the general case by summing one such identity for each component. I should say three such identities, one for each component, whatever. Now, let's make a second simplification because I'm still not feeling confident I can prove this right away for any surface. I'm going to do it first or what's called a vertically simple region. OK, so vertically simple means it will be something which I can setup an integral over the z variable first easily. So, it's something that has a bottom face, and a top face, and then some vertical sides. OK, so let's say first what happens if the given region, D, is vertically simple. So, vertically simple means it looks like this. It has top. It has a bottom. And, it has some vertical sides. So, if you want, if I look at it from above, it projects to some region in the xy plane. Let's call that R. And, it lives between the top face and the bottom face. Let's say the top face is z equals z2 of (x, y). Let's say the bottom face is z equals z1(x, y). OK, and I don't need to know actual formulas. I'm just going to work with these and prove things independently of what the formulas will be for these functions. OK, so anyway, a vertically simple region is something that lives above a part of the xy plane, and is between two graphs of two functions. So, let's see what we can do in that case. So, the right-hand side of this equality, so that's the triple integral, let's start computing it. OK, so of course we will not be able to get a number out of it because we don't know, actually, formulas for anything. But at least we can start simplifying because the way this region looks like, I should say this is D, tells me that I can start setting up the triple integral at least in the order where I integrate first over z. OK, so I can actually do it as a triple integral with Rz dz dxdy or dydx, doesn't matter. So, what are the bounds on z? See, this is actually good practice to remember how we set up triple integrals. So, remember, when we did it first over z, we start by fixing a point, x and y, and for that value of x and y, we look at a small vertical slice and see from where to where we have to go. Well, we start at z equals whatever the value is at the bottom, so, z1 of x and y. And, we go up to the top face, z2 of x and y. Now, for x and y, I'm not going to actually set up bounds because I've already called R the quantity that I'm integrating. So let me change this to, let's say, U or something like that. If you already have an R, I mean, there's not much risk for confusion, but still. OK, so we're going to call U the shadow of my region instead. So, now I want to integrate over all values of x and y that are in the shadow of my region. That means it's a double integral over this region, U, which I haven't described to you. So, I can't actually set up bounds for x and y. But, I'm going to just leave it like this. OK, now you see, if you look at how you would start evaluating this, well, the inner integral certainly is not scary because you're integrating the derivative of R with respect to z, integrating that with respect to z. So, you should get R back. OK, so triple integral over D of Rz dV becomes, well, we'll have a double integral over U of, so, the inner integral becomes R at the point on the top. So, that means, remember, R is a function of x, y, and z. And, in fact, I will plug into it the value of z at the top, so, z of xy minus the value of R at the point on the bottom, x, y, z1 of x, y. OK, any questions about this? No? Is it looking vaguely believable? Yeah? OK. So, now, let's compute the other side because here we are stuck. We won't be able to do anything else. So, let's look at the flux integral. OK, we have to look at the flux of this vector field through the entire surface, S, which is the whole boundary of D. So, that consists of a lot of pieces, namely the top, bottom, and the sides. OK, so the other side -- So, let me just remind you, S is bottom plus top plus side of this vector field, dot ndS equals, OK, so what do we have? So first, we have to look at the bottom. No, let's start with the top actually. Sorry. OK, so let's start with the top. So, just remind you, let's do all of them. So, let's look at the top first. So, we need to set up the flux integral for a vector field dot ndS. We need to know what ndS is. Well, fortunately for us, we know that the top face is going to be the graph of some function of x and y. So, we've seen a formula for ndS in this kind of situation, OK? We have seen that ndS, sorry, so, just to remind you this is the graph of a function z equals z2 of x, y. So, we've seen ndS for that is negative partial derivative of this function with respect to x, negative partial z2 with respect to y, one, dxdy. OK, and, well, we can't compute these guys, but it's not a big deal because if we do the dot product with dot ndS, that will give us, well, if you dot this with zero, zero, R, these terms go away. You just have R dxdy. So, that means that the double integral for flux through the top of R vector field dot ndS becomes double integral of the top of R dxdy. Now, how do we evaluate that, actually? Well, so R is a function of x, y, z. But we said, we have only two variables that we're going to use. We're going to use x and y. We're going to get rid of z. How do we get rid of z? Well, if we are on the top surface, z is given by this formula, z2 of x, y. So, I plug z equals z2 of x, y into the formula for R, whatever it may be. Then, I integrate dxdy. And, what's the range for x and y? Well, my surface sits exactly above this region U in the xy plane. So, it's double integral over U, OK? Any questions about how I set up this flux integral? No? OK, let me close the door, actually. OK, so we've got one of the two terms that we had over there. Let's try to get the others. [LAUGHTER] No comment. OK, so, we need to look, also, at the other parts of our surface for the flux integral. So, the bottom, well, it will work pretty much the same way, right, because it's the graph of a function, z equals z1 of x, y. So, we should be able to get ndS using the same method, negative partial with respect to x, negative partial with respect to y, one dxdy. Now, there's a small catch. OK, we have to think of it carefully about orientations. So, remember, when we set up the divergence theorem, we need the normal vectors to point out of our region, which means that on the top surface, we want n pointing up. But, on the bottom face, we want n pointing down. So, in fact, we shouldn't use this formula here because that one corresponds to the other orientation. Well, we could use it and then subtract, but I was just going to say that ndS is actually the opposite of this. So, I'm going to switch all my signs. OK, that's the other side of the formula when you orient your graph with n pointing downwards. Now, if I do things the same way as before, I will get that <0,0, R> dot ndS will be negative R dxdy. And so, when I do the double integral over the bottom, I'm going to get the double integral over the bottom of negative R dxdy, which, if I try to evaluate that, well, I actually will have to integrate. Sorry, first I'll have to substitute the value of z. The value of z that I will want to plug into R will be given by, now, z1 of x, y. And, the bounds of integration will be given, again, by the shadow of our surface, which is, again, this guy, U. OK, so we seem to be all set, except we are still missing one part of our surface, S, because we also need to look at the sides. Well, what about the sides? Well, our vector field, , is actually vertical. It's parallel to the z axis. OK, so my vector field does something like this everywhere. And, why that makes it very interesting on the top and bottom, that means that on the sides, really not much is going on. No matter is passing through the vertical sides. So, the side -- The sides are vertical. So, <0,0, R> is tangent to the side, and therefore, the flux through the sides is just going to be zero. OK, no calculation needed. That's because, of course, that's the reason why a simplified first things so that my vector field would only have a z component, well, not just that but that's the main place where it becomes very useful. So, now, if I compare my double integral and, sorry, my triple integral and my flux integral, I get that they are, indeed, the same. Well, that's the statement of the theorem we are trying to prove. I shouldn't erase it, OK? [LAUGHTER] So, just to recap, we've got a formula for the triple integral of R sub z dV. It's up there at the very top. And, we got formulas for the flux through the top and the bottom, and the sides. And, when you add them together, you get indeed the same formula, top plus bottom -- -- plus sides of, OK, and so we have, actually, completed the proof for this part. Now, well, that's only for a vertically simple region, OK? So, if D is not vertically simple, what do we do? Well, we cut it into vertically simple pieces. OK so, concretely, I wanted to integrate over a solid doughnut. Then, that's not vertically simple because here in the middle, I have not only does top in this bottom, but I have this middle face. So, the way I would cut my doughnut would be probably I would slice it not in the way that you'd usually slice the doughnut or a bagel, but at it's probably more spectacular if you think that it's a bagel. Then, a mathematician's way of slicing it is like this into five pieces, OK? And, that's not very convenient for eating, but that's convenient for integrating over it because now each of these pieces has a well-defined top and bottom face, and of course you've introduced some vertical sides for two reasons. One is that we've said the flux through them is zero anyway. So, who cares? Why bother? But, also, if you sum the flux through the surface of each little piece, well, you will see that you will be integrating twice over each of these vertical cuts. Once, when you do this piece, you will be taking the flux through this red guy with normal vector pointing to the right, and once, when you take this middle little piece, you will be taking the flux through that cut surface again, but now with normal vector pointing the other way around. So, in fact, you'll be summing the flux through these guys twice with opposite orientations. They cancel out. Well, and again, because of what you are doing actually, the integral was just zero anyway. So, it didn't matter. But, even if it hadn't simplified, that would do it for us. OK, so that's how we do it with the general region. And then, as I said at the beginning, when we can do it for a vector field that has only a z component, well, we can also do it for a vector field that has only an x or only a y component. And then, we sum together and we get the general case. So, that's the end of the proof. OK, so you see, the idea is really the same as for Green's theorem. Yes? Oh, there's only four pieces, thank you. Yes, there's three kinds of mathematicians: those who know how to count, and those who don't. Well, OK. So, OK, now I hope that you can see already the interest of this theorem for the divergence theorem for computing flux integrals just for the sake of computing flux integrals like might happen on the problem set or on the next test. But let me tell you also why it's important physically to understand equations that had been observed empirically well before they were actually understood in terms of how things go. So, let's look at something called the diffusion equation. So, let me explain to you what it does. So, the diffusion equation is something that governs, well, what's called diffusion. Diffusion is when you have a fluid in which you are introducing some substance, and you want to figure out how that thing is going to spread out, the technical term is diffuse, into the ambient fluid. So, for example, that governs the motion of, say, smoke in the air, or if you put dye in the solution or things like that. That will tell you, say that you drop some ink into a glass of water. Well, you can imagine that obviously it will get diluted into there. And, that equation will tell you how exactly over time this thing is going to spread out and start filling the entire glass. So, what's the equation? Well, we need, first, to know what the unknown will be. So, it's a partial differential equation, OK? So the unknown is a function, and the equation will relate the partial derivatives of that function to each other. So, u, the unknown, will be the concentration at a given point. And, of course, that depends on the point where you are. So, that depends on x, y, z, the location where you are. But, since the goal is also to understand how things spread over time, it should also depend on time. Otherwise, we're not going to get very far. And, in fact, what the equation will give us is the derivative of u with respect to t. It will tell us how the concentration at a given point varies over time in terms of how the concentration varied in space. So, it will relate partial u partial t to partial derivatives with respect to x, y, and z. [APPLAUSE] OK, [LAUGHTER] so what's the equation? The equation is partial u partial t equals some constant. Let me call it constant k times something I will call del squared u, which is also called the Laplacian of u, and what is that? Well, that means, OK, so just to scare you, del squared is this, which means it's the divergence of gradient u that we've used this notation for gradient. OK, so if you actually expand it in terms of variables, that becomes partial u over partial x squared plus partial squared u over partial y squared plus partial squared u over partial z squared. OK, so the equation is this equals that. OK, so that's a weird looking equation. And, I'm going to have to explain to you, where does it come from? OK, but before I do that, well, let me point out actually that the equation is not just the diffusion equation. It's also known as the heat equation. And, that's because exactly the same equation governs how temperature changes over time when you have, again, so, sorry I should have been actually more careful. I should have said this is in air that's not moving, OK? OK, and same thing with the solution. If you drop some ink into your glass of water, well, if you start stirring, obviously it will mix much faster than if you don't do anything. OK, so that's the case where we don't actually, the fluid is not moving. And, the heat equation now does the same, but for temperature in a fluid that's at rest, that's not moving. It tells you how the heat goes from the warmest parts to the coldest parts, and eventually temperatures should somehow even out. So, in the heat equation, that would just be, this u would just measure the temperature for temperature of your fluid at a given point. Actually, it doesn't have to be a fluid. It could be a solid for that heat equation. So, for example, say that you have a big box made of metal or something, and you do some heating at one side. You want to know how quickly is the other side going to get hot? Well, you can use the equation to figure out, you know, say that you have a metal bar, and you keep one side at 400� because it's in your oven. How quickly will the other side get warm? OK, so it's the same equation for both phenomena even though they are, of course, different phenomena. Well, the physical reason why they're the same is actually that phenomena are different, but not all that much. They involve, actually, how the atoms and molecules are actually moving, and hitting each other inside this medium. OK, so anyway, what's the explanation for this? So, to understand the explanation, and given what we've been doing, we should have a vector field in there. So, I'm going to think of the flow of, well, let's imagine that we are doing motion of smoke in air. So, that's the flow of the smoke: that means at every point, it's a vector whose direction tells me in which direction the smoke is actually moving. And, its magnitude tells me how fast it's moving, and also what amount of smoke is moving. So, there's two things to understand. One is how the disparities in the concentration between different points causes the flow to be there, how smoke will flow from the regions where there's more smoke to the regions where there's less smoke. And, that's actually physics. But, in a way, it's also common sense. So, physics and common sense tell us that the smoke will flow from high concentration towards low concentration regions. OK, so if we think of this function, U, that measures concentration, that means we are always going to go in the direction where the concentration decreases the fastest. Well, what's that? That's negative the gradient. So, F is directed along minus gradient u. Now, how big is F going to be? Well, they are, you have to come up with some intuition for how the two are related. And, the easiest relation I can think of is that they might be just proportional. So, the steeper the differences in concentration, the faster the flow will be, or the more there will be flow. And, if you try to think about it as molecules moving in random directions, you will see it makes actually complete sense. Anyway, it should be part of your physics class, not part of what I'm telling you. So, I'm just going to accept that the flow is just proportional to the gradient of u. So, if you want, the differences between concentrations of different points are very small, then the flow will be very gentle. And, if on the other hand you have huge disparities, then things will try to even out faster. OK, so that's the first part. Now, we need to understand the second part, which is once we know how flow is going, how does that affect the concentration? If smoke is going that way, then it means the concentration here should be decreasing. And there, it should be increasing. So, that's the relation between F and partial u partial t. At that part is actually math, namely, the divergence theorem. So, let's try to understand that part more carefully. So, let's take a small piece of a small region in space, D, bounded by a surface, S. So, I want to figure out what's going on in here. So, let's look at the flux out of D through S. Well, we said that this flux would be given by double integral on S of F dot n dS. So, this flux measures how much smoke is passing through S per unit time. That's the amount of smoke through S per unit time. But now, how can I compute that differently? Well, I can compute it just by looking at the total amount of smoke in this region, and seeing how much it changes. If I'm gaining or losing smoke, it means it must be going up there. Well, unless I have a smoker in here, but that's not part of the data. So, that should be, sorry, that's the same thing as the derivative with respect to t of the total amount of smoke in the region, which is given by the triple integral of u. If I integrate the concentration of smoke, which means the amount of smoke per unit volume over d, I will get the total amount of smoke in d, except, well, let's see. This flux is counted positively if we go out of d. So, actually, it's minus the derivative. This is the amount of smoke that we are losing per unit time. OK, so now we are almost there. Well, let me actually -- Because we know yet another way to compute this guy using the divergence theorem. Right, so this part here is just common sense and thinking about what it means. The divergence theorem tells me this is also equal to the triple integral, d, of div f dV. So, what I got is that the triple integral over d of div F dV equals this derivative. Well, let's think a bit about this derivative so, see, you are integrating function over x, y, and z. And then, you are differentiating with respect to t. I claim that you can actually switch the order in which you do things. So, when we think about it, is, here, you are taking the total amount of smoke and then see how that changes over time. So, you're taking the derivative of the sum of all the small amounts of smoke everywhere. Well, that will be the sum of the derivatives of the amounts of smoke inside each little box. So, we can actually move the derivatives into the integral. So, let's see, I said minus d dt of triple integral over d udV. And, now I'm saying this is the same as the triple integral in d of du dt dv. And the reason why this is going to work is you should think of it as d dt of a sum of u of some values. You plug in the values of your points at that given time times the small volume. You sum them, and then you take the derivative. And now, you see, the derivative of this sum is the sum of the derivatives. yi, zi, t, so, if you think about what the integral measures, that's actually pretty easy. And it's because this variable here is not the same as the variables on which we are integrating. That's why we can do it. OK, so now, if we have this for any region, d. So, we have a function of x, y, z, t, and we have another function here. And whenever we integrate them anywhere, we get the same answer. Well, that must mean they're the same. Just think of what happens if you just take d to be a tiny little box. You will get roughly the value of div f at that point times the volume of the box. Or, you will get roughly the value of du dt at that point times the value of a little box. So, the values must be the same. Well, let me actually explain that a tiny bit better. So, what I get is that one over, let me divide by the volume of D, sorry. I promise, I'm done in a minute. Is the same thing as one over volume D of negative du dt, dV. So, that means the average value, OK, maybe that's the best way of telling it, the average of div f in D is equal to the average of minus partial u partial t in D. And, that's true for any region, D, not just for some regions, but for, really, any region I can think of. So, the outcome is that actually the divergence of f is equal to minus du dt. And, that's another way to think about what divergence means. The divergence, we said, is how much stuff is actually expanding, flowing out. That's how much we're losing. And so, now, if you combine this with that, you will get that du dt is minus divergence f, which is plus K del squared u. OK, so you combine this guy with that guy, and you get the diffusion equation.

## Free Downloads

### Video

- iTunes U (MP4 - 109MB)
- Internet Archive (MP4 - 109MB)

### Free Streaming

### Subtitle

- English - US (SRT)

## Welcome!

This is one of over 2,200 courses on OCW. Find materials for this course in the pages linked along the left.

**MIT OpenCourseWare** is a free & open publication of material from thousands of MIT courses, covering the entire MIT curriculum.

**No enrollment or registration.** Freely browse and use OCW materials at your own pace. There's no signup, and no start or end dates.

**Knowledge is your reward.** Use OCW to guide your own life-long learning, or to teach others. We don't offer credit or certification for using OCW.

**Made for sharing**. Download files for later. Send to friends and colleagues. Modify, remix, and reuse (just remember to cite OCW as the source.)

Learn more at Get Started with MIT OpenCourseWare