# 梯度

$\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.