Notes

Vector calculus background for lensing

A compact companion note for the polar-coordinate divergence formula, the two-dimensional divergence theorem, and the delta-function identity used in the lensing derivation.

一篇配套背景笔记,解释透镜推导中用到的极坐标散度公式、二维散度定理,以及二维 delta 函数恒等式。

Background for the lensing kernel identity

The main derivation uses the identity

\[\nabla\cdot\left(\frac{\mathbf{x}}{|\mathbf{x}|^2}\right)=2\pi\delta^{(2)}(\mathbf{x}).\]

This page separates the vector-calculus background from the lensing calculation itself.

1. Polar divergence for a radial field

Consider a two-dimensional radial vector field

\[\mathbf{F}=f(r)\hat{\mathbf{r}}.\]

Here \(r\) is the distance from the origin and \(\hat{\mathbf{r}}\) is the outward radial unit vector. The field has no angular component.

Think of divergence as net outward flux per unit area. Take a very small annular sector with radius from \(r\) to \(r+\mathrm{d}r\) and angular width \(\mathrm{d}\phi\). Its area is approximately

\[\mathrm{d}A\simeq r\,\mathrm{d}r\,\mathrm{d}\phi.\]

Only the inner and outer circular arcs contribute to the flux. The outer flux is

\[f(r+\mathrm{d}r)(r+\mathrm{d}r)\,\mathrm{d}\phi,\]

while the inner boundary has outward normal \(-\hat{\mathbf{r}}\), so its contribution is

\[-f(r)r\,\mathrm{d}\phi.\]

The net outward flux through the small sector is therefore

\[\mathrm{d}\Phi= \left[f(r+\mathrm{d}r)(r+\mathrm{d}r)-f(r)r\right]\mathrm{d}\phi.\]

Dividing by the area and taking the limit gives

\[\nabla\cdot\left(f(r)\hat{\mathbf{r}}\right) = \lim_{\mathrm{d}r\to0} \frac{f(r+\mathrm{d}r)(r+\mathrm{d}r)-f(r)r} {r\,\mathrm{d}r}.\]

If \(g(r)=rf(r)\), the numerator is \(g(r+\mathrm{d}r)-g(r)\). This is exactly the derivative definition, so

\[\nabla\cdot\left(f(r)\hat{\mathbf{r}}\right) = \frac{1}{r}\frac{\mathrm{d}}{\mathrm{d}r}\left(rf(r)\right).\]

The extra factor \(r\) is not mysterious: at larger radius, the circular boundary is longer.

2. The two-dimensional divergence theorem

For a region \(D\) with boundary \(\partial D\), the divergence theorem says

\[\int_D \nabla\cdot\mathbf{F}\,\mathrm{d}A = \oint_{\partial D}\mathbf{F}\cdot\hat{\mathbf{n}}\,\mathrm{d}s.\]

The left side adds up the source strength inside the region. The right side measures the total flux leaving through the boundary.

The intuitive reason is cancellation. If a region is split into many tiny cells, flux through a shared internal edge leaves one cell but enters the neighboring cell. Those internal contributions cancel pair by pair, leaving only the outer boundary.

For a tiny rectangle, the \(x\)-direction contribution is controlled by

\[F_x(x+\mathrm{d}x,y)-F_x(x,y) \simeq \frac{\partial F_x}{\partial x}\mathrm{d}x.\]

The same idea in the \(y\)-direction gives the local divergence. Adding all cells together turns local divergence into boundary flux.

3. Why the origin becomes a delta function

Apply the radial formula to

\[\mathbf{F}=\frac{\hat{\mathbf{r}}}{r}.\]

For \(r\ne0\), this gives

\[\nabla\cdot\left(\frac{\hat{\mathbf{r}}}{r}\right) = \frac{1}{r}\frac{\mathrm{d}}{\mathrm{d}r}\left(r\frac{1}{r}\right) = 0.\]

But this ordinary calculation is only allowed away from the origin. At \(r=0\), the vector field is singular.

Now take a disk \(D\) centered on the origin with radius \(R\). On its boundary, \(r=R\), \(\hat{\mathbf{n}}=\hat{\mathbf{r}}\), and \(\mathrm{d}s=R\,\mathrm{d}\phi\). The boundary flux is

\[\oint_{\partial D} \frac{\hat{\mathbf{r}}}{R}\cdot\hat{\mathbf{r}}\,R\,\mathrm{d}\phi = \int_0^{2\pi}\mathrm{d}\phi = 2\pi.\]

So the ordinary divergence is zero away from the origin, but any disk containing the origin has total contribution \(2\pi\). A usual function cannot do this if it is zero everywhere except at one point, because one point has zero area. A two-dimensional delta function is the notation for exactly this kind of point contribution:

\[\int_D \delta^{(2)}(\mathbf{x})\,\mathrm{d}^2x = \begin{cases} 1,& \mathbf{0}\in D,\\ 0,& \mathbf{0}\notin D. \end{cases}\]

Therefore, in the distribution sense,

\[\nabla\cdot\left(\frac{\hat{\mathbf{r}}}{r}\right) = \nabla\cdot\left(\frac{\mathbf{x}}{|\mathbf{x}|^2}\right) = 2\pi\delta^{(2)}(\mathbf{x}).\]

