Multiple Integrals

This notebook is designed to show how Mathematica can be used to evaluate multiple integrals. We will start with double integrals and then look at triple integrals.

EXAMPLES

Double Integrals

EXAMPLE 1:  If we consider the integral of the function  f(x, y) = (x^3) (y^2) +  xy  over the rectangle described by  0 ≤ x ≤ 1 and 1 ≤ y ≤ 2 we can integrate f(x, y) with respect to  x  over 0  ≤ x ≤ 1 while treating  y  as a constant.  We can enter the following lines, remember to leave a space between the variables  x  and y  for multiplication; otherwise, Mathematica will interpret it as a new variable called xy  and will not be able to handle the integral.

f[x_, y_] = y^2 x^3 + y x
Integrate[f[x, y], {x, 0, 1}]

Note that the result is a function of  y  only.  Now let's integrate that function with respect to y with 1 ≤ y ≤ 2.

Integrate[%, {y, 1, 2}]

We could have combined these two integrations into one command.

Integrate[f[x, y], {y, 1, 2}, {x, 0, 1}]

If we enter a command as Integrate[f, {x, xmin, xmax}, {y, ymin, ymax}] then Mathematica will first evaluate the integral with respect to y and then with respect to x.

We could also have used the BasicInput Palette (pull down the File menu to Palettes and then select BasicInput) to enter the double integral in  "standard" notation.

(∫_1^2)(∫_0^1)((x^3) (y^2) +  
              x y) \[DifferentialD]x \[DifferentialD]y

If you use the palette, also remember that the outer integral and outer variable go together so that in this problem, we have the limits for  y  given by  1 ≤ y ≤ 2  and for   x  we have 0 ≤ x ≤ 1.

You might want to check to see what happens if we first integrate with respect to y and then with respect to x.  Would we get the same answer?  Remember to switch the limits on both integral signs and the order in which you write dx and dy.

(∫_0^1)(∫_1^2)((x^3) (y^2) +  
              x y) \[DifferentialD]y \[DifferentialD]x

EXAMPLE 2:  Suppose that we wish to find the volume that lies under the curve  f(x, y) = x (y^2) and over the triangular region defined by the inequalities 0 ≤ x ≤ 1  and x ≤ y ≤ 2x. Because of the way the region is described, we must integrate first with respect to  y  and then  x.  If we want to first look at the region over which the integral extends we load the following line.  This only need to be loaded once for the entire session.

Needs["Graphics`FilledPlot`"]

Then we can try letting Mathematica graph and shade in the region for us.

FilledPlot[{x, 2  x}, {x, 0, 1}]

We can use the palette format to obtain the volume:

(∫_0^1)(∫_x^(2  x))x (y^2) \[DifferentialD]y \[DifferentialD]x

or if we use the other format, since we have to integrate with respect to  y  first, the bounds on y are given "on the outside" of the command.

Integrate[x  y^2, {x, 0, 1}, {y, x, 2  x}]

To see what would happen if you interchanged the limits try the next line.

Integrate[x  y^2, {y, x, 2  x}, {x, 0, 1}]

EXAMPLE 3:  Suppose that  we want the find the volume of the solid that lies under the surface  z =    (x^2)(y^2) and over the region described by  0  ≤ x ≤ sin y  and  0 ≤ y ≤ π.  To look at the two-dimension region, enter the following line

FilledPlot[{0, Sin[y]}, {y, 0, π}]

To see the three dimensional region whose volume we are calculating , try the following

Plot3D[
        If[0 ≤ x ≤ Sin[y], (x^2) (y^2), -1], {x, 0, 
          1}, {y, 0, 3.2}, PlotRange -> {0, 3.3}, 
        BoxRatios -> {1, 1, 1}, 
        ViewPoint -> {2, -3, 1.5}];

The region looks rather "jagged". We can improve the picture by increasing the number of "PlotPoints" as in the next line, the default is 25.

Plot3D[
        If[0 ≤ x ≤ Sin[y], (x^2) (y^2), -1], {x, 0, 
          1}, {y, 0, 3.2}, PlotRange -> {0, 3.3}, PlotPoints -> 50, 
        BoxRatios -> {1, 1, 1}, 
        ViewPoint -> {2, -3, 1.5}];

To find the desired volume, we can enter the following

(∫_0^π)(∫_0^(Sin[y]))(x^2) (y^2) \[DifferentialD]x \[DifferentialD]y

Sometimes it may be easier to do a problem by converting to Polar Coordinates.  If  f(x,y)   is continuous on a polar region  D  defined by   α ≤ θ ≤ β  and  (Subscript[h, 1])(θ)  ≤  
        r  ≤  (Subscript[h, 2])(θ)  then  
	(∫_D)∫f(x, 
              y) dA  =  (∫_α^β)\(∫\_\(\(h\_1\)(θ)\)\%\(\(h\_2\)(θ)\)\)f(r cos(θ), 
                r sin(θ)) 
              r dr dθ

