# 梯度

$\int_M \mathrm{d}\omega = \oint_{\partial M} \omega$

## 形式化定义

$\nabla \varphi$$\operatorname{grad} \varphi$

$\nabla \varphi$在三维直角坐标中表示为

$\nabla \varphi =\begin{pmatrix} {\frac{\partial \varphi}{\partial x}}, {\frac{\partial \varphi}{\partial y}}, {\frac{\partial \varphi}{\partial z}} \end{pmatrix}$

### 范例

$\nabla \varphi = \begin{pmatrix} {\frac{\partial \varphi}{\partial x}}, {\frac{\partial \varphi}{\partial y}}, {\frac{\partial \varphi}{\partial z}} \end{pmatrix} = \begin{pmatrix} {2}, {6y}, {-\cos (z)} \end{pmatrix}$

## 实标量函数的梯度[來源請求]

$\nabla_{\boldsymbol{x}} \overset{\underset{\mathrm{def}}{}}{=} \left[ \frac{\partial }{\partial x_1}, \frac{\partial }{\partial x_2},\cdots,\frac{\partial }{\partial x_n} \right]^T=\frac{\partial }{\partial \boldsymbol{x}}$[來源請求]

### 对向量的梯度

$\nabla_{\boldsymbol{x}} f(\boldsymbol{x})\overset{\underset{\mathrm{def}}{}}{=} \left[ \frac{\partial f(\boldsymbol{x})}{\partial x_1}, \frac{\partial f(\boldsymbol{x})}{\partial x_2},\cdots,\frac{\partial f(\boldsymbol{x})}{\partial x_n} \right]^T=\frac{\partial f(\boldsymbol{x})}{\partial \boldsymbol{x}}$

m维行向量函数$\boldsymbol{f}(\boldsymbol{x})=[f_1(\boldsymbol{x}),f_2(\boldsymbol{x}),\cdots,f_m(\boldsymbol{x})]$相对于n维实向量x的梯度为一n×m矩阵，定义为

$\nabla_{\boldsymbol{x}} \boldsymbol{f}(\boldsymbol{x})\overset{\underset{\mathrm{def}}{}}{=} \begin{bmatrix} \frac{\partial f_1(\boldsymbol{x})}{\partial x_1} &\frac{\partial f_2(\boldsymbol{x})}{\partial x_1} & \cdots & \frac{\partial f_m(\boldsymbol{x})}{\partial x_1} \\ \frac{\partial f_1(\boldsymbol{x})}{\partial x_2} &\frac{\partial f_2(\boldsymbol{x})}{\partial x_2} & \cdots & \frac{\partial f_m(\boldsymbol{x})}{\partial x_2} \\ \vdots &\vdots & \ddots & \vdots \\ \frac{\partial f_1(\boldsymbol{x})}{\partial x_n} &\frac{\partial f_2(\boldsymbol{x})}{\partial x_n} & \cdots &\frac{\partial f_m(\boldsymbol{x})}{\partial x_n} \\ \end{bmatrix}=\frac{\partial \boldsymbol{f}(\boldsymbol{x})}{\partial \boldsymbol{x}}$

### 对矩阵的梯度

$\nabla_{\boldsymbol{A}} \boldsymbol f(\boldsymbol{A})\overset{\underset{\mathrm{def}}{}}{=} \begin{bmatrix} \frac{\partial f(\boldsymbol{A})}{\partial a_{11}} &\frac{\partial f(\boldsymbol{A})}{\partial a_{12}} & \cdots & \frac{\partial f(\boldsymbol{A})}{\partial a_{1n}} \\ \frac{\partial f(\boldsymbol{A})}{\partial a_{21}} &\frac{\partial f(\boldsymbol{A})}{\partial a_{22}} & \cdots & \frac{\partial f(\boldsymbol{A})}{\partial a_{2n}} \\ \vdots &\vdots & \ddots & \vdots \\ \frac{\partial f(\boldsymbol{A})}{\partial a_{m1}} &\frac{\partial f(\boldsymbol{A})}{\partial a_{m2}} & \cdots &\frac{\partial f(\boldsymbol{A})}{\partial a_{mn}} \\ \end{bmatrix}=\frac{\partial \boldsymbol{f}(\boldsymbol{A})}{\partial \boldsymbol{A}}$

