# 15.1: Volume and Average Height

Consider a surface \(f(x,y)\); you might temporarily think of this as representing physical topography---a hilly landscape, perhaps. What is the average height of the surface (or average altitude of the landscape) over some region?

As with most such problems, we start by thinking about how we might approximate the answer. Suppose the region is a rectangle, \([a,b]\times[c,d]\). We can divide the rectangle into a grid, \(m\) subdivisions in one direction and \(n\) in the other, as indicated in figure 15.1.1. We pick \(x\) values \(x_0\), \(x_1\),..., \(x_{m-1}\) in each subdivision in the \(x\) direction, and similarly in the \(y\) direction. At each of the points \((x_i,y_j)\) in one of the smaller rectangles in the grid, we compute the height of the surface: \(f(x_i,y_j)\). Now the average of these heights should be (depending on the fineness of the grid) close to the average height of the surface:

$${f(x_0,y_0)+f(x_1,y_0)+\cdots+f(x_0,y_1)+f(x_1,y_1)+\cdots+

f(x_{m-1},y_{n-1})\over mn}.$$

As both \(m\) and \(n\) go to infinity, we expect this approximation to converge to a fixed value, the actual average height of the surface. For reasonably nice functions this does indeed happen.

**Figure 15.1.1***.** A rectangular subdivision of \([a,b]x[c,d]\).*

Using sigma notation, we can rewrite the approximation:

$$\eqalign{

{1\over mn}\sum_{i=0}^{n-1}\sum_{j=0}^{m-1}f(x_j,y_i)

&={1\over(b-a)(d-c)}\sum_{i=0}^{n-1}\sum_{j=0}^{m-1}f(x_j,y_i)

{b-a\over m}{d-c\over n}\cr &=

{1\over(b-a)(d-c)}\sum_{i=0}^{n-1}\sum_{j=0}^{m-1}f(x_j,y_i)\Delta

x\Delta y.\cr }$$

The two parts of this product have useful meaning: \((b-a)(d-c)\) is of course the area of the rectangle, and the double sum adds up \(mn\) terms of the form \(f(x_j,y_i)\Delta x\Delta y\), which is the height of the surface at a point times the area of one of the small rectangles into which we have divided the large rectangle. In short, each term \(f(x_j,y_i)\Delta x\Delta y\) is the volume of a tall, thin, rectangular box, and is approximately the volume under the surface and above one of the small rectangles; see figure 15.1.2. When we add all of these up, we get an approximation to the volume under the surface and above the rectangle \(R=[a,b]\times[c,d]\). When we take the limit as \(m\) and \(n\) go to infinity, the double sum becomes the actual volume under the surface, which we divide by \((b-a)(d-c)\) to get the average height.

**Figure 15.1.2.** Approximating the volume under a surface.

Double sums like this come up in many applications, so in a way it is the most important part of this example; dividing by \((b-a)(d-c)\) is a simple extra step that allows the computation of an average. As we did in the single variable case, we introduce a special notation for the limit of such a double sum:

$$\lim_{m,n\to\infty} \sum_{i=0}^{n-1}\sum_{j=0}^{m-1}f(x_j,y_i)\Delta x\Delta y=\iint\limits_{R} f(x,y)\,dx\,dy=\iint\limits_{R} f(x,y)\,dA,$$

the **double integral** of \(f\) over the region \(R\). The notation \(dA\) indicates a small bit of area, without specifying any particular order for the variables \(x\) and \(y\); it is shorter and more "generic'' than writing \(dx\,dy\). The average height of the surface in this notation is

$${1\over(b-a)(d-c)}\iint\limits_{R} f(x,y)\,dA.$$

The next question, of course, is: How do we compute these double integrals? You might think that we will need some two-dimensional version of the Fundamental Theorem of Calculus, but as it turns out we can get away with just the single variable version, applied twice.

Going back to the double sum, we can rewrite it to emphasize a particular order in which we want to add the terms:

$$\sum_{i=0}^{n-1}\left(\sum_{j=0}^{m-1}f(x_j,y_i)\Delta x\right)\Delta y.$$

In the sum in parentheses, only the value of \(x_j\) is changing; \(y_i\) is temporarily constant. As \(m\) goes to infinity, this sum has the right form to turn into an integral:

$$\lim_{m\to\infty}\sum_{j=0}^{m-1}f(x_j,y_i)\Delta x = \int_a^b f(x,y_i)\,dx.$$

So after we take the limit as \(m\) goes to infinity, the sum is

$$

\sum_{i=0}^{n-1}\left(\int_a^b f(x,y_i)\,dx\right)\Delta y.

$$

