Lab 7B - Divergence Theorem
Math 2374 - University of Minnesota
http://www.math.umn.edu/math2374
Questions to: swenson@math.umn.edu

Integration in More than Two Dimensions

In last week's lab, we recalled the six different kinds of integrals we've studied this semester -- here they are again, for reference.

({{Type, Symbol, Region, Integrand, How to Do It}, {double, ∫(∫_R^( )) u dA, R, a region, scalar function u, ∫(∫u(x,y)dy)dx}, {triple, ∫∫(∫_S^( ))u dV, S, a solid, scalar function u, ∫(∫(∫u(x,y,z)dz)dy)dx}, {line (path), (∫_C^( ))u ds   or   (∮_C)u ds, C, a curve with
parametrization
f(t), a≤t≤b, scalar function u, (∫_a^b)u(f(t))∥f'(t)∥ dt}, {line (path), (∫_C^( ))F·dx   or   (∮_C)F·dx, C, a curve with
parametrization
f(t), a≤t≤b, vector field F, (∫_a^b)F(f(t))·f'(t)dt}, {surface, ∫(∫_M^( ))udS   or   (Subscript[∯, M])udS, M,a surface with
parametrization f(s,t)
and parameter range R
, scalar function u, ∫(∫_R^( ))u(f(s,t))∥((∂f)/(∂s))×((∂f)/(∂t))∥dA}, {surface (flux), ∫(∫_M)F·ndS   or   (Subscript[∯, M])F·ndS, M,a surface with
parametrization f(s,t)
and parameter range R
, vector field F, ∫(∫_R^( ))F(f(s,t))·(((∂f)/(∂s))×((∂f)/(∂t)))dA}})

We saw last week that Stokes's Theorem links line integrals of vector fields to surface integrals of vector fields via the curl.  This week, we will work with the Divergence Theorem, which links surface integrals of vector fields to triple integrals via the divergence.

Divergence Theorem:  Suppose S is a solid with smooth boundary ∂S, and let F be a vector field which is smooth on and "near" S.  Then (Subscript[∯, ∂S])F·n dσ=∫∫(∫_S)div FdV.

Using the Divergence Theorem: Example 1

Triple integrals of scalar functions are almost always easier to compute than surface integrals of vector fields.  Therefore, we usually apply the Divergence Theorem to replace a surface integral with a triple integral.  Of course, this only works if our surface is the boundary of some solid!

Example 1

Let F(x,y,z)=(sinx (cos^2)y, (sin^3)y (cos^4)z, (sin^5)z (cos^6)x), and let M be the surface of the cube in the first octant bounded by the coordinate planes and the planes x=(π/2), y=(π/2), and z=(π/2).  Using the Divergence Theorem, calculate the outward flux of F across M.

We need to calculate div F; we can do this by hand, or use Mathematica.  Let's use Mathematica:

F[x_,y_,z_]={(Sin[x])*(Cos[y]^2),(Sin[y]^3)*(Cos[z]^4),(Sin[z]^5)*(Cos[x]^6)}

Remember: Mathematica will not understand our shorthand notation Sin^5[x]!

Mathematica can compute the divergence of a vector field using the command Div:

d[x_,y_,z_]=Div[F[x,y,z]]

Now, by the Divergence Theorem, we can just take the triple integral of our result.

Integrate[d[x,y,z],{x,0,Pi/2},{y,0,Pi/2},{z,0,Pi/2}]

If we didn't know the Divergence Theorem, we'd have to parametrize all six faces individually, check the normal vectors to be sure they pointed outward, evaluate the six integrals, and sum the values.  If you'd like, you can do this to check our result.

Using the Divergence Theorem: Example 2

Sometimes, we can use the Divergence Theorem to simplify a surface integral, even when the surface isn't the boundary of any solid.  The idea is to invent another, simpler surface which completes the boundary of a solid.  Then the Divergence Theorem will give the surface integral over the two surfaces together; we can calculate the simpler integral and subtract it from the total to get our solution.

This is tricky, but it's an important idea.  Re-read that last paragraph until it makes sense, or ask your TA to help you figure it out.

Example 2

