# Why swapping between the derivative operator and this infinite sum leads to different results?

While working on a mathematical physical problem, i came across seemingly contradictory results.

Notations

Let's consider $$\mathbf{x}_1$$ to be the origin of a spherical coordinate system and $$\mathbf{x}_2$$ a point located at the $$z$$ axis a distance $$R$$ from the origin, i.e. $$R = \left| \mathbf{x}_2 - \mathbf{x}_1 \right|$$. We introduce the unit vector $$\mathbf{d} = (\mathbf{x}_1 - \mathbf{x}_2)/R = -\mathbf{\hat{e}}_z$$, where $$\mathbf{\hat{e}}_z$$ is the unit vector along the $$z$$ axis.

We denote by $$s$$ the distance from a given point $$\mathbf{x}$$ from $$\mathbf{x}_2$$ such that $$s = |\mathbf{s}|$$ with $$\mathbf{s} = \mathbf{x} - \mathbf{x}_2$$.

Problem statement

On the one hand, it can readily be checked that $$\left( \mathbf{e} \cdot \mathbf{\nabla}_2 \right) \left( \frac{1}{s} \right) = \frac{\mathbf{e} \cdot \mathbf{s}}{s^3} \, , \tag{1}$$

where $$\mathbf{\nabla}_2$$ denotes the gradient taken along $$\mathbf{e}$$ with respect to $$\mathbf{x}_2$$.

We note that $$\mathbf{e} \perp \mathbf{d}$$.

On the other hand, by expressing $$1/s$$ in terms of harmonics based at $$\mathbf{x}_1$$ such that $$\frac{1}{s} = \sum_{n=0}^\infty \frac{R^n}{r^{n+1}} \, P_n(\cos\theta)$$ where $$r = \left| \mathbf{x}-\mathbf{x}_1 \right|$$, $$\theta$$ is the polar angle in spherical coordinates (physics convention), and $$P_n$$ denotes Legendre polynomial of degree $$n$$.

Then, $$\left( \mathbf{e} \cdot \mathbf{\nabla}_2 \right) \left( \frac{1}{s} \right) = \sum_{n=0}^\infty -n R^{n-1} (\mathbf{e} \cdot \mathbf{d}) = 0 \, ,$$ since we have imposed that $$\mathbf{e} \perp \mathbf{d}$$. However, by direct calculation in Eq. $$(1)$$, the gradient does now necessarily vanish.

i have spend a couple hours today and most of the afternoon looking at this without understanding why.

In fact, i need the spherical harmonic representation for further calculations.

Any help or hint is highly appreciated.

Thank you,

The answer is straightforward. Here you have forgotten to take the derivative with respect to the spherical harmonic. We have $$\frac{1}{s} = \sum_{n=0}^\infty R^n \frac{\left( \mathbf{d} \cdot \mathbf{\nabla} \right)^n}{n!} \frac{1}{r} \, .$$
By noting that $$\left( \mathbf{e} \cdot \mathbf{\nabla}_2 \right) \mathbf{d} = -(1/R) \mathbf{e} \, ,$$ then \begin{align} \left( \mathbf{e} \cdot \mathbf{\nabla}_2 \right) \frac{1}{s} &= \sum_{n=0}^\infty R^n \left( - \frac{\mathbf{e} \cdot \mathbf{\nabla}}{R} \right) n \, \frac{\left( \mathbf{d} \cdot \mathbf{\nabla} \right)^{n-1}}{n!} \frac{1}{r} \, , \\ &= - \left( \mathbf{e} \cdot \mathbf{\nabla} \right) \sum_{n=0}^\infty R^n \frac{\left( \mathbf{d} \cdot \mathbf{\nabla} \right)^n}{n!} \frac{1}{r} \end{align} leading to the desired result your equation (1).