# Verifying that the divergence of a gravitational field is zero

This is an example from the book Calculus: a complete course, of Adams and Essex. There're several reasonings presented in the solution I don't really understand.

EXAMPLE 3. Ch 17.1

Verify that the vector field $$\mathbf{F} = \frac{m \mathbf{r}}{|\mathbf{r}|^3}$$, due to a source of strength $$m$$ at $$(0, 0, 0)$$, has zero divergence at all points in $$\mathbb{R}^3$$ except the origin.

$$\textbf{Solution}$$
Since $$\mathbf{F}(x, y, z) = \frac{m}{r^3} \left( x\mathbf{i} + y\mathbf{j} + z\mathbf{k} \right),$$ where $$r^2 = x^2 + y^2 + z^2,$$
and since $$\partial r/\partial x = x/r$$, we have
$$\frac{\partial F_1}{\partial x} = m \frac{\partial}{\partial x} \left(\frac{x}{r^3} \right) = m \frac{r^3 - 3xr^2 \left(\frac{x}{r}\right)}{r^6} = m \frac{r^2 - 3x^2}{r^5}.$$
Similarly, $$\frac{\partial F_2}{\partial y} = m \frac{r^2 - 3y^2}{r^5}$$ and $$\frac{\partial F_3}{\partial z} = m \frac{r^2 - 3z^2}{r^5}.$$
Adding these up, we get $$\nabla \cdot \mathbf{F}(x, y, z) = 0$$ if $$r > 0$$.

$$\textbf{My questions}$$

1. Why is the absolute sign $$|\mathbf{r}|^3$$ in the denominator removed in the solution?
2. Where does $$r^2 = x^2 + y^2 + z^2$$ come from?
3. Why is $$\partial r/\partial x = x/r$$?
4. Can this vector field $$\mathbf{F} = \frac{m \mathbf{r}}{|\mathbf{r}|^3}$$ expressed in terms of $$\mathbf{F}=F_1\vec{i}+F_2\vec{j}+F_3\vec{k}$$, so that $$\frac{\partial F_1}{\partial x}$$ is more easily calculated?
• As pointed out below, beware to think that $|\cdot|$ is an absolute value! You're working with vectors and that notation stands for the norm of the vector! Commented Aug 1 at 20:59

## 1 Answer

Before answering your questions in turn, it's important to know the following.

In spherical coordinates, we have a scalar $$r$$ and a vector $$\mathbf{r}$$. The vector is defined

$$\mathbf{r}=x \,\vec{i}+y\,\vec{j} + z\,\vec{k}=x\mathbf{i}+y\mathbf{j}+z\mathbf{k}\,.$$

I will use a bold face for a vector instead of the over-arrows from now on.

The scalar $$r$$ is defined as $$r=|\mathbf{r}|$$ and the absolute value sign is defined as $$|\mathbf{r}|=\sqrt{x^2+y^2+z^2}$$.

Now, the four questions.

1. In the solution it looks like it is written $$\frac{1}{r^3}$$. Notice that this is the scalar $$r$$, rather than the vector $$\mathbf{r}$$. Recalling what I write at the top, we see that $$r=|\mathbf{r}|$$. So you can either write $$\frac{1}{r^3}$$ or $$\frac{1}{|\mathbf{r}|^3}$$ but never $$\frac{1}{\mathbf{r}^3}$$.

2. $$r^2=x^2+y^2+z^2$$ is Pythagoras' theorem! If we consider a general vector $$\mathbf{a}=a_1\mathbf{i}+a_2\mathbf{j}+a_3\mathbf{k}$$, it's absolute value squared is defined as $$|\mathbf{a}|^2=(a_1)^2+(a_2)^2+(a_3)^2$$. Then, remembering $$\mathbf{r}=x\mathbf{i}+y\mathbf{j}+z\mathbf{k}$$ and substituting $$a_1=x$$, $$a_2=y$$, and $$a_3=z$$, we arrive at $$r^2=|\mathbf{r}|^2=x^2+y^2+z^2$$.

3. The origin of $$\frac{\partial r}{\partial x}$$. We start with $$r=\sqrt{x^2+y^2+z^2}=(x^2+y^2+z^2)^{1/2}.$$ To calculate the partial derivative with respect to $$x$$, we need to use the chain rule and the power rule. The power rule that we need says $$\frac{\mathrm{d}}{\mathrm{d}x}x^{1/2}=\frac{1}{2}x^{-1/2}$$. Then, using the chain rule, we have $$\frac{\partial r}{\partial x}=\frac{\partial}{\partial x}(x^2+y^2+z^2)^{1/2}=\left(\frac{\partial}{\partial x}\left(x^2+y^2+z^2\right)\right)\frac{1}{2}(x^2+y^2+z^2)^{-1/2}.$$ The term in brackets comes from the chain rule and performing this derivative, we see this factor equals $$2x$$ (the $$2$$ and the $$1/2$$ cancel). Putting this together, we see $$\frac{\partial r}{\partial x}=x(x^2+y^2+z^2)^{-1/2}=\frac{x}{\sqrt{x^2+y^2+z^2}}.$$ We recall now that $$r=\sqrt{x^2+y^2+z^2}$$, which is the factor in the denominator! This results in $$\frac{\partial r}{\partial x}=\frac{x}{r}.$$

4. You can always express a vector $$\mathbf{F}$$ in terms of the basis vectors $$\mathbf{i}$$, $$\mathbf{j}$$, $$\mathbf{k}$$ as $$\mathbf{F}=F_1\mathbf{i}+F_2\mathbf{j}+F_3\mathbf{k}$$. As we see in this case, $$F_1=\frac{m}{r^3}x$$, $$F_2=\frac{m}{r^3}y$$, and $$F_3=\frac{m}{r^3}z$$. When calculating a quantity such as $$\frac{\partial F_1}{\partial x}$$, you will need to use the definition $$r=\sqrt{x^2+y^2+z^2}$$ as $$r$$ also depends on $$x$$!