矩阵迹的求导

关于矩阵迹的一些求导法则

一、迹的基本性质

  • 线性性质:$tr(\sum_ic_iA_i)=\sum_ic_itr(A_i)$
  • 转置不变性:$tr(A)=tr(A^T)$
  • 轮换不变性 $tr(ABC)=tr(BCA)=tr(CAB)$

注意:轮换不变性不等于交换性,例如$tr(ABC)\neq tr(ACB)$

二、范数与迹的关系

  1. $\Vert X\Vert_\mathcal{F}^2=tr(X^TX)=\sum_{i=1}^m\sum_{j=1}^na_{ij}^2$

三、迹的求导规则

  1. $\dfrac{\partial tr(AB)}{\partial A}=\dfrac{\partial tr(BA)}{\partial A}=B^T$

  2. $\dfrac{\partial tr(A^TB)}{\partial A}=\dfrac{\partial tr(BA^T)}{\partial A}=B$

  3. $\dfrac{\partial tr(A^TBA)}{\partial A}=BA+B^TA$

  4. $\dfrac{\partial (ABA^T)}{\partial A}=AB^T+AB$

  5. $\dfrac{\partial tr(AXBXC^T)}{\partial X}=A^TCX^TB^T+B^TX^TA^TC$

  6. $\dfrac{\partial tr(AXBX)}{\partial X}=A^TX^TB^T+B^TX^TA^T$

  7. $\dfrac{\partial tr(AXBX^T)}{\partial X}=A^TXB^T+AXB​$

  8. $\dfrac{\partial tr(A^TXB^T)}{\partial X}=\dfrac{\partial tr(AX^TB)}{\partial X}=AB$

  9. $\dfrac{\partial tr(A^TXB)}{\partial X}=AB^T$

  10. $\dfrac{\partial tr(A^TX^TXA)}{\partial X}=2XAA^T$

  11. $\dfrac{\partial tr[(XA-B)^T(XA-B)]}{\partial X}=2(XA-B)A^T$

    核心公式:$\nabla tr(XAX^TB)=B^TXA^T+BXA$