Returning to the lensing calculation uses \(\mathbf{x}=\mathbf{\theta}-\mathbf{\theta}'\), so this is the kernel identity needed in the main derivation.

透镜核函数恒等式的背景

主推导用到了这个恒等式:

\[\nabla\cdot\left(\frac{\mathbf{x}}{|\mathbf{x}|^2}\right)=2\pi\delta^{(2)}(\mathbf{x}).\]

这一页把其中的矢量微积分背景从透镜推导里单独拆出来。

1. 纯径向场的极坐标散度

考虑二维平面里的径向矢量场

\[\mathbf{F}=f(r)\hat{\mathbf{r}}.\]

这里 \(r\) 是到原点的距离,\(\hat{\mathbf{r}}\) 是向外的径向单位矢量。这个场没有角向分量。

可以先把散度理解成单位面积里的净流出量。取一个很小的环形扇区,半径从 \(r\) 到 \(r+\mathrm{d}r\),角宽为 \(\mathrm{d}\phi\)。它的面积近似为

\[\mathrm{d}A\simeq r\,\mathrm{d}r\,\mathrm{d}\phi.\]

因为矢量场只有径向分量,所以只有内外两条圆弧边界贡献通量。外边界的流出通量是

\[f(r+\mathrm{d}r)(r+\mathrm{d}r)\,\mathrm{d}\phi,\]

内边界的外法向量指向 \(-\hat{\mathbf{r}}\),所以内边界贡献为

\[-f(r)r\,\mathrm{d}\phi.\]

因此穿过这个小扇区的净流出通量是

\[\mathrm{d}\Phi= \left[f(r+\mathrm{d}r)(r+\mathrm{d}r)-f(r)r\right]\mathrm{d}\phi.\]

把净流出通量除以面积,再取极限,得到

\[\nabla\cdot\left(f(r)\hat{\mathbf{r}}\right) = \lim_{\mathrm{d}r\to0} \frac{f(r+\mathrm{d}r)(r+\mathrm{d}r)-f(r)r} {r\,\mathrm{d}r}.\]

如果令 \(g(r)=rf(r)\),分子就是 \(g(r+\mathrm{d}r)-g(r)\)。这正是导数定义,所以

\[\nabla\cdot\left(f(r)\hat{\mathbf{r}}\right) = \frac{1}{r}\frac{\mathrm{d}}{\mathrm{d}r}\left(rf(r)\right).\]

这个额外的 \(r\) 来自几何:半径越大,圆周边界越长。

2. 二维散度定理

对于区域 \(D\) 及其边界 \(\partial D\),散度定理说

\[\int_D \nabla\cdot\mathbf{F}\,\mathrm{d}A = \oint_{\partial D}\mathbf{F}\cdot\hat{\mathbf{n}}\,\mathrm{d}s.\]

左边把区域内部的源强度加起来。右边计算穿过边界向外流出的总通量。

直观原因是边界抵消。如果把一个大区域切成很多小格子,穿过内部共享边界的通量,对一个格子是流出,对相邻格子就是流入。内部边界会成对抵消,最后只剩下外边界。

对于一个很小的矩形,\(x\) 方向的贡献由

\[F_x(x+\mathrm{d}x,y)-F_x(x,y) \simeq \frac{\partial F_x}{\partial x}\mathrm{d}x\]

控制。\(y\) 方向同理。把所有小格子加起来,就把局部散度变成了外边界通量。

3. 为什么原点变成 delta 函数

把径向公式用于

\[\mathbf{F}=\frac{\hat{\mathbf{r}}}{r}.\]

在 \(r\ne0\) 的地方,

\[\nabla\cdot\left(\frac{\hat{\mathbf{r}}}{r}\right) = \frac{1}{r}\frac{\mathrm{d}}{\mathrm{d}r}\left(r\frac{1}{r}\right) = 0.\]

但这个普通求导只允许在原点以外做。在 \(r=0\) 处,这个矢量场是奇异的。

现在取一个以原点为中心、半径为 \(R\) 的圆盘 \(D\)。在圆周上,\(r=R\),\(\hat{\mathbf{n}}=\hat{\mathbf{r}}\),并且 \(\mathrm{d}s=R\,\mathrm{d}\phi\)。边界通量为

\[\oint_{\partial D} \frac{\hat{\mathbf{r}}}{R}\cdot\hat{\mathbf{r}}\,R\,\mathrm{d}\phi = \int_0^{2\pi}\mathrm{d}\phi = 2\pi.\]

所以普通散度在原点以外为零,但任何包含原点的圆盘都有总贡献 \(2\pi\)。如果一个普通函数除了一个点以外处处为零,它的面积积分应当为零,因为单独一个点没有面积。二维 delta 函数正是用来记录这种点贡献的符号:

\[\int_D \delta^{(2)}(\mathbf{x})\,\mathrm{d}^2x = \begin{cases} 1,& \mathbf{0}\in D,\\ 0,& \mathbf{0}\notin D. \end{cases}\]

因此,在分布意义下,

\[\nabla\cdot\left(\frac{\hat{\mathbf{r}}}{r}\right) = \nabla\cdot\left(\frac{\mathbf{x}}{|\mathbf{x}|^2}\right) = 2\pi\delta^{(2)}(\mathbf{x}).\]

回到透镜推导时取 \(\mathbf{x}=\mathbf{\theta}-\mathbf{\theta}'\),这就是主推导里需要的核函数恒等式。