# Multivariable Calculus: Double Integrals

## Double Integrals

**Transcript:** So, basically the last few weeks, we've been doing derivatives. Now, we're going to integrals. So -- OK, so more precisely, we are going to be talking about double integrals. OK, so just to motivate the notion, let me just remind you that when you have a function of one variable -- -- say, f of x, and you take its integrals from, say, a to b of f of x dx, well, that corresponds to the area below the graph of f over the interval from a to b.

OK, so the picture is something like you have a; you have b. You have the graph of f, and then what the integral measures is the area of this region. And, when we say the area of this region, of course, if f is positive, that's what happens. If f is negative, then we count negatively the area below the x axis. OK, so, now, when you have a function of two variables, then you can try to do the same thing. Namely, you can plot its graph. Its graph will be a surface in space. And then, we can try to look for the volume below the graph. And that's what we will call the double integral of the function over a certain region.

OK, so let's say that we have a function of two variables, x and y. Then, we'll look at the volume that's below the graph z equals f of xy. OK, so, let's draw a picture for what this means. I have a function of x and y. I can draw its graph. The graph will be the surface with equation z equals f of x and y. And, well, I have to decide where I will integrate the function. So, for that, I will choose some region in the xy plane.

And, I will integrate the function on that region. So, it's over a region, R, in the xy plane. So, I have this region R and I look at the piece of the graph that is above this region. And, we'll try to compute the volume of this solid here. OK, that's what the double integral will measure. So, we'll call that the double integral of our region, R, of f of xy dA and I will have to explain what the notation means. So, dA here stands for a piece of area. A stands for area. And, well, it's a double integral. So, that's why we have two integral signs.

And, we'll have to indicate somehow the region over which we are integrating. OK, we'll come up with more concrete notations when we see how to actually compute these things. That's the basic definition. OK, so actually, how do we define it, that's not really much of a definition yet. How do we actually define this rigorously? Well, remember, the integral in one variable, you probably saw a definition where you take your integral from a to b, and you cut it into little pieces.

And then, for each little piece, you take the value of a function, and you multiply by the width of a piece. That gives you a rectangular slice, and then you sum all of these rectangular slices together. So, here we'll do the same thing. So, well, let me put a picture up and explain what it does. So, we're going to cut our origin into little pieces, say, little rectangles or actually anything we want.

And then, for each piece, with the small area, delta A, we'll take the area delta a times the value of a function in there that will give us the volume of a small box that sits under the graph. And then, we'll add all these boxes together. That gives us an estimate of a volume. And then, to get actually the integral, the integral will be defined as a limit as we subdivide into smaller and smaller boxes, and we sum more and more pieces, OK?

So, actually, what we do, oh, I still have a board here. So, the actual definition involves cutting R into small pieces of area that's called delta A or maybe delta Ai, the area of the i'th piece. And then, OK, so maybe in the xy plane, we have our region, and we'll cut it may be using some grade. OK, and then we'll have each small piece. Each small piece will have area delta Ai and it will be at some point, let's call it xi, yi ... yi, xi.

And then, we'll consider the sum over all the pieces of f at that point, xi, yi times the area of a small piece. So, what that corresponds to in the three-dimensional picture is just I sum the volumes of all of these little columns that sit under the graph. OK, and then, so what I do is actually I take the limit as the size of the pieces tends to zero. So, I have more and more smaller and smaller pieces.

And, that gives me the double integral. OK, so that's not a very good sentence, but whatever. So, OK, so that's the definition. Of course, we will have to see how to compute it. We don't actually compute it. When you compute an integral in single variable calculus, you don't do that. You don't cut into little pieces and sum the pieces together. You've learned how to integrate functions using various formulas, and similarly here, we'll learn how to actually compute these things without doing that cutting into small pieces.

OK, any questions first about the concept, or what the definition is? Yes? Well, so we'll have to learn which tricks work, and how exactly. But, so what we'll do actually is we'll reduce the calculation of a double integral to two calculations of single integrals. And so, for V, certainly, all the tricks you've learned in single variable calculus will come in handy. OK, so, yeah that's a strong suggestion that if you've forgotten everything about single variable calculus, now would be a good time to actually brush up on integrals. The usual integrals, and the usual substitution tricks and easy trig in particular, these would be very useful. OK, so, yeah, how do we compute these things?

That's what we would have to come up with. And, well, going back to what we did with derivatives, to understand variations of functions and derivatives, what we did was really we took slices parallel to an axis or another one. So, in fact, here, the key is also the same. So, what we are going to do is instead of cutting into a lot of small boxes like that and summing completely at random, we will actually somehow scan through our region by parallel planes, OK?

