# Applying Gauss' Divergence Theorem to given integral

We are given the following two integrals:

$$\iint\limits_S D_n f\:dS$$ and $$\iiint\limits_B \nabla \cdot (\nabla f) \: dV$$

where $$S$$ is the portion of the sphere $$x^2+y^2+z^2=a^2$$ in the first octant, $$n$$ is the unit normal vector to $$S$$ at $$(x,y,z)$$ and $$f(x,y,z) = ln(x^2+y^2+z^2)$$

For the first integral, we have: $$D_n f = \nabla f \cdot n$$ and $$n = \frac{1}{a}$$

Since $$\nabla f = \: <\frac{2x}{x^2+y^2+z^2}, \frac{2y}{x^2+y^2+z^2}, \frac{2z}{x^2+y^2+z^2}>$$, this gives $$D_n f = \nabla f \cdot n = \frac{2}{a}$$.

So the integral becomes

$$\iint\limits_S D_nf \: dS = \iint\limits_S \frac{2}{a} \: dS = \frac{2}{a} \iint\limits_S dS = \frac{2}{a} \cdot A(S) = \frac{2}{a} \cdot 4\pi a^2 \cdot \frac{1}{8} = \pi a$$ ($$\frac{1}{8}$$ since the sphere is in the first octant)

For the second integral, we have $$\nabla \cdot (\nabla f) = \frac{2}{a^2}$$ (since $$x^2 + y^2 + z^2 = a^2$$). So the integral becomes $$\iiint\limits_B \nabla \cdot (\nabla f) \: dV = \frac{2}{a^2} \iiint\limits_B dV = \frac{2}{a^2} \cdot V(B) = \frac{2}{a^2} \cdot \frac{4}{3} \pi a^3 \cdot \frac{1}{8} = \frac{1}{3} \pi a$$

However, according to Gauss' Divergence theorem, these two integrals should be equal to each other right? Since we have $$\iiint\limits_B \nabla \cdot (\nabla f) \: dV = \iint\limits_S \nabla f \cdot dS = \iint\limits_S \nabla f \cdot n \: dS = \iint\limits_S D_n f \: dS$$

So how is it possible that I get two different answers, even though the Divergence theorem shows that the two integrals should be the same?

• You're not counting the flat parts of the surface which are quarter circles in the coordinate planes. – B. Goddard Mar 29 at 11:09
• Oh I see, so if I understand correctly, is it true that the results of the first two integrals are correct, but the application of Gauss' theorem isn't? Because the surface S is not the same as the boundary surface of B, since the boundary surface contains extra flat parts? – Stallmp Mar 29 at 11:14

To apply divergence theorem, you must have a closed surface. So we close the surface by placing $$3$$ quarter disks in plane $$x = 0, y = 0, z = 0$$.

Please note that when you are doing volume integral, you cannot equate $$\nabla \cdot (\nabla f) = \displaystyle \frac{2}{x^2+y^2+z^2} = \frac{2}{a^2}$$. It should rather be,

$$\nabla \cdot (\nabla f) = \displaystyle \frac{2}{x^2+y^2+z^2} = \frac{2}{\rho^2}$$

So the integral becomes,

$$\displaystyle \int_0^{\pi/2} \int_0^{\pi/2} \int_0^a \frac{2}{\rho^2} \ \cdot\rho^2 \cdot \sin \phi \ d\rho \ d\phi \ d\theta = \pi a$$.

Now to find flux through $$S$$, we must subtract flux through planar surfaces $$x = 0, y = 0, z = 0$$ but in this case, they are simply zero.

• simply because $x^2+y^2+z^2 = a^2$ only on the surface of the sphere, not inside it. We are talking volume integral which includes all points inside the sphere too and so we write $x^2+y^2+z^2 \leq a^2$. – Math Lover Mar 29 at 11:31
• Yes you are right about surface $S$. What you get from divergence theorem will include flux through closed surface which is spherical surface $S$ and $3$ planar surfaces as mentioned in my answer. We are supposed to calculate that separately and subtract from the result that we get from divergence theorem to obtain flux only through spherical surface $S$. But in this case they are zero. Do you see why or do you need an explanation? – Math Lover Mar 29 at 11:39
• Yes this is indeed what I thought, thank you very much for the explanation! I see why they are zero as well when calculating the flux through the planar surfaces. – Stallmp Mar 29 at 11:45
• Yes you are right, we need to show they sum to zero. Note that $\iint\limits_{S_1} D_n f \: dS = \iint\limits_{S_2} D_n f \: dS = \iint\limits_{S_3} D_n f \: dS = 0$ – Math Lover Mar 29 at 12:34
• – Math Lover Mar 29 at 12:35