Using the divergence theorem to prove Gauss's law?

1. Aug 18, 2015

kittyset

Hello,

I've been struggling with this question:

Let q be a constant, and let f(X) = f(x,y,z) = q/(4pi*r) where r = ||X||. Compute the integral of E = - grad f over a sphere centered at the origin to find q.

I parametrized the sphere using phi and theta, crossed the partials, and got q, but I think there's another way using the divergence theorem, given as ∫∫E⋅ndσ = ∫∫∫ div E dV (sorry about the awkward symbol usage :/ ). I'm not sure what's going wrong with the following:

1. div grad f = div -E = div E = 0

2. ∫∫∫ div E dV = 0 ≠ q

I'm probably missing something super basic, but any hint would be a great help!

2. Aug 18, 2015

RUber

Why do you say that div E = 0?
E = -grad f = $-\begin{pmatrix} \frac{\partial }{\partial x } &\frac{\partial }{\partial y }& \frac{\partial }{\partial z }\end{pmatrix} \frac{q}{4\pi \sqrt{ x^2 + y^2 +z^2 } }.$
This is not a constant, so why would the divergence be zero?

3. Aug 18, 2015

kittyset

Whoops, you're totally right. Found an error when i took the div. Thanks so much!