So, let me put up, actually, a slightly different picture up here. So, what I'm going to do is I'm going to take planes, say in this picture, parallel to the yz plane. I'll take a moving plane that scans from the back to the front or from the front to the back. So, that means I set the value of x, and I look at the slice, x equals x0, and then I will do that for all values of x0. So, now in each slice, well, I get what looks a lot like a single variable integral. OK, and that integral will tell me, what is the area in this? Well, I guess it's supposed to be green, but it all comes as black, so, let's say the black shaded slice. And then, when I add all of these areas together, as the value of x changes, I will get the volume. OK, let me try to explain that again.

So, to compute this integral, what we do is actually we take slices. So, let's consider, let's call s of x the area of a slice, well, by a plane parallel to the yz plane. OK, so on the picture, s of x is just the area of this thing in the vertical wall. Now, if you sum all of these, well, why does that work? So, if you take the origin between two parallel slices that are very close to each other, what's the volume in these two things?

Well, it's essentially s of x times the thickness of this very thin slice, and the thickness would be delta x0 dx if you take a limit with more and more slices. OK, so the volume will be the integral of s of x dx from, well, what should be the range for x? Well, we would have to start at the very lowest value of x that ever happens in our origin, and we'd have to go all the way to the very largest value of x, from the very far back to the very far front. So, in this picture, we probably start over here at the back, and we'd end over here at the front.

So, let me just say from the minimum, x, to the maximum x. And now, how do we find S of x? Well, S of x will be actually again an integral. But now, it's an integral of the variable, y, because when we look at this slice, what changes from left to right is y. So, well let me actually write that down. For a given, x, the area S of x you can compute as an integral of f of x, y dy. OK, well, now x is a constant, and y will be the variable of integration. What's the range for y? Well, it's from the leftmost point here to the rightmost point here on the given slice.

So, there is a big catch here. That's a very important thing to remember. What is the range of integration? The range of integration for y depends actually on x. See, if I take the slice that's pictured on that diagram, then the range for y goes all the way from the very left to the very right. But, if I take a slice that, say, near the very front, then in fact, only a very small segment of it will be in my region.

So, the range of values for y will be much less. Let me actually draw a 2D picture for that. So, remember, we fix x, so, sorry, so we fix a value of x. OK, and for a given value of x, what we will do is we'll slice our graph by this plane parallel to the yz plane. So, now we mention the graph is sitting above that. OK, that's the region R. We have the region, R, and I have the graph of a function above this region, R. And, I'm trying to find the area between this segment and the graph above it in this vertical plane. Well, to do that, I have to integrate from y going from here to here.

I want the area of a piece that sits above this red segment. And, so in particular, the endpoints, the extreme values for y depend on x because, see, if I slice here instead, well, my bounds for y will be smaller. OK, so now, if I put the two things together, what I will get -- -- is actually a formula where I have to integrate -- -- over x -- -- an integral over y. OK, and so this is called an iterated integral because we iterate twice the process of taking an integral.

OK, so again, what's important to realize here, I mean, I'm going to say that several times over the next few days but that's because it's the single most important thing to remember about double integrals, the bounds here are just going to be numbers, OK, because the question I'm asking myself here is, what is the first value of x by which I might want to slice, and what is the last value of x? Which range of x do I want to look at to take my red slices? And, the answer is I would go all the way from here, that's my first slice, to somewhere here.

That's my last slice. For any value in between these, I will have some red segment, and I will want to integrate over that that. On the other hand here, the bounds will depend on the outer variable, x, because at a fixed value of x, what the values of y will be depends on x in general. OK, so I think we should do lots of examples to convince ourselves and see how it works. Yeah, it's called an iterated integral because first we integrated over y, and then we integrate again over x, OK? So, we can do that, well, I mean, y depends on x or x depends, no, actually x and y vary independently of each other inside here. What is more complicated is how the bounds on y depend on x.

But actually, you could also do the other way around: first integrate over x, and then over y, and then the bounds for x will depend on y. We'll see that on an example. Yes? So, for y, I'm using the range of values for y that corresponds to the given value of x, OK? Remember, this is just like a plot in the xy plane. Above that, we have the graph. Maybe I should draw a picture here instead. For a given value of x, so that's a given slice, I have a range of values for y, that is, from this picture at the leftmost point on that slice to the rightmost point on that slice. So, where start and where I stop depends on the value of x. Does that make sense? OK.

