Divergence of electric field

In one of the "proofs" of Gauss' law in my textbook, author took divergence of the E.

$$\mathbf E = \int_{\text{all space}} \dfrac{\hat{\mathscr r} }{{\mathscr r}^2} \rho(r^\prime) d\tau^\prime$$

Where $\mathscr r= r - r^\prime$, $r$ is where field is to be calculated, $\rho$ is charge density and $r^\prime$ is the location of $dq$ charge.

Next step is what I don't understand.

$$\nabla \cdot \mathbf E=\int_{\text{all space}} \nabla\cdot\left(\dfrac{\hat{\mathscr{r}} }{{{\mathscr r}}^2}\right) \rho(r^\prime) d\tau^\prime$$

I don't understand why it is $$\nabla\cdot\left(\dfrac{\hat{\mathscr r} }{{\mathscr r}^2}\right)$$ not $$\nabla\cdot\left(\dfrac{\hat{\mathscr r} }{{\mathscr r}^2}\rho(r^\prime) \right)$$ ?

Isn't $\nabla \cdot (f \mathbf{A}) = f\nabla \cdot (\mathbf {A}) + \mathbf{A} \cdot\nabla f$ not $\nabla \cdot (f \mathbf {A}) = f\nabla \cdot \mathbf{A}$ ?

$f$ is a real function and $\vec A$ is a vector function.

• $\nabla$ is a derivative with respect to the components of $r$. $r^\prime$ is an integration variable, which is independent of $r$. Therefore $\rho(r^\prime)$ is a constant for the purposes of evaluating the derivative, but $r^{\prime\prime} = r-r^\prime$ is not – By Symmetry Jul 10 '17 at 14:20
• @BySymmetry but $r$ is constant ? How can you take derivative wrt to a constant ? – user8277998 Jul 10 '17 at 14:25
• @123 I think BySymmetry means $r''$ in the first sentence. – Rumplestillskin Jul 10 '17 at 14:29
• It is a constant in the integral, but $\mathbf{E}$ is in general a function of $r$ and so we can take a derivative with respect to it. – By Symmetry Jul 10 '17 at 14:31
• @SRS Well the book used a weird kind of r. Capital $r$ is suggestive of radius of a sphere, so I did not use it. I don't know bold face :((, but I will look into it. – user8277998 Jul 10 '17 at 14:37

To see the connection, note that indeed, $$\nabla_r\cdot\left(\frac{\vec r - \vec r'}{\|\vec r - \vec r'\|^3} ~\rho(\vec r')\right) = \left(\nabla_r\cdot\frac{\vec r - \vec r'}{\|\vec r - \vec r'\|^3}\right) ~\rho(\vec r') + \left(\frac{\vec r - \vec r'}{\|\vec r - \vec r'\|^3} \right)\cdot\nabla_r\rho(\vec r'),$$ but the second term vanishes because $\vec r$ and $\vec r'$ are independent variables and therefore $\nabla_r \rho(r') = \vec 0$ is a vector of derivatives of constant expressions with respect to $\vec r$.
• A trivial question. What is the difference between $||\vec{r}-\vec{r}^\prime||$ and $|\vec{r}-\vec{r}^\prime|$? – SRS Jul 10 '17 at 14:48
• $|x|$ may mean many things and especially at the undergraduate level it usually refers to the absolute value function, $|q| = -q\text{ if } q < 0\text{ else } q,$ so I am using $\|\vec q\|$ to be a little more clear that I mean explicitly $\sqrt{q_x^2 + q_y^2 + q_z^2}.$ – CR Drost Jul 10 '17 at 14:50