I have a vector field $F = (x,y,z)$ where $(x,y,z)$ is not equal to $(0,0,0)$. I must calculate the divergence of $\frac{\vec{r}}{r}$ where $r$ is the magnitude of $\vec{r}$.
All I did was calculate divergence$(\frac{(x,y,z)}{(x^2+y^2+z^2)^\frac{1}{2}}$).
I did this and simplified to obtain $\frac{2}{(x^2+y^2+z^2)^\frac{1}{2}}$ which is $\frac{2}{r}$. Is this correct?
You are correct. There are multiple ways to get the answer. If both ways give you the same answer, its probably right.
Consider, $\frac{\vec{r}}{r}=\hat r=1\hat r$
Since the divergence is a scalar, it has the same value in different coordinate systems.
In spherical coordinates, $\nabla \cdot \vec{E} = \frac{\frac{\partial }{\partial r} (r^2E_r)}{r^2}$ if the vector $\vec{E}$ only has a radial component.
In this case, $E_r=1$, so the result is indeed $\frac{2}{r}$
Alternatively, $\frac{\vec{r}}{r}=\hat{r}= \nabla r$
By definition $\nabla ^2V = \nabla \cdot \nabla V. $
So $\nabla \cdot \hat{r} = \nabla ^2 r$
The Laplacian is also a scalar.
The Laplacian for only raidal dependence is $\nabla ^2 V = \frac{1}{r^2}\frac{\partial }{\partial r}(r^2 \frac{\partial V}{\partial r})=\frac{2}{r}$
These approaches have the added advantage of avoiding a complicated derivative of a quotient you probably executed when solving the problem in cartesian coordinates.