OK, no more questions? OK, so let's do our first example. So, let's say that we want to integrate the function 1-x^2-y^2 over the region defined by x between 0 and 1, and y between 0 and 1. So, what does that mean geometrically? Well, z = 1-x^2-y^2, and it's a variation on, actually I think we plotted that one, right? That was our first example of a function of two variables possibly. And, so, we saw that the graph is this paraboloid pointing downwards. OK, it's what you get by taking a parabola and rotating it.

And now, what we are asking is, what is the volume between the paraboloid and the xy plane over the square of side one in the xy plane over the square of side one in the xy plane, x and y between zero and one. OK, so, what we'll do is we'll, so, see, here I try to represent the square. And, we'll just sum the areas of the slices as, say, x varies from zero to one. And here, of course, setting up the bounds will be easy because no matter what x I take, y still goes from zero to one. See, it's easiest to do double integrals what the region is just a rectangle on the xy plane because then you don't have to worry too much about what are the ranges. OK, so let's do it. Well, that would be the integral from zero to one of the integral from zero to one of 1-x^2-y^2 dy dx.

So, I'm dropping the parentheses. But, if you still want to see them, I'm going to put that in very thin so that you see what it means. But, actually, the convention is we won't put this parentheses in there anymore. OK, so what this means is first I will integrate 1-x^2-y^2 over y, ranging from zero to one with x held fixed. So, what that represents is the area in this slice. So, see here, I've drawn, well, what happens is actually the function takes positive and negative values. So, in fact, I will be counting positively this part of the area. And, I will be counting negatively this part of the area, I mean, as usual when I do an integral.

OK, so what I will do to evaluate this, I will first do what's called the inner integral. So, to do the inner integral, well, it's pretty easy. How do I integrate this? Well, it becomes, so, what's the integral of one? It's y. Just anything to remember is we are integrating this with respect to y, not to x. The integral of x^2 is x^2 times y. And, the integral of y^2 is y^3 over 3. OK, and that we plug in the bounds, which are zero and one in this case. And so, when you plug y equals one, you will get one minus x^2 minus one third minus, well, for y equals zero you get 0, 0, 0, so nothing changes. OK, so you are left with two thirds minus x^2.

OK, and that's a function of x only. Here, you shouldn't see any y's anymore because y was your integration variable. But, you still have x. You still have x because the area of this shaded slice depends, of course, on the value of x. And, so now, the second thing to do is to do the outer integral. So, now we integrate from zero to one what we got, which is two thirds minus x^2 dx. OK, and we know how to compute that because that integrates to two thirds x minus one third x^3 between zero and one.

And, I'll let you do the computation. You will find it's one third. OK, so that's the final answer. So, that's the general pattern. When we have a double integral to compute, first we want to set it up carefully. We want to find, what will be the bounds in x and y? And here, that was actually pretty easy because our equation was very simple. Then, we want to compute the inner integral, and then we compute the outer integral. And, that's it.

OK, any questions at this point? No? OK, so, by the way, we started with dA in the notation, right? Here we had dA. And, that somehow became a dy dx. OK, so, dA became dy dx because when we do the iterated integral this way, what we're actually doing is that we are slicing our origin into small rectangles. OK, that was the area of this small rectangle here? Well, it's the product of its width times its height. So, that's delta x times delta y. OK, so, delta a equals delta x delta y becomes...

So actually, it's not just becomes, it's really equal. So, the small rectangles for. Now, it became dy dx and not dx dy. Well, that's a question of, in which order we do the iterated integral? It's up to us to decide whether we want to integrate x first, then y, or y first, then x. But, as we'll see very soon, that is an important decision when it comes to setting up the bounds of integration. Here, it doesn't matter, but in general we have to be very careful about in which order we will do things. Yes? Well, in principle it always works both ways.

Sometimes it will be that because the region has a strange shape, you can actually set it up more easily one way or the other. Sometimes it will also be that the function here, you actually know how to integrate in one way, but not the other. So, the theory is that it should work both ways. In practice, one of the two calculations may be much harder. OK. Let's do another example. Let's say that what I wanted to know was not actually what I computed, namely, the volume below the paraboloid, but also the negative of some part that's now in the corner towards me. But let's say really what I wanted was just the volume between the paraboloid and the xy plane, so looking only at the part of it that sits above the xy plane.

So, that means, instead of integrating over the entire square of size one, I should just integrate over the quarter disk. I should stop integrating where my paraboloid hits the xy plane. So, let me draw another picture. So, let's say I wanted to integrate, actually -- So, let's call this example two. So, we are going to do the same function but over a different region. And, the region will just be, now, this quarter disk here. OK, so maybe I should draw a picture on the xy plane. That's your region, R.