### 法则

• 线性法则：若$f(\boldsymbol{A})$$g(\boldsymbol{A})$分别是矩阵A的实标量函数，c1和c2为实常数，则
$\frac{\partial [c_1 f(\boldsymbol{A})+c_2 g(\boldsymbol{A})]}{\partial \boldsymbol{A}}=c_1\frac{\partial f(\boldsymbol{A})}{\partial \boldsymbol{A}}+c_2 \frac{\partial g(\boldsymbol{A})}{\partial \boldsymbol{A}}$
• 乘积法则：若$f(\boldsymbol{A})$$g(\boldsymbol{A})$$h(\boldsymbol{A})$分别是矩阵A的实标量函数，则
$\frac{\partial f(\boldsymbol{A})g(\boldsymbol{A})}{\partial \boldsymbol{A}}=g(\boldsymbol{A})\frac{\partial f(\boldsymbol{A})}{\partial \boldsymbol{A}}+f(\boldsymbol{A}) \frac{\partial g(\boldsymbol{A})}{\partial \boldsymbol{A}}$
$\frac{\partial f(\boldsymbol{A})g(\boldsymbol{A})h(\boldsymbol{A})}{\partial \boldsymbol{A}}=g(\boldsymbol{A})h(\boldsymbol{A})\frac{\partial f(\boldsymbol{A})}{\partial \boldsymbol{A}}+f(\boldsymbol{A})h(\boldsymbol{A})\frac{\partial g(\boldsymbol{A})}{\partial \boldsymbol{A}}+f(\boldsymbol{A})g(\boldsymbol{A})\frac{\partial h(\boldsymbol{A})}{\partial \boldsymbol{A}}$
• 商法则：若$g(\boldsymbol{A})\neq 0$，则
$\frac{\partial f(\boldsymbol{A})/ g(\boldsymbol{A})}{\partial \boldsymbol{A}}=\frac{1}{g(\boldsymbol{A})^2} \left[ g(\boldsymbol{A})\frac{\partial f(\boldsymbol{A})}{\partial \boldsymbol{A}}-f(\boldsymbol{A}) \frac{\partial g(\boldsymbol{A})}{\partial \boldsymbol{A}} \right]$
• 链式法则：若A为m×n矩阵，且$y=f(\boldsymbol{A})$$g (y)$分别是以矩阵A和标量y为变元的实标量函数，则
$\frac{\partial g(f(\boldsymbol{A})}{\partial \boldsymbol{A}}=\frac{d g (y)}{dy} \frac{\partial f(\boldsymbol{A})}{\partial \boldsymbol{A}}$

## 流形上的梯度

$\langle \nabla f, \xi \rangle := \xi f$

$\xi(f \mid_{p}) := \sum_j a_j(\frac{\partial}{\partial x_{j} }(f \circ \varphi^{-1}) \mid_{\varphi (p)})$

$\nabla f=\sum_{ik} g^{ik}\frac{\partial f}{\partial x^{k}}\frac{\partial}{\partial x^{i}}$

## 柱坐标下的梯度（$\nabla$）算符

$\nabla f(\rho,\theta,z) = \frac{\partial f}{\partial\rho} \mathbf{e}_{\rho} + \frac1{\rho}\frac{\partial f}{\partial\theta} \mathbf{e}_{\theta} + \frac{\partial f}{\partial z} \mathbf{e}_{z}$

## 球坐标下的梯度（$\nabla$）算符

$\nabla f(r,\theta,\phi) = \frac{\partial f}{\partial r} \mathbf{e}_{r} + \frac1{r}\frac{\partial f}{\partial\theta} \mathbf{e}_{\theta} + \frac1{r\sin \theta}\frac{\partial f}{\partial \phi} \mathbf{e}_{\phi}$

## 参考

### 书籍

• （中文）张贤科. 矩阵分析与应用. 清华大学出版社. 2004.9. ISBN 9787302092711.