# （二）实值函数相对于向量的梯度

#### 1、定义

${▽}_{x}f\left(x\right)=\left[\begin{array}{c}\frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{1}}\\ \frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{2}}\\ ⋮\\ \frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{n}}\end{array}\right]={\left[\begin{array}{cccc}\frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{1}},& \frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{2}},& ...,& \frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{n}}\end{array}\right]}^{T}=\frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }x}$

#### 2、拓展定义

2.1 实标量函数$f\left(x\right)$$f(x)$相对于1*n行向量${x}^{T}$$x^T$的梯度结果为1*n行向量，定义为

$\frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}^{T}}=\left[\begin{array}{cccc}\frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{1}},& \frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{2}},& ...,& \frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }{x}_{n}}\end{array}\right]={▽}_{{x}^{T}}f\left(x\right)$

2.2 m维行向量函数$f\left(x\right)=\left[\begin{array}{cccc}{f}_{1}\left(x\right),& {f}_{2}\left(x\right),& \dots ,& {f}_{m}\left(x\right)\end{array}\right]$$f(x)=\begin{bmatrix} f_{1}(x),&f_{2}(x),&…,&f_{m}(x) \end{bmatrix}$相对n维实向量$x$$x$($x$$x$默认是列向量)的梯度为一$n\ast m$$n*m$矩阵，定义为

$\frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }x}=\left[\begin{array}{cccc}\frac{\mathrm{\partial }{f}_{1}\left(x\right)}{\mathrm{\partial }{x}_{1}}& \frac{\mathrm{\partial }{f}_{2}\left(x\right)}{\mathrm{\partial }{x}_{1}}& ...& \frac{\mathrm{\partial }{f}_{m}\left(x\right)}{\mathrm{\partial }{x}_{1}}\\ \frac{\mathrm{\partial }{f}_{1}\left(x\right)}{\mathrm{\partial }{x}_{2}}& \frac{\mathrm{\partial }{f}_{2}\left(x\right)}{\mathrm{\partial }{x}_{2}}& ...& \frac{\mathrm{\partial }{f}_{m}\left(x\right)}{\mathrm{\partial }{x}_{2}}\\ ⋮& ⋮& & ⋮\\ \frac{\mathrm{\partial }{f}_{1}\left(x\right)}{\mathrm{\partial }{x}_{n}}& \frac{\mathrm{\partial }{f}_{2}\left(x\right)}{\mathrm{\partial }{x}_{n}}& ...& \frac{\mathrm{\partial }{f}_{m}\left(x\right)}{\mathrm{\partial }{x}_{n}}\end{array}\right]={▽}_{x}f\left(x\right)$

（1）若m*1向量函数$f\left(x\right)=y={\left[\begin{array}{cccc}{y}_{1},& {y}_{2},& \dots ,& {y}_{m}\end{array}\right]}^{T}$$f(x)=y=\begin{bmatrix} y_{1},&y_{2},&…,&y_{m} \end{bmatrix}^T$，其中${y}_{1},{y}_{2},\dots ,{y}_{m}$$y_{1},y_{2},…,y_{m}$是向量的标量函数。则一阶梯度
$\frac{\mathrm{\partial }y}{\mathrm{\partial }{x}^{T}}=\left[\begin{array}{cccc}\frac{\mathrm{\partial }{y}_{1}}{\mathrm{\partial }{x}_{1}}& \frac{\mathrm{\partial }{y}_{1}}{\mathrm{\partial }{x}_{2}}& ...& \frac{\mathrm{\partial }{y}_{1}}{\mathrm{\partial }{x}_{n}}\\ \frac{\mathrm{\partial }{y}_{2}}{\mathrm{\partial }{x}_{1}}& \frac{\mathrm{\partial }{y}_{2}}{\mathrm{\partial }{x}_{2}}& ...& \frac{\mathrm{\partial }{y}_{2}}{\mathrm{\partial }{x}_{n}}\\ ⋮& ⋮& & ⋮\\ \frac{\mathrm{\partial }{y}_{m}}{\mathrm{\partial }{x}_{1}}& \frac{\mathrm{\partial }{y}_{m}}{\mathrm{\partial }{x}_{2}}& ...& \frac{\mathrm{\partial }{y}_{m}}{\mathrm{\partial }{x}_{n}}\end{array}\right]$