OK, so in principle, it will be the same integral. But what changes is the bounds. Why do the bounds change? Well, the bounds change because now if I set, if I fixed some value of x, then I want to integrate this part of the slice that's above the xy plane and I don't want to take this part that's actually outside of my disk. So, I should stop integrating over y when y reaches this value here. OK, on that picture here, on this picture, it tells me for a fixed value of x, the range of values for y should go only from here to here. So, that's from here to less than one.

OK, so for a given, x, the range of y is, well, so what's the lowest value of y that we want to look at? It's still zero. From y equals zero to,what's the value of y here? Well, I have to solve in the equation of a circle, OK? So, if I'm here, this is x^2 y^2 equals one. That means y is square root of one minus x^2. OK, so I will integrate from y equals zero to y equals square root of one minus x^2. And, now you see how the bound from y will depend on the value of x. OK, so while I erase, I will let you think about, what is the bound for x now?

It's a trick question. OK, so I claim that what we will do -- We write this as an iterated integral first dy then dx. And, we said for a fixed value of x, the range for y is from zero to square root of one minus x^2. What about the range for x? Well, the range for x should just be numbers. OK, remember, the question I have to ask now is if I look at all of these yellow slices, which one is the first one that I will consider? Which one is the last one that I want to consider? So, the smallest value of x that I want to consider is zero again.

And then, I will have actually a pretty big slice. And I will get smaller, and smaller, and smaller slices. And, it stops. I have to stop when x equals one. Afterwards, there's nothing else to integrate. So, x goes from zero to one. OK, and now, see how in the inner integral, the bounds depend on in the inner integral, the bounds depend on x. In the outer one, you just get numbers because the questions that you have to ask to set up this one and set up that one are different.

Here, the question is, if I fix a given, x, if I look at a given slice, what's the range for y? Here, the question is, what's the first slice? What is the last slice? Does that make sense? Everyone happy with that? OK, very good. So, now, how do we compute that? Well, we do the inner integral. So, that's an integral from zero to square root of one minus x^2 of one minus x^2 minus y^2 dy. And, well, that integrates to y-x^2y-y^3 over three from zero to square root of one minus x^2.

And then, that becomes, well, the root of one minus x^2 minus x^2 root of one minus x^2 minus y minus x^2 to the three halves over three. And actually, if you look at it for long enough, see, this says one minus x^2 times square root of one minus x^2. So, actually, that's also, so, in fact, that simplifies to two thirds of one minus x^2 to the three halves. OK, let me redo that, maybe, slightly differently. This was one minus x^2 times y. So --

-- one minus x^2 times y becomes square root of one minus x^2 minus y^3 over three. And then, when I take y equals zero, I get zero. So, I don't subtract anything. OK, so now you see this is one minus x^2 to the three halves minus a third of it. So, you're left with two thirds. OK, so, that's the integral. The outer integral is the integral from zero to one of two thirds of one minus x^2 to the three halves dx.

And, well, I let you see if you remember single variable integrals by trying to figure out what this actually comes out to be is it pi over two, or pi over eight, actually? I think it's pi over eight. OK, well I guess we have to do it then. I wrote something on my notes, but it's not very clear, OK? So, how do we compute this thing? Well, we have to do trig substitution. That's the only way I know to compute an integral like that, OK? So, we'll set x equal sine theta, and then square root of one minus x^2 will be cosine theta.

We are using sine squared plus cosine squared equals one. And, so that will become -- -- so, two thirds remains two thirds. One minus x^2 to the three halves becomes cosine cubed theta. dx, well, if x is sine theta, then dx is cosine theta d theta. So, that's cosine theta d theta. And, well, if you do things with substitution, which is the way I do them, then you should worry about the bounds for theta which will be zero to pi over two. Or, you can also just plug in the bounds at the end.

So, now you have the two thirds times the integral from zero to pi over two of cosine to the fourth theta d theta. And, how do you integrate that? Well, you have to use double angle formulas. OK, so cosine to the fourth, remember, cosine squared theta is one plus cosine two theta over two. And, we want the square of that. And, so that will give us -- -- of, well, we'll have, it's actually one quarter plus one half cosine to theta plus one quarter cosine square to theta d theta. And, how will you handle this guy? Well, using, again, the double angle formula. OK, so it's getting slightly nasty. So, but I don't know any simpler solution except for one simpler solution, which is you have a table of integrals of this form inside the notes. Yes?

