While deriving the electric field from a dipole source, from the notes I am following I am required to process the following vector operation:
$$
\nabla \left(\frac{e^{jkr}}{r}\mathbf n\cdot \mathbf p\right)
$$
The same notes suggest to use the relation
$$
\nabla(f(r)\mathbf n\cdot \mathbf A) = \frac{f(r)}{r}\mathbf A + (\mathbf n \cdot \mathbf A)\mathbf n\left(\frac{\partial f(r)}{\partial r}-\frac{f(r)}{r}\right)
$$
Where $r$ is the radial coordinate, $\mathbf n$ is a unitary vector in the radial direction and $\mathbf p$ is the dipole moment.
I really struggle to understand how one would go about proving the relation above. I tried solving the gradient in spherical coordinates but didn't succeed. In particular, I believed the dot product on the left side left me with only the radial component of $A$, but then on the right side there is the full vector $A$ again. So here is where confusion arises.
What I am kindly asking is any hint on how to approach this.
Thank you.
2 Answers
Vectors $\vec{r}$ and $\vec{n}$ have components $$ \vec{r} = \left(x, y, z\right),~~~~ \vec{n} = \frac{\vec{r}}{r} = \left( \frac{x}{r} , \frac{y}{r}, \frac{z}{r} \right), $$ where $r = (x^2 + y^2+z^2)^{1/2}$. Then $\partial r/\partial x = x /(x^2 + y^2+z^2)^{1/2}$ etc, so $$ \nabla r = \vec{n} $$ and $$ \nabla f = \frac{\partial f}{\partial r} \nabla r = \frac{\partial f}{\partial r} \vec{n} $$ for any function $f = f(r)$. For any constant vector $\vec{A}$ we have $$ \nabla (\vec{n} \cdot \vec{A}) = \nabla \left( \frac{x A_x + y A_y + z A_z}{r} \right) . $$ Taking into account $\nabla ({x A_x + y A_y + z A_z}) = \vec{A}$ and $\nabla(1/r) = -\nabla{r}/r^2$ we get $$ \nabla (\vec{n} \cdot \vec{A}) = \frac{\vec{A}}{r} - \frac{(\vec{n} \cdot \vec{A}) \vec{n}}{r}. $$ Therefore $$ \nabla \left(f \vec{n} \cdot \vec{A} \right) = f \nabla (\vec{n} \cdot \vec{A}) + (\vec{n} \cdot \vec{A}) \nabla f = $$ $$ f \frac{\vec{A}}{r} + {(\vec{n} \cdot \vec{A}) \vec{n}} \left( \frac{\partial f}{\partial r} - \frac{f}{r} \right). $$
Let $u = f (\mathbf{a}:\mathbf{n})$ where $\mathbf{n}= \mathbf{r}/r$ and the colon operator denotes the (Frobenius) inner product. For vectors, it is the usual dot product.
\begin{eqnarray*} du &=& (\mathbf{a}:\mathbf{n}) df + f(\mathbf{a}:d\mathbf{n}) \\ &=& (\mathbf{a}:\mathbf{n}) \frac{\partial f}{\partial r} dr + f(\mathbf{a}:\mathbf{J}d\mathbf{r})\\ \frac{\partial u}{\partial \mathbf{r}} &=& (\mathbf{a}:\mathbf{n}) \frac{\partial f}{\partial r} \mathbf{n} + f (\mathbf{J}^T \mathbf{a}) \end{eqnarray*} where we use $dr=\mathbf{n}:d\mathbf{r}$.
The (symmetric) Jacobian is $$ \mathbf{J} = \frac{1}{r} \mathbf{I}- \frac{1}{r^3} \mathbf{r}\mathbf{r}^T = \frac{1}{r} \left(\mathbf{I}-\mathbf{n}\mathbf{n}^T \right) $$
This gives \begin{eqnarray} \frac{\partial u}{\partial \mathbf{r}} &=& (\mathbf{a}:\mathbf{n}) \frac{\partial f}{\partial r} \mathbf{n} + \frac{f}{r} \left[ \mathbf{a}- (\mathbf{a}:\mathbf{n})\mathbf{n} \right] \\ &=& \frac{f}{r}\mathbf{a}+ (\mathbf{a}:\mathbf{n}) \left[ \frac{\partial f}{\partial r}-\frac{f}{r} \right] \mathbf{n} \end{eqnarray}