EXAMPLE 4:  If  f(x, y) =  (((x  -  y))^2)/2  and we want to integrate this over the sector of the unit disk for which  0 ≤ θ ≤ π/4 (the unit disk is the interior of the unit circle  (x^2)  +  (y^2)  =  1) we could look at the polar region  D  as being defined by  0 ≤ θ ≤ π/4   where θ = arctan(y/x) and  0 ≤ r ≤ 1.  If you want to see the three-dimensional region, enter the following

Plot3D[
        If[0 ≤ ArcTan[y/x] ≤ (π/4) && 
            (x^2) + (y^2) ≤ 1, 
          (1/2) (((x - y))^2), -1], {x, -0.02, 1.02}, {y, -0.5, 
          0.75}, PlotRange -> {0, 0.6}, PlotPoints -> 50, 
        BoxRatios -> Automatic, 
        ViewPoint -> {3, 5, 3}];

To compute the volume of the three-dimensional region, use the following lines.

f[x_, y_] = (1/2) (((x - y))^2)
(∫_0^(π/4))(∫_0^1) f[r Cos[θ], 
            r Sin[θ]] 
          r \[DifferentialD]r \[DifferentialD]θ

Triple Integrals

If we have a function  f(x, y, z)  that is continuous on a region, R,  in three dimensional space where R is described by the inequalities  a ≤ x ≤ b, g(x) ≤ y ≤ h(x), and r(x, y) ≤ z ≤ s(x, y) then the integral of  f over R can be expressed as
		Integrate[f,{x, a, b}, {y, g(x), h(x)}, {z, r(x, y), s(x, y)}]
where the integral is evaluated by first integrating with respect to z, then with respect to y, and finally with respect to x.  Or, if we use the palette form we have the following
		(∫_a^b)(∫_(g(x)^(h(x)))(∫_(r(x, y))^(s(x, y)))\(f[x, y, 
                    z] dz dy dx\)

EXAMPLE 5:  Suppose that we want to compute the integral of f(x,y,z) = z(Sqrt[xy]) over the region that lies under the paraboloid  z = (x^2)  +  (y^2)and above the triangle in the xy-plane bounded by the coordinate axes and the line whose equation is x + y = 1.  One way of describing the region that we'll be integrating over is with the inequalities  0 ≤ y ≤ 1, 0 ≤ x ≤ 1 - y, and 0 ≤ z ≤ (x^2)  +  (y^2).  If you enter the following line, you will see a plot of it

Plot3D[
        If[0 ≤ y ≤ 1 && 
            0 ≤ x ≤ 1 - y, 
          (x^2) + (y^2), -10], {x, -0.1, 1.1}, {y, -0.1, 1.1}, 
        PlotRange -> {0, 1}, PlotPoints -> 50, 
        BoxRatios -> Automatic, 
        ViewPoint -> {1, -3, 1.5}];

To find the integral, we can enter the following

Clear[f]
f[x_, y_, z_] := z (Sqrt[ x y])
(∫_0^1)(∫_0^(1 - y))(∫_0^((x^2) + (y^2)))f[x, y, 
              z] \[DifferentialD]z \[DifferentialD]x \[DifferentialD]y

Exercises

1.  Consider the iterated integral (∫_1^e)(∫_(ln(x)/x)^(1/x)) \(\(e\^\(x\ y\)\) dy \(\(dx\)\(.\)\)\)
     a)  Obtain a printout that illustrates the two-dimensional region over which the integral extends.
     
     b)  Use Mathematica to evaluate the integral.

2.  Use Mathematica to compute the integral of  f(x, y) = (x^2) cos(y)  +  y (e^x)over the rectangle given by the inequalities 0 ≤ x ≤ 2  and 1 ≤ y ≤ 2.  Verify that the result is the same when the order of integration is reversed.

3.  Find the volume of the solid that lies under the surface  z =  (x^2) (y^2) and over the region that is bounded by  0 ≤ x ≤ sin(y)  and  0 ≤ y ≤ π.

4. Use numerical integration to  approximate the volume of the solid that lies under the surface described by    z = (x^2) + 4 (y^(2 ))and  above the rectangle  described by  0 ≤ x ≤ 2 and  0 ≤ y ≤ 1.  For this, you'll probably want to use the NIntegrate[ ] command; the syntax for multiple numerical integration input mimics that of regular multiple integration.  Include a computer generated plot of the surface as seen from a good viewpoint and having labeled axes.

5.  Find the volume of the solid  bounded by the paraboloid  z = 4 -  (x^2) - (y^2) and the plane x + y + z = 1.

6.  Find the area of the surface  z = 1 + x + y + (x^2),   -2 ≤ x ≤ 1,  -1 ≤ y ≤ 1.  Obtain a printout that shows the surface.

7.  Find the moments with respect to the coordinate planes, the total mass, and the center of mass of the solid under the plane z = x - y/4  and above the region bounded by  - sin(πx) ≤ y ≤ sin(πx) and 0 ≤ x ≤ 1.