No, I don't think so because if you take one half times cosine half times two, you will still have half, OK? So, if you do, again, the double angle formula, I think I'm not going to bother to do it. I claim you will get, at the end, pi over eight because I say so. OK, so exercise, continue calculating and get pi over eight. OK, now what does the show us? Well, this shows us, actually, that this is probably not the right way to do this. OK, the right way to do this will be to integrate it in polar coordinates. And, that's what we will learn how to do tomorrow.

So, we will actually see how to do it with much less trig. So, that will be easier in polar coordinates. So, we will see that tomorrow. OK, so we are almost there. I mean, here you just use a double angle again and then you can get it. And, it's pretty straightforward. OK, so one thing that's kind of interesting to know is we can exchange the order of integration. Say we have an integral given to us in the order dy dx, we can switch it to dx dy. But, we have to be extremely careful with the bounds. So, you certainly cannot just swap the bounds of the inner and outer because there you would end up having this square root of one minus x^2 on the outside, and you would never get a number out of that.

So, that cannot work. It's more complicated than that. OK, so, well, here's a first baby example. Certainly, if I do integral from zero to one, integral from zero to two dx dy, there, I can certainly switch the bounds without thinking too much. What's the reason for that? Well, the reason for that is this corresponds in both cases to integrating x from zero to two, and y from zero to one. It's a rectangle. So, if I slice it this way, you see that y goes from zero to one for any x between zero and two. It's this guy. If I slice it that way, then x goes from zero to two for any value of y between zero and one. And, it's this one. So, here it works. But in general, I have to draw picture of my region, and see how the slices look like both ways.

OK, so let's do a more interesting one. Let's say that I want to compute an integral from zero to one of integral from x to square root of x of e^y over y dy dx. So, why did I choose this guy? Which is the guy because as far as I can tell, there's no way to integrate e^y over y. So, this is an integral that you cannot compute this way. So, it's a good example for why this can be useful. So, if you do it this way, you are stuck immediately. So, instead, we will try to switch the order. But, to switch the order, we have to understand, what do these bounds mean? OK, so let's draw a picture of the region. Well what I am saying is y equals x to y equals square root of x.

Well, let's draw y equals x, and y equals square root of x. Well, maybe I should actually put this here, y equals x to y equals square root of x. OK, and so I will go, for each value of x I will go from y equals xo to y equals square root of x. And then, we'll do that for values of x that go from x equals zero to x equals one, which happens to be exactly where these things intersect. So, my region will consist of all this, OK? So now, if I want to do it the other way around, I have to decompose my region.

The other way around, I have to, so my goal, now, is to rewrite this as an integral. Well, it's still the same function. It's still e to the y over y. But now, I want to integrate dx dy. So, how do I integrate over x? Well, I fix a value of y. And, for that value of y, what's the range of x? Well, the range for x is from here to here. OK, what's the value of x here? Let's start with an easy one.

This is x equals y. What about this one? It's x equals y^2. OK, so, x goes from y2 to y, and then what about y? Well, I have to start at the bottom of my region. That's y equals zero to the top, which is at y equals one. So, y goes from zero to one. So, switching the bounds is not completely obvious. That took a little bit of work. But now that we've done that, well, just to see how it goes, it's actually going to be much easier to integrate because the inner integral, well, what's the integral of e^y over y with respect to x? It's just that times x, right, from x equals y^2 to y.

So, that will be, well, if I plug x equals y, I will get e to the y minus, if I plug x equals y^2, I will get e to the y over y times y^2 into the y times y, OK? So, now, if I do the outer integral, I will have the integral from zero to one of e to the y minus y^e to the y dy. And, that one actually is a little bit easier. So, we know how to integrate e^y. We don't quite know how to integrate ye^y. But, let's try. So, let's see, what's the derivative of ye^y? Well, there's a product rule that's one times e^y plus y times the derivative of e^y is ye^y.

So, if we do, OK, let's put a minus sign in front. Well, that's almost what we want, except we have a minus e^y instead of a plus e^y. So, we need to add 2e^y. And, I claim that's the antiderivative. OK, if you got lost, you can also integrate by integrating by parts, by taking the derivative of y and integrating these guys. Or, but, you know, that works. Just, your first guess would be, maybe, let's try minus y^e to the y.

Take the derivative of that, compare, see what you need to do to fix. And so, if you take that between zero and one, you'll actually get e minus two. OK, so, tomorrow we are going to see how to do double integrals in polar coordinates, and also applications of double integrals, how to use them for interesting things.