TITLE: Volume integral of a gradient
QUESTION [7 upvotes]: Assuming we have a scalar function f which tends to 0 at the boundary of a space. Is it true that the volume integral of the gradient of f will also tend to 0?

REPLY [7 votes]: You know the Gauss' divergence theorem says that
$\int_V \nabla \cdot \vec{A} \rm dV = \int_S \vec{A} \cdot d \vec{S}$
Now taking $\vec{A}= f \hat{c}$, where $\hat{c}$ is a constant vector, you can prove:
$\int_V (\nabla f)\rm dV = \int_S f d \vec{S}$
Now telling f tends zero on the surface will not be sufficient to say that left hand side is zero. You have to say how it tends to zero on the surface.
say your f=$\frac{1}{r}$, then obviously as r$\rightarrow \infty$, f$\rightarrow 0$
but$ \int_S f d \vec{S}$=$ \int_S \frac{1}{r}\hat{r} r^2 \sin (\theta) d\theta d\phi=r \int_S \hat{r} \sin (\theta) d\theta d\phi $ =$r \times 0$ 
now see you can't say $r \times 0=0$ when r$\rightarrow \infty$. (Also I have assumed perfectly spherical surface so that you can take out r out of the integral. But for any arbitrary surface r=$r(\theta)$. )
so if f decreases faster than $\frac{1}{r^2}$ then only you can say $\int_V (\nabla f)\rm dV $=0