Of course, for different values of \(y_i\) this integral has different values; in other words, it is really a function applied to \(y_i\):

$$G(y)=\int_a^b f(x,y)\,dx.$$

If we substitute back into the sum we get

$$\sum_{i=0}^{n-1} G(y_i)\Delta y.$$

This sum has a nice interpretation. The value \(G(y_i)\) is the area of a cross section of the region under the surface \(f(x,y)\), namely, when \(y=y_i\). The quantity \(G(y_i)\Delta y\) can be interpreted as the volume of a solid with face area \(G(y_i)\) and thickness \(\Delta y\). Think of the surface \(f(x,y)\) as the top of a loaf of sliced bread. Each slice has a cross-sectional area and a thickness; \(G(y_i)\Delta y\) corresponds to the volume of a single slice of bread. Adding these up approximates the total volume of the loaf. (This is very similar to the technique we used to compute volumes in section 9.3, except that there we need the cross-sections to be in some way "the same''.) Figure 15.1.3 shows this "sliced loaf'' approximation using the same surface as shown in figure 15.1.2.

Nicely enough, this sum looks just like the sort of sum that turns into an integral, namely,

$$\eqalign{

\lim_{n\to\infty}\sum_{i=0}^{n-1} G(y_i)\Delta y&=\int_c^d

G(y)\,dy\cr

&=\int_c^d \int_a^b f(x,y)\,dx\,dy.\cr

}$$

Let's be clear about what this means: we first will compute the inner integral, temporarily treating \(y\) as a constant. We will do this by finding an anti-derivative with respect to \(x\), then substituting \(x=a\) and \(x=b\) and subtracting, as usual. The result will be an expression with no \(x\) variable but some occurrences of \(y\). Then the outer integral will be an ordinary one-variable problem, with \(y\) as the variable.

Example 15.1.1:

Figure 15.1.2 shows the function \(\sin(xy)+6/5\) on \([0.5,3.5]\times[0.5,2.5]\). The volume under this surface is

$$\int_{0.5}^{2.5}\int_{0.5}^{3.5} \sin(xy)+{6\over5}\,dx\,dy.$$

The inner integral is

$$\int_{0.5}^{3.5} \sin(xy)+{6\over5}\,dx= \left.{-\cos(xy)\over y}+{6x\over5}\right|_{0.5}^{3.5}= {-\cos(3.5y)\over y}+{\cos(0.5y)\over y}+{18\over5}.$$

Unfortunately, this gives a function for which we can't find a simple anti-derivative. To complete the problem we could use Sage or similar software to approximate the integral. Doing this gives a volume of approximately \(8.84\), so the average height is approximately \(8.84/6\approx 1.47\).

**Figure 15.1.3.** Approximating the volume under a surface with slices (AP)

Because addition and multiplication are commutative and associative, we can rewrite the original double sum:

$$

\sum_{i=0}^{n-1}\sum_{j=0}^{m-1}f(x_j,y_i)\Delta x\Delta y=\sum_{j=0}^{m-1}\sum_{i=0}^{n-1}f(x_j,y_i)\Delta y\Delta x.

$$

Now if we repeat the development above, the inner sum turns into an integral:

$$\lim_{n\to\infty}\sum_{i=0}^{n-1}f(x_j,y_i)\Delta y = \int_c^d f(x_j,y)\,dy,$$

and then the outer sum turns into an integral:

$$\lim_{m\to\infty}\sum_{j=0}^{m-1}\left(\int_c^d f(x_j,y)\,dy \right)\Delta x = \int_a^b\int_c^d f(x,y)\,dy\,dx.$$

In other words, we can compute the integrals in either order, first with respect to \(x\) then \(y\), or vice versa. Thinking of the loaf of bread, this corresponds to slicing the loaf in a direction perpendicular to the first.

We haven't really proved that the value of a double integral is equal to the value of the corresponding two single integrals in either order of integration, but provided the function is reasonably nice, this is true; the result is called **Fubini's Theorem**.

Example 15.1.2:

We compute \(\iint\limits_{R} 1+(x-1)^2+4y^2\,dA\), where \(R=[0,3]\times[0,2]\), in two ways.

First,

$$\eqalign{

\int_0^3\int_0^2 1+(x-1)^2+4y^2\,dy\,dx&=

\int_0^3\left. y+(x-1)^2y+{4\over 3}y^3\right|_0^2\,dx\cr

&=\int_0^3 2+2(x-1)^2+{32\over 3}\,dx\cr

&=\left. 2x + {2\over 3}(x-1)^3+{32\over 3}x\right|_0^3\cr

&=6+{2\over 3}\cdot 8 + {32\over 3}\cdot3-(0-1\cdot{2\over3}+0)\cr

&=44.\cr

}$$

In the other order:

$$\eqalign{

\int_0^2\int_0^3 1+(x-1)^2+4y^2\,dx\,dy&=

\int_0^2\left. x+{(x-1)^3\over3}+4y^2x\right|_0^3\,dy\cr

&=\int_0^2 3+{8\over3}+12y^2+{1\over3}\,dy\cr

&=\left. 3y+{8\over3}y+4y^3+{1\over3}y\right|_0^2\cr

&=6+{16\over3}+32+{2\over3}\cr

&=44.\cr

}$$

In this example there is no particular reason to favor one direction over the other; in some cases, one direction might be much easier than the other, so it's usually worth considering the two different possibilities.

Frequently we will be interested in a region that is not simply a rectangle. Let's compute the volume under the surface \(x+2y^2\) above the region described by \(0\le x\le1\) and \(0\le y\le x^2\), shown in figure 15.1.4.

**Figure 15.1.4.** A parabolic region of integration

In principle there is nothing more difficult about this problem. If we imagine the three-dimensional region under the surface and above the parabolic region as an oddly shaped loaf of bread, we can still slice it up, approximate the volume of each slice, and add these volumes up. For example, if we slice perpendicular to the \(x\) axis at \(x_i\), the thickness of a slice will be \(\Delta x\) and the area of the slice will be

$$

\int_0^{x_i^2} x_i+2y^2\,dy.

$$

When we add these up and take the limit as \(\Delta x\) goes to 0, we get the double integral

$$\eqalign{

\int_0^1 \int_0^{x^2} x+2y^2\,dy\,dx&=

\int_0^1 \left.xy+{2\over3}y^3\right|_0^{x^2}\,dx\cr

&=\int_0^1 x^3+{2\over3}x^6\,dx\cr

&=\left. {x^4\over4}+{2\over21}x^7\right|_0^1\cr

&={1\over4}+{2\over21}={29\over84}.\cr

}$$

We could just as well slice the solid perpendicular to the \(y\) axis, in which case we get

$$\eqalign{

\int_0^1 \int_{\sqrt y}^1 x+2y^2\,dx\,dy&=

\int_0^1 \left.{x^2\over2}+2y^2x\right|_{\sqrt y}^1 \,dy\cr

&=\int_0^1 {1\over2}+2y^2-{y\over2}-2y^2\sqrt y\,dy\cr

&=\left.

{y\over2}+{2\over3}y^3-{y^2\over4}-{4\over7}y^{7/2}\right|_0^1\cr

&={1\over2}+{2\over3}-{1\over4}-{4\over7}={29\over84}.\cr

}$$

What is the average height of the surface over this region? As before, it is the volume divided by the area of the base, but now we need to use integration to compute the area of the base, since it is not a simple rectangle. The area is

$$\int_0^1 x^2\,dx={1\over3},$$

so the average height is \(29/28\).

Example 15.1.3:

Find the volume under the surface \( z=\sqrt{1-x^2}\) and above the triangle formed by \(y=x\), \(x=1\), and the \(x\)-axis.

Let's consider the two possible ways to set this up:

$$\int_0^1 \int_0^x \sqrt{1-x^2}\,dy\,dx \qquad\hbox{or}\qquad \int_0^1 \int_y^1 \sqrt{1-x^2}\,dx\,dy.

$$

Which appears easier? In the first, the first (inner) integral is easy, because we need an anti-derivative with respect to \(y\), and the entire integrand \(\sqrt{1-x^2}\) is constant with respect to \(y\). Of course, the second integral may be more difficult. In the second, the first integral is mildly unpleasant---a trig substitution. So let's try the first one, since the first step is easy, and see where that leaves us.

$$\int_0^1 \int_0^x \sqrt{1-x^2}\,dy\,dx=

\int_0^1 \left. y\sqrt{1-x^2}\right|_0^x\,dx=

\int_0^1 x\sqrt{1-x^2}\,dx.

$$

This is quite easy, since the substitution \(u=1-x^2\) works:

$$\int x\sqrt{1-x^2}\,dx=-{1\over 2}\int \sqrt u\,du

={1\over3}u^{3/2}=-{1\over3}(1-x^2)^{3/2}.

$$

Then

$$\int_0^1 x\sqrt{1-x^2}\,dx=\left. -{1\over3}(1-x^2)^{3/2}\right|_0^1

={1\over3}.

$$

This is a good example of how the order of integration can affect the complexity of the problem. In this case it is possible to do the other order, but it is a bit messier. In some cases one order may lead to a very difficult or impossible integral; it's usually worth considering both possibilities before going very far.