Let F(x,y,z)=((y^2)-2y z, (z^2)-2x z, (x^2)-2x y) and let M be the surface parametrized by f(r,θ)=(r cos(θ), r sin(θ), cos(5π(1-r))-1, 0≤r≤1, 0≤θ≤2π.  Find the flux of F through M, using the upward normal vector.

This surface is terrible!  Here's a graph:

f[r_,theta_]={r*Cos[theta],r*Sin[theta],Cos[Sin[5Pi*(1-r)]]-1};
M=ParametricPlot3D[f[r,theta],{r,0,1},{theta,0,2Pi}]

Of course, M is not the boundary of a solid.  However, the boundary of M is the unit circle in the xy-plane (check this!).  Therefore, M and the unit disk (call it Δ) do form the boundary of a solid (call it S): try looking at the following graph from a few different points of view.

g[r_,theta_]={r*Cos[theta],r*Sin[theta],0};
Δ=ParametricPlot3D[g[r,theta],{r,0,1},{theta,0,2Pi},Mesh->10]
S=Show[M,Δ]

Roughly speaking, in English here's what we're going to do in order to calculate the surface integral of our original surface:

1. (Surface Integral over our original surface and the disk) = (triple integral of div F over the solid region enclosed by the two surfaces)	[By the Div Them]

2.  (Surface Integral over original surface) + (Surface integral over disk) = (triple integral over the solid region)	[Computing the two surface integrals separately]

3. (Surface Integral over original surface) = (triple integral over solid region) - (Surface Integral over disk)		[Solving for our original integral]

Remember, in the Divergence Theorem we use the outward pointing normal vector.  In the problem, we're asked to find the integral over M with the upward pointing normal vector, but when we combine it with the unit disk, the outward pointing normal is the downward pointing normal vector.  That means we have to replace M with -M in our calculations.  (As you should recall from lecture, the only real difference is that it will multiply our answer by -1.)

Let's rewrite the three equations above mathematically.

1.  (Subscript[∯, Δ+(-M)])F·ndσ=∫∫(∫_S)div F dV			[By the Div Them; -M because we've switched the normal]

2.   ∫(∫_Δ)F·ndσ+∫(∫_(-M))F·ndσ=∫∫(∫_S)div F dV	[Computing the two surface integrals separately]

3. ∫(∫_(-M))F·ndσ=∫∫(∫_S)div F dV-∫(∫_Δ)F·ndσ		[Solving for our original integral; here I've multiplied by -1 to get the correct sign]

We're interested in the integral over M, not -M, so let's fix that:

4(a). -∫(∫_M)F·ndσ=∫∫(∫_S)div F dV-∫(∫_Δ)F·ndσ		[integral over -M = - (integral over M)]

4(b). ∫(∫_M)F·ndσ=∫(∫_Δ)F·ndσ-∫∫(∫_S)div F dV			[Multiplying by -1]

Now there's another step which makes this particular problem much easier.  It turns out that  F is a very nice vector field: evaluate the cell below.

F[x_,y_,z_]={(y^2)-2y z, (z^2)-2x z,(x^2)-2x y}
Div[F[x,y,z]]

Hence the triple intregral of div F is 0, and we can conclude that ∫(∫_Δ)F·ndσ-∫(∫_M)F·ndσ = 0, so the integrals are equal!  This means that we can work with the unit disk in place of our terrible surface M.

Let's finish off the calculation on Δ: ∫(∫_Δ)F·ndσ=∫(∫_R^( ))F(g(r,θ))·(((∂g)/(∂r))×((∂g)/(∂θ)))dA, so first, we substitute g into F:

v1[r_,theta_]=Apply[F,g[r,theta]]

Next, we cross the partial derivatives of g.

dgdr[r_,theta_]=D[g[r,theta],r]
dgdtheta[r_,theta_]=D[g[r,theta],theta]
Cross[dgdr[r,theta],dgdtheta[r,theta]]
v2[r_,theta_]=Simplify[%]

Lastly, we dot our results together and integrate.

v1[r,theta].v2[r,theta]
Integrate[%,{r,0,1},{theta,0,2Pi}]

So the flux of F through Δ is (π/4).  Notice that this is the flux up through Δ: the normal vector above is (0,0,r), and r is positive.  By the Divergence Theorem, the flux of F down through M is ((-π)/4); the flux of F up through M is (π/4).  Remember, when we apply the Divergence Theorem, our combined surface integral has to use the outward normal vector; this is the downward normal to M and the upward normal to Δ.

Exercises

Exercise 1

Let  r(x,y,z)=(x,y,z), and F(x,y,z)=∥ r∥ r, where the double bars stand for magnitude, and let M be the surface of the solid bounded by the paraboloid z=25-(x^2)-(y^2) and the xy-plane.  Use the Divergence Theorem to compute the outward flux of F through M.  [Hint: Mathematica can't compute the integral exactly; you should use NIntegrate.]

Exercise 2

Let  r(x,y,z)=(x,y,z), and F(x,y,z) = r / ∥ r∥ , where the double bars stand for magnitude, and let M be the surface of the solid bounded by the paraboloid z=26-(x^2)-(y^2) and the plane z=1.  Use the Divergence Theorem to compute the outward flux of F through M.  [Hint: Mathematica can't compute the integral exactly; you should use NIntegrate.]

Exercise 3

Use the Divergence Theorem to calculate the outward flux of F(x,y,z)=((z^2)x, (1/3)(y^3)+tan(z), (x^2)z+(y^2)) through the top half of the sphere (x^2)+(y^2)+(z^2)=1.  [Hint: the surface is not closed; you need a closed surface to apply the Divergence Theorem.  Make a closed surface by adding a flat bottom to the hemisphere -- and think carefully!]

Exercise 4

Use the Divergence Theorem to calculate the outward flux of F(x,y,z)=((y^2)x+(e^yz), (x^2)y+tan(z), (z^3)/3+(x^2)/5+9(y^2))/3 through the bottom half of the sphere (x^2)+(y^2)+(z^2)=4.  [Hint: the surface is not closed; you need a closed surface to apply the Divergence Theorem.  Make a closed surface by adding a flat top to the hemisphere -- and think carefully!]

Exercise 5

In this problem, we will prove Archimedes's Principle: the buoyant force on a submerged object equals the weight of the fluid it displaces.  We choose a system of coordinates so that z represents the depth below the fluid surface; that is, the fluid surface is the xy-plane and the z-axis points down into the fluid.  At every point where z≥0, the pressure is given by the scalar function p(x,y,z)=δgz, where δ is the density of the fluid (assumed constant) and g is the acceleration due to gravity (also assumed constant).

 Set up an integral to calculate the weight of the fluid displaced by S, where S is any solid completely submerged in fluid (i.e. z≥0 at every point of S).  This means that you are to write a general integral that works for every S, not just to choose some particular S.  [Hint: how much fluid does S displace?]

b) Loosely, buoyant force is the integral of pressure.  More precisely, the buoyant force is given by the vector integral B=-(Subscript[∯, ∂S])(pn)dσ.  Write a paragraph explaining why this is a reasonable formula.  [Hint: think of the integral as a sum of many little pieces.  Don't forget to explain the minus sign!]

c) By direct calculations, we can see that pn=p((Subscript[n, 1]),(Subscript[n, 2]),(Subscript[n, 3]))=((Subscript[pn, 1]),0,0)+(0,(Subscript[pn, 2]),0)+(0,0,(Subscript[pn, 3]))=(pi·n)i+(pj·n)j+(pk·n)k. Use this substitution, rearrange, and use the Divergence Theorem (three times) to prove Archimedes's Principle.

Credits

This lab was written  by James Swenson (swenson@math.umn.edu) in 2002.  In Spring 2004 Jonathan Rogness (rogness@math.umn.edu) went through and updated a few minor things to reflect the use of our math2374.nb file; he also added some text (such as the yellow boxes) to example 2 and added a few exercises.  Minor updates in Spring 2008 for Mathematica 6.0.

This lab is copyright 2002, 2004 and is protected by the Creative Commons Attribution-NonCommercial-ShareAlike License.  You can find more information on this license at http://creativecommons.org/licenses/by-nc-sa/1.0/. 

Although it's not specifically required by the license, I'd appreciate it if you let me know at rogness@math.umn.edu if you use parts of our labs, just so I can keep track of it.  Please send me any questions or comments!