Calculating $\mathrm {div}(\hat a)$ for a sphere I'm practicing for a (electromagnetism) test and in one of the practice questions, they ask to calculate:
$\mathrm {div}(\hat a)$, where $\hat a$ is a unit vector perpendicular to a sphere's surface. Furthermore, it is given that the sphere has radius $R$.
I've tried to use the expression for diveregence in spherical coordinates (see here), but I got stuck with it. Is this the right way to solve this problem or should I use a different method? 
Your help would be very welcome..
 A: Okay, there's a lot going on here and not all of it is clear, so I'll try to answer this as best I can.
First, divergence is only defined for a vector field, not for a single vector. For this reason, I'll assume that what is being asked for is finding the divergence of the vector field $\vec F(r,\theta,\phi)=\hat r$ (where $r, \theta,$ and $\phi$ are the standard parameterizations for spherical coordinates).
Next, I'll assume that since they are giving you information about a sphere of radius $R$ centered on the origin, they are actually asking you to find the total divergence over the volume of the sphere (rather than just the divergence at a single point in space).
Under these assumptions, the problem can be solved very simply using Divergence Theorem. In fact, you don't even need to calculate the divergence for $\vec F$ to solve the problem if you make use of Divergence Theorem; however, for completeness, I'll walk you through the solution with and without Divergence Theorem.
Using the divergence in spherical coordinates (as defined here) we calculate that
$$
\text{div}(\vec F)=\vec\nabla\cdot \vec F=\frac2r
$$
Therefore, the total divergence over the volume of a sphere centered at the origin is
$$
\int_0^R\int_0^\pi\int_0^{2\pi}\Big(\frac2r\Big)\ r^2\sin(\theta)\ d\phi\  d\theta\  dr=4\pi R^2
$$
By Divergence Theorem, this integral is also equal to
$$
\int_0^\pi\int_0^{2\pi}(\hat r\cdot\hat r)\ R^2\sin(\theta)\ d\phi\  d\theta=4\pi R^2
$$
You can use this strategy for any vector field, not just simple ones like the one in this example and not just conservative fields.
