Divergence of magnetic vector potential is zero Given the potential $$
 \vec{A}=\frac{\mu_{0}}{4 \pi} \int_{V}^{\prime} \frac{\vec{J}\left(r^{\prime}\right)}{R} d v^{\prime}
$$ where $\vec{J}$ is the stationary current density vector. I want to show that $\vec{\nabla} \cdot \vec{A}= 0$. I already did this integrating by parts, but the author gave the following solution which i can't follow:
$$ \require{cancel}
\begin{aligned}
\vec{\nabla} \cdot \vec{A} &=\vec{\nabla} \cdot\left[\frac{\mu_{0}}{4 \pi} \int_{V}^{\prime} \frac{\vec{J}\left(r^{\prime}\right)}{R} d v^{\prime}\right] \\
&=\frac{\mu_{0}}{4 \pi} \int_{V}^{\prime} \vec{\nabla} \cdot\left(\frac{\vec{J}\left(r^{\prime}\right)}{R}\right) d v^{\prime} \\
&=\frac{\mu_{0}}{4 \pi} \int_{v}^{\prime} \vec{J} \cdot\left[\vec{\nabla}\left(\frac{1}{R}\right)\right]+\frac{1}{R}\cancelto{0}{(\vec{\nabla} \cdot \vec{J})} d v \\
&=\frac{\mu_{0}}{4 \pi} \int_{V}^{\prime} \cancelto{0}{\vec{J}\left(r^{\prime}\right) \cdot \vec{r}} d v \\
\vec{\nabla}\cdot \vec{A} &=0
\end{aligned}
$$
The 4th line is confusing me. Why do we have $\cancelto{0}{\vec{J}\left(r^{\prime}\right) \cdot \vec{r}}$? Its like the author is saying the density current vector is always ortoghonal to the position vector which is not necessarily true. I am not sure if that expression is zero because a mathematical reason or a physical reason.
Also, I think there is a missing term  $\left ( \dfrac{-1}{R^2} \right) $ in the integrand of the 4th line.
References:

*

*Wangsness, Electromagnetic Fields, Chap 16.

 A: I can't follow the author's solution either. I think they may be using an earlier result that showed that $J\cdot R$ is zero if J is divergence free.
I really dislike their notation, I think it'd be a lot clearer written as
$$ \vec{A}(r) = \frac{\mu_0}{4\pi} \int d^3\vec{r'} \frac{\vec{J}(r')}{|\vec{r}-\vec{r}'|} $$
Then we end up with
$$ \nabla \cdot \vec{A}(r) = \frac{\mu_0}{4\pi} \int d^3\vec{r'} \nabla_r \cdot \left(\frac{\vec{J}(r')}{|\vec{r}-\vec{r}'|}\right) $$
$$  = \frac{\mu_0}{4\pi} \int d^3\vec{r'}  \vec{J}(r') \cdot \nabla_r\left(\frac{1}{|\vec{r}-\vec{r}'|}\right) $$
The last line followed from J being constant in $r$.
Now the nontrivial point is that
$\nabla_r\left(\frac{1}{|\vec{r}-\vec{r}'|}\right) = -\nabla_{r'}\left(\frac{1}{|\vec{r}-\vec{r}'|}\right)$
This allows you to use integration by parts, along with $\nabla \cdot \vec{J} = 0$ (i.e. the magnetostatic condition, equivalent to the requirement that charge does not accumulate anywhere) to prove the result.
Note that this requirement can be relaxed, but the answer comes in terms of the electric potential $\phi$.
$$\nabla \cdot A = -\mu_0\epsilon_0 \frac{\partial \phi}{\partial t} \Leftrightarrow \frac{\partial (\phi/c)}{\partial (ct)} + \nabla \cdot A = 0$$
which is the Lorenz gauge condition.
