矩阵二次型微分证明
22 Jun 2020分不分转置,在很多地方习惯也不一样
一个众所周知的结论:
\[\frac{\partial}{\partial x} x^{T} A x = (A + A^{T})x\]证明过程:
\[x^{T} A x=\left[x_{1}, x_{2}, \cdots, x_{n}\right]\left[\begin{array}{ccc} A_{11} & \cdots & A_{1 n} \\ \vdots & \ddots & \vdots \\ A_{n 1} & \cdots & A_{n n} \end{array}\right]\left[\begin{array}{c} x_{1} \\ x_{2} \\ \vdots \\ x_{n} \end{array}\right]=\sum_{i=1}^{n} \sum_{j=1}^{n} x_{i} A_{i j} x_{j}\] \[\frac{\partial}{\partial x_{1}} x^{T} A x=\frac{\partial}{\partial x_{1}} \sum_{i=1}^{n} \sum_{j=1}^{n} x_{i} A_{i j} x_{j}=\sum_{j=1}^{n} A_{1 j} x_{j}+\sum_{i=1}^{n} x_{i} A_{i 1}\]上面这个等式求偏导需要挑出所有包含 x1 的部分,可以写成(注意下标):
\[x_1\sum_{j=2}^{n} A_{1 j} x_{j}+\left(\sum_{i=2}^{n} x_{i} A_{i 1}\right)x_{1} + x_{1}A_{11}x_{1}\]最后一项,求导后前面多了个系数 2,可以分配给两个等式。
所以有:
\[\frac{\partial}{\partial x} x^{T} A x=\left[\frac{\partial}{\partial x_{1}} x^{T} A x, \frac{\partial}{\partial x_{2}} x^{T} A x, \cdots, \frac{\partial}{\partial x_{n}} x^{T} A x\right]^{T}\] \[=\left[\sum_{j=1}^{n} A_{1 j} x_{j}+\sum_{i=1}^{n} x_{i} A_{i 1}, \sum_{j=1}^{n} A_{2 j} x_{j}+\sum_{i=1}^{n} x_{i} A_{i 2}, \cdots, \sum_{j=1}^{n} A_{n j} x_{j}+\sum_{i=1}^{n} x_{i} A_{i n}\right]^{T}\] \[=\left(x^{T} A+x^{T} A^{T}\right)^{T}=\left(A+A^{T}\right)x\]