Solution (source code)

= Solution

In <Cartesian coordinates>, the <divergence> is the sum of the three component derivatives. Therefore
$$
\nabla\cdot r=\frac{\partial x}{\partial x}+\frac{\partial y}{\partial y}+\frac{\partial z}{\partial z}=3.
$$