我们经常需要在一些问题中研究坐标系的关系,这里讲讲最常见的极坐标和直角坐标的雅克比矩阵的推导。以二维坐标为例,三维坐标也是同理。
直角坐标表示为 ( x , y ) (x,y) (x,y),极坐标表示为 ( ρ , φ ) (\rho,\varphi) (ρ,φ),它们之间有如下的关系:
ρ 2 = x 2 + y 2 , φ = arctan y x ; x = ρ cos φ , y = ρ sin φ \begin{aligned} \rho^2=x^2+y^2,\quad &\varphi=\arctan\frac{y}{x};\\ x=\rho\cos\varphi,\quad&y=\rho\sin\varphi \end{aligned} ρ2=x2+y2,x=ρcosφ,φ=arctanxy;y=ρsinφ
向量X和向量Y的微分映射由雅克比矩阵来刻画,给定两个向量 x = ( x 1 , x 2 , ⋯ , x n ) T \mathbf{x}=(x_1,x_2,\cdots,x_n)^T x=(x1,x2,⋯,xn)T, y = ( y 1 , y 2 , ⋯ , y m ) T \mathbf{y}=(y_1,y_2,\cdots,y_m)^T y=(y1,y2,⋯,ym)T
{ d x 1 = ∂ x 1 ∂ y 1 d y 1 + ∂ x 1 ∂ y 2 d y 2 + ⋯ + ∂ x 1 ∂ y m d y m d x 2 = ∂ x 2 ∂ y 1 d y 1 + ∂ x 2 ∂ y 2 d y 2 + ⋯ + ∂ x 2 ∂ y m d y m ⋮ d x n = ∂ x n ∂ y 1 d y 1 + ∂ x n ∂ y 2 d y 2 + ⋯ + ∂ x n ∂ y m d y m \begin{aligned} \begin{cases} \mathrm{d}x_1=\dfrac{\partial x_1}{\partial y_1}\mathrm{d}y_1+\dfrac{\partial x_1}{\partial y_2}\mathrm{d}y_2+\cdots+\dfrac{\partial x_1}{\partial y_m}\mathrm{d}y_m\\ \mathrm{d}x_2=\dfrac{\partial x_2}{\partial y_1}\mathrm{d}y_1+\dfrac{\partial x_2}{\partial y_2}\mathrm{d}y_2+\cdots+\dfrac{\partial x_2}{\partial y_m}\mathrm{d}y_m\\ \vdots\\ \mathrm{d}x_n=\dfrac{\partial x_n}{\partial y_1}\mathrm{d}y_1+\dfrac{\partial x_n}{\partial y_2}\mathrm{d}y_2+\cdots+\dfrac{\partial x_n}{\partial y_m}\mathrm{d}y_m\\ \end{cases} \end{aligned} ⎩ ⎨ ⎧dx1=∂y1∂x1dy1+∂y2∂x1dy2+⋯+∂ym∂x1dymdx2=∂y1∂x2dy1+∂y2∂x2dy2+⋯+∂ym∂x2dym⋮dxn=∂y1∂xndy1+∂y2∂xndy2+⋯+∂ym∂xndym
写成矩阵的形式就是:
( d x 1 d x 2 ⋮ d x n ) = [ ∂ x 1 ∂ y 1 ∂ x 1 ∂ y 2 ⋯ ∂ x 1 ∂ y m ∂ x 2 ∂ y 1 ∂ x 2 ∂ y 2 ⋯ ∂ x 2 ∂ y m ⋮ ⋮ ⋮ ∂ x n ∂ y 1 ∂ x n ∂ y 2 ⋯ ∂ x n ∂ y m ] ( d y 1 d y 2 ⋮ d y m ) \begin{pmatrix} \mathrm{d}x_1\\ \mathrm{d}x_2\\ \vdots\\ \mathrm{d}x_n \end{pmatrix} =\begin{bmatrix} \dfrac{\partial x_1}{\partial y_1} & \dfrac{\partial x_1}{\partial y_2} & \cdots & \dfrac{\partial x_1}{\partial y_m}\\ \dfrac{\partial x_2}{\partial y_1} & \dfrac{\partial x_2}{\partial y_2} & \cdots &\dfrac{\partial x_2}{\partial y_m} \\ \vdots & \vdots & & \vdots\\ \dfrac{\partial x_n}{\partial y_1} & \dfrac{\partial x_n}{\partial y_2} & \cdots &\dfrac{\partial x_n}{\partial y_m} \end{bmatrix}\begin{pmatrix} \mathrm{d}y_1\\ \mathrm{d}y_2\\ \vdots\\ \mathrm{d}y_m \end{pmatrix} dx1dx2⋮dxn = ∂y1∂x1∂y1∂x2⋮∂y1∂xn∂y2∂x1∂y2∂x2⋮∂y2∂xn⋯⋯⋯∂ym∂x1∂ym∂x2⋮∂ym∂xn dy1dy2⋮dym
其中的矩阵
∂ ( x 1 , x 2 , ⋯ , x n ) ∂ ( y 1 , y 2 , ⋯ , y m ) = [ ∂ x 1 ∂ y 1 ∂ x 1 ∂ y 2 ⋯ ∂ x 1 ∂ y m ∂ x 2 ∂ y 1 ∂ x 2 ∂ y 2 ⋯ ∂ x 2 ∂ y m ⋮ ⋮ ⋮ ∂ x n ∂ y 1 ∂ x n ∂ y 2 ⋯ ∂ x n ∂ y m ] \frac{\partial(x_1,x_2,\cdots,x_n)}{\partial(y_1,y_2,\cdots,y_m)}=\begin{bmatrix} \dfrac{\partial x_1}{\partial y_1} & \dfrac{\partial x_1}{\partial y_2} & \cdots & \dfrac{\partial x_1}{\partial y_m}\\ \dfrac{\partial x_2}{\partial y_1} & \dfrac{\partial x_2}{\partial y_2} & \cdots &\dfrac{\partial x_2}{\partial y_m} \\ \vdots & \vdots & & \vdots\\ \dfrac{\partial x_n}{\partial y_1} & \dfrac{\partial x_n}{\partial y_2} & \cdots &\dfrac{\partial x_n}{\partial y_m} \end{bmatrix} ∂(y1,y2,⋯,ym)∂(x1,x2,⋯,xn)= ∂y1∂x1∂y1∂x2⋮∂y1∂xn∂y2∂x1∂y2∂x2⋮∂y2∂xn⋯⋯⋯∂ym∂x1∂ym∂x2⋮∂ym∂xn
就是雅克比矩阵。我们称从坐标 y \mathbf{y} y(分母)到 x \mathbf{x} x(分子)的雅克比矩阵。
这个比较简单,利用关系 x = ρ cos φ , y = ρ sin φ x=\rho\cos\varphi,y=\rho\sin\varphi x=ρcosφ,y=ρsinφ,
∂ x ∂ ρ = cos φ , ∂ x ∂ φ = − ρ sin φ ∂ y ∂ ρ = sin φ , ∂ y ∂ φ = ρ cos φ \begin{aligned} \dfrac{\partial x}{\partial \rho}=\cos\varphi, & \dfrac{\partial x}{\partial \varphi}=-\rho\sin\varphi\\ \dfrac{\partial y}{\partial \rho}=\sin\varphi, &\dfrac{\partial y}{\partial \varphi}=\rho\cos\varphi \end{aligned} ∂ρ∂x=cosφ,∂ρ∂y=sinφ,∂φ∂x=−ρsinφ∂φ∂y=ρcosφ
我们可以写出雅克比矩阵
∂ ( x , y ) ∂ ( ρ , φ ) = [ ∂ x ∂ ρ ∂ x ∂ φ ∂ y ∂ ρ ∂ y ∂ φ ] = [ cos φ − ρ sin φ sin φ ρ cos φ ] \dfrac{\partial(x,y)}{\partial(\rho,\varphi)}=\begin{bmatrix} \dfrac{\partial x}{\partial \rho} & \dfrac{\partial x}{\partial \varphi}\\ \dfrac{\partial y}{\partial \rho} &\dfrac{\partial y}{\partial \varphi} \end{bmatrix}=\begin{bmatrix} \cos\varphi &-\rho\sin\varphi\\ \sin\varphi &\rho\cos\varphi \end{bmatrix} ∂(ρ,φ)∂(x,y)= ∂ρ∂x∂ρ∂y∂φ∂x∂φ∂y =[cosφsinφ−ρsinφρcosφ]
这里有两种方法。
利用关系 ρ 2 = x 2 + y 2 , φ = arctan y x \rho^2=x^2+y^2,\quad \varphi=\arctan\frac{y}{x} ρ2=x2+y2,φ=arctanxy,我们可以对上式直接应用求导
对于第一个式子: ρ = x 2 + y 2 \rho=\sqrt{x^2+y^2} ρ=x2+y2
直接求导有:
∂ ρ ∂ x = 2 x 2 x 2 + y 2 = x ρ = cos φ ∂ ρ ∂ y = 2 y 2 x 2 + y 2 = y ρ = sin φ \frac{\partial\rho}{\partial x}=\frac{2x}{2\sqrt{x^2+y^2}}=\frac{x}{\rho}=\cos\varphi\\ \frac{\partial\rho}{\partial y}=\frac{2y}{2\sqrt{x^2+y^2}}=\frac{y}{\rho}=\sin\varphi ∂x∂ρ=2x2+y22x=ρx=cosφ∂y∂ρ=2x2+y22y=ρy=sinφ
对于第二个式子直接求导有:
∂ φ ∂ x = − y x 2 1 + y 2 x 2 = − y x 2 + y 2 = − y ρ 2 = − sin φ ρ ∂ φ ∂ y = 1 x 1 + y 2 x 2 = x x 2 + y 2 = x ρ 2 = cos φ ρ \frac{\partial \varphi}{\partial x}=\frac{-\dfrac{y}{x^{2}}}{1+\dfrac{y^{2}}{x^{2}}}=\frac{-y}{x^{2}+y^{2}}=\frac{-y}{\rho^2}=\frac{-\sin\varphi}{\rho}\\ \frac{\partial \varphi}{\partial y}=\frac{\dfrac{1}{x}}{1+\dfrac{y^{2}}{x^{2}}}=\frac{x}{x^{2}+y^{2}}=\frac{x}{\rho^2}=\frac{\cos\varphi}{\rho} ∂x∂φ=1+x2y2−x2y=x2+y2−y=ρ2−y=ρ−sinφ∂y∂φ=1+x2y2x1=x2+y2x=ρ2x=ρcosφ
当然也可以用全微分的方法来求解,我们对第一个式子全微分:
2 ρ d ρ = 2 x d x + 2 y d y 2\rho\mathrm{d}\rho=2x\mathrm{d}x+2y\mathrm{d}y 2ρdρ=2xdx+2ydy
于是得到
d ρ = x ρ d x + y ρ d y \mathrm{d}\rho=\frac{x}{\rho}\mathrm{d}x+\frac{y}{\rho}\mathrm{d}y dρ=ρxdx+ρydy
于是有:
∂ ρ ∂ x = x ρ = cos φ , ∂ y ∂ ρ = y ρ = sin φ \dfrac{\partial \rho}{\partial x}=\frac{x}{\rho}=\cos\varphi, \dfrac{\partial y}{\partial \rho}=\frac{y}{\rho}=\sin\varphi ∂x∂ρ=ρx=cosφ,∂ρ∂y=ρy=sinφ
对第二个式子变换一下:
tan φ = y x \tan\varphi=\frac{y}{x} tanφ=xy
然后我们再求全微分:
1 cos 2 φ d φ = − y x 2 d x + 1 x d y \frac{1}{\cos^2\varphi}\mathrm{d}\varphi=-\frac{y}{x^2}\mathrm{d}x+\frac{1}{x}\mathrm{d}y cos2φ1dφ=−x2ydx+x1dy
于是得到
d φ = − y cos 2 φ x 2 d x + cos 2 φ x d y = − y ρ 2 d x + x ρ 2 d y = − sin φ ρ d x + cos φ ρ d y \mathrm{d}\varphi=-\frac{y\cos^2\varphi}{x^2}\mathrm{d}x+\frac{\cos^2\varphi}{x}\mathrm{d}y=-\frac{y}{\rho^2}\mathrm{d}x+\frac{x}{\rho^2}\mathrm{d}y=-\frac{\sin\varphi}{\rho}\mathrm{d}x+\frac{\cos\varphi}{\rho}\mathrm{d}y dφ=−x2ycos2φdx+xcos2φdy=−ρ2ydx+ρ2xdy=−ρsinφdx+ρcosφdy
于是有:
∂ φ ∂ x = − sin φ ρ , ∂ φ ∂ y = cos φ ρ \frac{\partial \varphi}{\partial x}=\frac{-\sin\varphi}{\rho}, \frac{\partial \varphi}{\partial y}=\frac{\cos\varphi}{\rho} ∂x∂φ=ρ−sinφ,∂y∂φ=ρcosφ
∂ ( ρ , φ ) ∂ ( x , y ) = [ ∂ ρ ∂ x ∂ ρ ∂ y ∂ φ ∂ x ∂ φ ∂ y ] = [ cos φ sin φ − sin φ ρ cos φ ρ ] \dfrac{\partial(\rho,\varphi)}{\partial(x,y)}=\begin{bmatrix} \dfrac{\partial \rho}{\partial x} & \dfrac{\partial \rho}{\partial y}\\ \dfrac{\partial \varphi}{\partial x}&\dfrac{\partial \varphi}{\partial y} \end{bmatrix}=\begin{bmatrix} \cos\varphi &\sin\varphi\\ \dfrac{-\sin\varphi}{\rho}&\dfrac{\cos\varphi}{\rho} \end{bmatrix} ∂(x,y)∂(ρ,φ)= ∂x∂ρ∂x∂φ∂y∂ρ∂y∂φ = cosφρ−sinφsinφρcosφ
这里刚好是一个二阶方阵,所以可以直接对3中的雅克比矩阵求逆:
∂ ( ρ , φ ) ∂ ( x , y ) = ( ∂ ( x , y ) ∂ ( ρ , φ ) ) − 1 = [ cos φ − ρ sin φ sin φ ρ cos φ ] − 1 = [ cos φ sin φ − sin φ ρ cos φ ρ ] \dfrac{\partial(\rho,\varphi)}{\partial(x,y)}=\left(\dfrac{\partial(x,y)}{\partial(\rho,\varphi)}\right)^{-1}=\begin{bmatrix} \cos\varphi &-\rho\sin\varphi\\ \sin\varphi &\rho\cos\varphi \end{bmatrix}^{-1}{}=\begin{bmatrix} \cos\varphi &\sin\varphi\\ \dfrac{-\sin\varphi}{\rho}&\dfrac{\cos\varphi}{\rho} \end{bmatrix} ∂(x,y)∂(ρ,φ)=(∂(ρ,φ)∂(x,y))−1=[cosφsinφ−ρsinφρcosφ]−1= cosφρ−sinφsinφρcosφ