# 机器人中常用矩阵等式
机器人相关领域看论文或推公式时, 经常会遇到一些不那么直观的矩阵等式需要查书确认. 这里简单汇总一下, 方便翻查.
I. 摘要
Name | Matrix Identities |
---|---|
[Identity 1] Matrix Trace | t r ( A B ) = t r ( B A ) {\rm tr}(\mathbf{A}\mathbf{B}) = {\rm tr}(\mathbf{B}\mathbf{A}) tr(AB)=tr(BA) |
[Identity 2-a] Derivative of Vector with Respect to Vector (Denominator-Layout Notation) | ∂ y ∂ x ≜ [ ∂ y 1 ∂ x 1 ∂ y 2 ∂ x 1 ⋯ ∂ y m ∂ x 1 ∂ y 1 ∂ x 2 ∂ y 2 ∂ x 2 ⋯ ∂ y m ∂ x 2 ⋮ ⋮ ⋱ ⋮ ∂ y 1 ∂ x n ∂ y 2 ∂ x n ⋯ ∂ y m ∂ x n ] \frac{\partial \mathbf{y}}{\partial \mathbf{x}} \triangleq \begin{bmatrix} \frac{\partial y_1}{\partial x_1} &\frac{\partial y_2}{\partial x_1} &\cdots &\frac{\partial y_m}{\partial x_1}\\ \frac{\partial y_1}{\partial x_2} &\frac{\partial y_2}{\partial x_2} &\cdots &\frac{\partial y_m}{\partial x_2}\\ \vdots &\vdots & \ddots &\vdots\\\frac{\partial y_1}{\partial x_n} &\frac{\partial y_2}{\partial x_n} &\cdots &\frac{\partial y_m}{\partial x_n}\end{bmatrix} ∂x∂y≜ ∂x1∂y1∂x2∂y1⋮∂xn∂y1∂x1∂y2∂x2∂y2⋮∂xn∂y2⋯⋯⋱⋯∂x1∂ym∂x2∂ym⋮∂xn∂ym |
[Identity 2-b] Derivative of Vector with Respect to Vector (Numerator-Layout Notation - in common use) | ∂ y ∂ x ≜ [ ∂ y 1 ∂ x 1 ∂ y 1 ∂ x 2 ⋯ ∂ y 1 ∂ x n ∂ y 2 ∂ x 1 ∂ y 2 ∂ x 2 ⋯ ∂ y 2 ∂ x n ⋮ ⋮ ⋱ ⋮ ∂ y m ∂ x 1 ∂ y m ∂ x 2 ⋯ ∂ y m ∂ x n ] \frac{\partial \mathbf{y}}{\partial \mathbf{x}} \triangleq \begin{bmatrix} \frac{\partial y_1}{\partial x_1} &\frac{\partial y_1}{\partial x_2} &\cdots &\frac{\partial y_1}{\partial x_n}\\ \frac{\partial y_2}{\partial x_1} &\frac{\partial y_2}{\partial x_2} &\cdots &\frac{\partial y_2}{\partial x_n}\\ \vdots &\vdots & \ddots &\vdots\\\frac{\partial y_m}{\partial x_1} &\frac{\partial y_m}{\partial x_2} &\cdots &\frac{\partial y_m}{\partial x_n}\end{bmatrix} ∂x∂y≜ ∂x1∂y1∂x1∂y2⋮∂x1∂ym∂x2∂y1∂x2∂y2⋮∂x2∂ym⋯⋯⋱⋯∂xn∂y1∂xn∂y2⋮∂xn∂ym |
[Identity 3] Derivative of Scale with Respect to Matrix (Denominator-Layout Notation) | ∂ f ∂ X ≜ [ ∂ f ∂ X 11 ∂ f ∂ X 12 ⋯ ∂ f ∂ X 1 n ∂ f ∂ X 21 ∂ f ∂ X 22 ⋯ ∂ f ∂ X 2 n ⋮ ⋮ ⋱ ⋮ ∂ f ∂ X m 1 ∂ f ∂ X m 2 ⋯ ∂ f ∂ X m n ] \frac{\partial f}{\partial \mathbf X} \triangleq \begin{bmatrix} \frac{\partial f}{\partial X_{11}} & \frac{\partial f}{\partial X_{12}} &\cdots & \frac{\partial f}{\partial X_{1n}} \\ \frac{\partial f}{\partial X_{21}} & \frac{\partial f}{\partial X_{22}} &\cdots & \frac{\partial f}{\partial X_{2n}} \\ \vdots &\vdots &\ddots &\vdots\\ \frac{\partial f}{\partial X_{m1}} & \frac{\partial f}{\partial X_{m2}} &\cdots & \frac{\partial f}{\partial X_{mn}} \end{bmatrix} ∂X∂f≜ ∂X11∂f∂X21∂f⋮∂Xm1∂f∂X12∂f∂X22∂f⋮∂Xm2∂f⋯⋯⋱⋯∂X1n∂f∂X2n∂f⋮∂Xmn∂f |
[Identity 4] Partial Derivative of a Matrix Trace of the First Order (1) | ∂ t r X Y ∂ X = ∂ t r Y X ∂ X = Y T \frac{\partial {\rm tr}{\mathbf X}{\mathbf Y}}{\partial \mathbf X} = \frac{\partial {\rm tr}{\mathbf Y} {\mathbf X}}{\partial \mathbf X} = {\mathbf Y}^{\small \rm T} ∂X∂trXY=∂X∂trYX=YT |
[Identity 5] Partial Derivative of a Matrix Trace of the First Order (2) | ∂ t r X T Y ∂ X = ∂ t r Y X T ∂ X = Y \frac{\partial {\rm tr}{{\mathbf X}^{\small\rm T}} {\mathbf Y}}{\partial \mathbf X} = \frac{\partial {\rm tr}{\mathbf Y} {{\mathbf X}^{\small\rm T}} } {\partial \mathbf X} = {\mathbf Y} ∂X∂trXTY=∂X∂trYXT=Y |
[Identity 6] Partial Derivative of a Matrix Trace of the Second Order (1) | ∂ t r X Z X T ∂ X = X Z T + X Z \frac{\partial {\rm tr}{\mathbf X}{\mathbf Z}{\mathbf X}^{\small \rm T}}{\partial \mathbf X} = {\mathbf X}{\mathbf Z}^{\small\rm T} + {\mathbf X}{\mathbf Z} ∂X∂trXZXT=XZT+XZ |
[Identity 7] Partial Derivative of a Matrix Trace of the Second Order (2) | ∂ t r X T Z X ∂ X = Z X + Z T X \frac{\partial {\rm tr} {{\mathbf X}^{\small \rm T}} {\mathbf Z}{\mathbf X}}{\partial \mathbf X} = {\mathbf Z}{\mathbf X} + {{\mathbf Z}^{\small\rm T}}{\mathbf X} ∂X∂trXTZX=ZX+ZTX |
[Identity 8-a] Partial Derivative of a Quadratic Form (Denominator-Layout Notation) | ∂ x T A x ∂ x = ( A + A T ) x \frac{\partial {\mathbf x}^{\small \rm T} \mathbf{A} {\mathbf x}}{\partial \mathbf{x}} = (\mathbf{A} + \mathbf{A}^{\small \rm T})\,\mathbf{x} ∂x∂xTAx=(A+AT)x |
[Identity 8-b] Partial Derivative of a Quadratic Form (Numerator-Layout Notation) | ∂ x T A x ∂ x = x T ( A + A T ) \frac{\partial {\mathbf x}^{\small \rm T} \mathbf{A} {\mathbf x}}{\partial \mathbf{x}} = \mathbf{x}^{\small\rm T}(\mathbf{A} + \mathbf{A}^{\small \rm T}) ∂x∂xTAx=xT(A+AT) |
[Identity 9] Vector Triple Product | A × ( B × C ) = B ( A ⋅ C ) − C ( A ⋅ B ) \mathbf{A}\times (\mathbf{B} \times \mathbf{C}) = \mathbf{B}(\mathbf{A}\cdot\mathbf{C}) - \mathbf{C}(\mathbf{A}\cdot\mathbf{B}) A×(B×C)=B(A⋅C)−C(A⋅B) |
[Identity 10] Matrix Inversion lemmas | ( A − B D − 1 C ) − 1 = A − 1 + A − 1 B ( D − C A − 1 B ) − 1 C A − 1 (\mathbf{A}- {\mathbf{B}} {\mathbf{D}^{-1}}{\mathbf{C}})^{-1} = \mathbf{A}^{-1}+\mathbf{A}^{-1}\mathbf{B}(\mathbf{D}-\mathbf{C}{\mathbf{A}^{-1}}\mathbf{B})^{-1} \mathbf{C}\mathbf{A}^{-1} (A−BD−1C)−1=A−1+A−1B(D−CA−1B)−1CA−1 |
" | ( D − C A − 1 B ) − 1 = D − 1 + D − 1 C ( A − B D − 1 C ) − 1 B D − 1 (\mathbf{D}-\mathbf{C}{\mathbf{A}^{-1}}\mathbf{B})^{-1} = \mathbf{D}^{-1} + {\mathbf{D}^{-1}}\mathbf{C}(\mathbf{A}- {\mathbf{B}} {\mathbf{D}^{-1}}{\mathbf{C}})^{-1} \mathbf{B}\mathbf{D}^{-1} (D−CA−1B)−1=D−1+D−1C(A−BD−1C)−1BD−1 |
" | A − 1 B ( D − C A − 1 B ) − 1 = ( A − B D − 1 C ) − 1 B D − 1 \mathbf{A}^{-1}\mathbf{B}(\mathbf{D}-\mathbf{C}{\mathbf{A}^{-1}}\mathbf{B})^{-1} = (\mathbf{A}- {\mathbf{B}} {\mathbf{D}^{-1}}{\mathbf{C}})^{-1} \mathbf{B}\mathbf{D}^{-1} A−1B(D−CA−1B)−1=(A−BD−1C)−1BD−1 |
" | ( D − C A − 1 B ) − 1 C A − 1 = D − 1 C ( A − B D − 1 C ) − 1 (\mathbf{D}-\mathbf{C}{\mathbf{A}^{-1}}\mathbf{B})^{-1}\mathbf{C}\mathbf{A}^{-1} = {\mathbf{D}^{-1}}\mathbf{C}(\mathbf{A}- {\mathbf{B}} {\mathbf{D}^{-1}}{\mathbf{C}})^{-1} (D−CA−1B)−1CA−1=D−1C(A−BD−1C)−1 |
" | ( A + B C ) − 1 = A − 1 − A − 1 B ( I + C A − 1 B ) − 1 C A − 1 (\mathbf{A}+ {{\mathbf{B}}} {\mathbf{C}})^{-1} = \mathbf{A}^{-1} - \mathbf{A}^{-1}{\mathbf{B}}(\mathbf{I}+\mathbf{C}{\mathbf{A}^{-1}}{\mathbf{B}})^{-1} \mathbf{C}\mathbf{A}^{-1} (A+BC)−1=A−1−A−1B(I+CA−1B)−1CA−1 |
[补充一]
Name | Matrix Identities |
---|---|
[Identity 11] Identity About Rotation | [ R θ ] × = R [ θ ] × R T [\mathbf{R}\boldsymbol\theta]_{\times} = \mathbf{R}[\boldsymbol{\theta}]_{\times}\mathbf{R}^{\small\rm T} [Rθ]×=R[θ]×RT |
[Identity 12] Identity About Skew-Symmetric Matrix | x T [ θ ] × x = 0 \mathbf{x}^{\rm \small T} [\boldsymbol\theta]_{\times} \mathbf{x} = 0 xT[θ]×x=0 |
[补充二]
Name | Matrix Identities |
---|---|
[Identity 13-a] Derivative of a Matrix’s Determinant | ∂ d e t ( A ) ∂ A = a d j ( A ) T = ( d e t ( A ) A − 1 ) T \frac{\partial {\rm det}(\mathbf{A})}{\partial \mathbf{A}} = {\rm adj}(\mathbf{A})^{\rm T} = \left({\rm det}(\mathbf{A}) \mathbf{A}^{-1} \right)^{\rm T} ∂A∂det(A)=adj(A)T=(det(A)A−1)T |
[Identity 13-b] Derivative of a Rotation Matrix’s Determinant | ∂ d e t ( R ) ∂ R = R \frac{\partial {\rm det}(\mathbf{R})}{\partial \mathbf{R}} = \mathbf{R} ∂R∂det(R)=R |
[Identity 14-a] Derivative of a Matrix Trace | ∂ t r [ A X B ] ∂ X = A T B T \frac{\partial {\rm tr}[\mathbf{AXB}]}{\partial \mathbf{X}} = {\mathbf{A}^{\small\rm T}}\, {\mathbf{B}^{\small \rm T}} ∂X∂tr[AXB]=ATBT |
[Identity 14-b] Derivative of a Matrix Trace | ∂ t r [ A X T B ] ∂ X = B A \frac{\partial {\rm tr}[\mathbf{A} {\mathbf{X}^{\small\rm T}} \mathbf{B}]}{\partial \mathbf{X}} = {\mathbf{B}}{\mathbf{A}} ∂X∂tr[AXTB]=BA |
II. 具体展开及证明
[Identity 1] ~ [Identity 6] 的证明请参看
[Identity 7] ~ [Identity 10] 的证明请参看
[Identity 11] ~ [Identity 14] 的证明请参看