（2）若$f\left(x\right)=\left[{x}_{1},{x}_{2},...,{x}_{n}\right]$$f(x)=[x_{1},x_{2},...,x_{n}]$，则
$\frac{\mathrm{\partial }{x}^{T}}{\mathrm{\partial }x}=I=\frac{\mathrm{\partial }f\left(x\right)}{\mathrm{\partial }x}（I是单位矩阵）$

$x=\left[{x}_{1},{x}_{2},{x}_{3}{\right]}^{T}$$x=[x_{1},x_{2},x_{3}]^T$，则${x}^{T}=\left[{x}_{1},{x}_{2},{x}_{3}\right]$$x^T=[x_{1},x_{2},x_{3}]$，所以
$\frac{\mathrm{\partial }{x}^{T}}{\mathrm{\partial }x}=\left[\begin{array}{ccc}\frac{\mathrm{\partial }{x}_{1}}{\mathrm{\partial }{x}_{1}}& \frac{\mathrm{\partial }{x}_{2}}{\mathrm{\partial }{x}_{1}}& \frac{\mathrm{\partial }{x}_{3}}{\mathrm{\partial }{x}_{1}}\\ \frac{\mathrm{\partial }{x}_{1}}{\mathrm{\partial }{x}_{2}}& \frac{\mathrm{\partial }{x}_{2}}{\mathrm{\partial }{x}_{2}}& \frac{\mathrm{\partial }{x}_{3}}{\mathrm{\partial }{x}_{2}}\\ \frac{\mathrm{\partial }{x}_{1}}{\mathrm{\partial }{x}_{3}}& \frac{\mathrm{\partial }{x}_{2}}{\mathrm{\partial }{x}_{3}}& \frac{\mathrm{\partial }{x}_{3}}{\mathrm{\partial }{x}_{3}}\end{array}\right]=\left[\begin{array}{ccc}1& 0& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}\right]=I$

#### 3、导出的基本公式

$A$$A$$y$$y$均与向量$x$$x$无关，有

（1）$\frac{\mathrm{\partial }{x}^{T}Ay}{\mathrm{\partial }x}=\frac{\mathrm{\partial }{x}^{T}}{\mathrm{\partial }x}Ay=Ay$$\frac{\partial x^TAy}{\partial x}=\frac{\partial x^T}{\partial x}Ay=Ay$

（2）$\frac{\mathrm{\partial }{y}^{T}Ax}{\mathrm{\partial }x}={A}^{T}y$$\frac{\partial y^TAx}{\partial x}=A^Ty$

（3）$\frac{\mathrm{\partial }{x}^{T}Ax}{\mathrm{\partial }x}=Ax+{A}^{T}x$$\frac{\partial x^TAx}{\partial x}=Ax+A^Tx$

（4）$\frac{\mathrm{\partial }{x}^{T}Ax}{\mathrm{\partial }x}=2Ax\left(A为对称矩阵,转置矩阵等于本身\right)$$\frac{\partial x^TAx}{\partial x}=2Ax(A为对称矩阵,转置矩阵等于本身)$

$\left({A}^{T}{\right)}^{T}=A$

$\left(A+B{\right)}^{T}={A}^{T}+{B}^{T}$

$\left(\lambda A{\right)}^{T}=\lambda {A}^{T}$

$\left(AB{\right)}^{T}={B}^{T}{A}^{T}$

[1]《矩阵分析与运用》第5章
[2]《线性代数》第二版

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120