# 矩阵求导公式

1942人阅读 评论(0)

Y = A * X --> DY/DX = A'
Y = X * A --> DY/DX = A
Y = A' * X * B --> DY/DX = A * B'
Y = A' * X' * B --> DY/DX = B * A'

1. 矩阵Y对标量x求导：

Y = [y(ij)] --> dY/dx = [dy(ji)/dx]

2. 标量y对列向量X求导：

y = f(x1,x2,..,xn) --> dy/dX = (Dy/Dx1,Dy/Dx2,..,Dy/Dxn)'

3. 行向量Y'对列向量X求导：

dX'/dX = I

d(AX)'/dX = A'

4. 列向量Y对行向量X’求导：

dY/dX' = (dY'/dX)'

5. 向量积对列向量X求导运算法则：

d(UV')/dX = (dU/dX)V' + U(dV'/dX)

d(U'V)/dX = (dU'/dX)V + (dV'/dX)U'

d(X'A)/dX = (dX'/dX)A + (dA/dX)X' = IA + 0X' = A

d(AX)/dX' = (d(X'A')/dX)' = (A')' = A

d(X'AX)/dX = (dX'/dX)AX + (d(AX)'/dX)X = AX + A'X

6. 矩阵Y对列向量X求导：

7. 矩阵积对列向量求导法则：

d(uV)/dX = (du/dX)V + u(dV/dX)

d(UV)/dX = (dU/dX)V + U(dV/dX)

d(X'A)/dX = (dX'/dX)A + X'(dA/dX) = IA + X'0 = A

8. 标量y对矩阵X的导数：

dy/dX = [ Dy/Dx(ij) ]

y = U'XV = ΣΣu(i)x(ij)v(j) 于是 dy/dX = [u(i)v(j)] = UV'

y = U'X'XU 则 dy/dX = 2XUU'

y = (XU-V)'(XU-V) 则 dy/dX = d(U'X'XU - 2V'XU + V'V)/dX = 2XUU' - 2VU' + 0 = 2(XU-V)U'

9. 矩阵Y对矩阵X的导数：

10.乘积的导数

d(f*g)/dx=(df'/dx)g+(dg/dx)f'

d(x'Ax)=(d(x'')/dx)Ax+(d(Ax)/dx)(x'')=Ax+A'x   （注意：''是表示两次转置）

http://lzh21cen.blog.163.com/blog/static/145880136201051113615571/

http://hi.baidu.com/wangwen926/blog/item/eb189bf6b0fb702b720eec94.html

## Contents

• Notation
• Derivatives of Linear Products

## Notation

• d/dx (y) is a vector whose (i) element is dy(i)/dx
• d/dx (y) is a vector whose (i) element is dy/dx(i)
• d/dx (yT) is a matrix whose (i,j) element is dy(j)/dx(i)
• d/dx (Y) is a matrix whose (i,j) element is dy(i,j)/dx
• d/dX (y) is a matrix whose (i,j) element is dy/dx(i,j)

Note that the Hermitian transpose is not used because complex conjugates are not analytic.

In the expressions below matrices and vectors ABC do not depend on X.

## Derivatives of Linear Products

• d/dx (AYB) =A * d/dx (Y) * B
• d/dx (Ay) =A * d/dx (y)
• d/dx (xTA) =A
• d/dx (xT) =I
• d/dx (xTa) = d/dx (aTx) = a
• d/dX (aTXb) = abT
• d/dX (aTXa) = d/dX (aTXTa) = aaT
• d/dX (aTXTb) = baT
• d/dx (YZ) =Y * d/dx (Z) + d/dx (Y) * Z

• d/dx (Ax+b)TC(Dx+e) = ATC(Dx+e) DTCT(Ax+b)
• d/dx (xTCx) = (C+CT)x
• [C: symmetric]: d/dx (xTCx) = 2Cx
• d/dx (xTx) = 2x
• d/dx (Ax+b)T (Dx+e) = AT (Dx+e) DT (Ax+b)
• d/dx (Ax+b)T (Ax+b) = 2AT (Ax+b)
• [C: symmetric]: d/dx (Ax+b)TC(Ax+b) = 2ATC(Ax+b)
• d/dX (aTXTXb) = X(abT + baT)
• d/dX (aTXTXa) = 2XaaT
• d/dX (aTXTCXb) = CTXabT + CXbaT
• d/dX (aTXTCXa) = (C + CT)XaaT
• [C:Symmetric] d/dX (aTXTCXa) = 2CXaaT
• d/dX ((Xa+b)TC(Xa+b)) = (C+CT)(Xa+b)aT

## Derivatives of Cubic Products

• d/dx (xTAxxT) = (A+AT)xxT+xTAxI

## Derivatives of Inverses

• d/dx (Y-1) = -Y-1d/dx (Y)Y-1

## Derivative of Trace

Note: matrix dimensions must result in an n*n argument for tr().

• d/dX (tr(X)) = I
• d/dX (tr(Xk)) =k(Xk-1)T
• d/dX (tr(AXk)) = SUMr=0:k-1(XrAXk-r-1)T
• d/dX (tr(AX-1B)) = -(X-1BAX-1)T
• d/dX (tr(AX-1)) =d/dX (tr(X-1A)) = -X-TATX-T
• d/dX (tr(ATXBT)) = d/dX (tr(BXTA)) = AB
• d/dX (tr(XAT)) = d/dX (tr(ATX)) =d/dX (tr(XTA)) = d/dX (tr(AXT)= A
• d/dX (tr(AXBXT)) = ATXBT AXB
• d/dX (tr(XAXT)) = X(A+AT)
• d/dX (tr(XTAX)) = XT(A+AT)
• d/dX (tr(AXTX)) = (A+AT)X
• d/dX (tr(AXBX)) = ATXTBT BTXTAT
• [C:symmetric] d/dX (tr((XTCX)-1A) = d/dX (tr(A (XTCX)-1) = -(CX(XTCX)-1)(A+AT)(XTCX)-1
• [B,C:symmetric] d/dX (tr((XTCX)-1(XTBX)) = d/dX (tr( (XTBX)(XTCX)-1) = -2(CX(XTCX)-1)XTBX(XTCX)-1 + 2BX(XTCX)-1

## Derivative of Determinant

Note: matrix dimensions must result in an n*n argument for det().

• d/dX (det(X)) = d/dX (det(XT)) = det(X)*X-T
• d/dX (det(AXB)) = det(AXB)*X-T
• d/dX (ln(det(AXB))) = X-T
• d/dX (det(Xk)) = k*det(Xk)*X-T
• d/dX (ln(det(Xk))) = kX-T
• [Real] d/dX (det(XTCX)) = det(XTCX)*(C+CT)X(XTCX)-1
• [CReal,Symmetric] d/dX (det(XTCX)) = 2det(XTCX)* CX(XTCX)-1
• [CReal,Symmetricc] d/dX (ln(det(XTCX))) = 2CX(XTCX)-1

## Jacobian

If y is a function of x, then dyT/dx is the Jacobian matrix of y with respect to x.

Its determinant, |dyT/dx|, is the Jacobian of y with respect to x and represents the ratio of the hyper-volumes dy and dx. The Jacobian occurs when changing variables in an integration: Integral(f(y)dy)=Integral(f(y(x)) |dyT/dx| dx).

## Hessian matrix

If f is a function of x then the symmetric matrix d2f/dx2 d/dxT(df/dx) is the Hessian matrix of f(x). A value of x for which df/dx 0 corresponds to a minimum, maximum or saddle point according to whether the Hessian is positive definite, negative definite or indefinite.

• d2/dx2 (aTx) = 0
• d2/dx2 (Ax+b)TC(Dx+e) = ATCD DTCTA
• d2/dx2 (xTCx) = C+CT
• d2/dx2 (xTx) = 2I
• d2/dx2 (Ax+b)T (Dx+e) = ATD DTA
• d2/dx2 (Ax+b)T (Ax+b) = 2ATA
• [C: symmetric]: d2/dx2 (Ax+b)TC(Ax+b) = 2ATCA
http://www.psi.toronto.edu/matrix/calculus.html

0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：7123087次
• 积分：85057
• 等级：
• 排名：第17名
• 原创：71篇
• 转载：4341篇
• 译文：2篇
• 评论：861条
公告
声明：早期转载的文章未标明转载敬请原谅，以后将陆续改过来，向原创者致敬！

文章分类