Matrix calculus
Derivative of linear function:
∂xTa∂x=a
∂aTx∂x=a
∂xTXb∂X=abT
∂xTXTb∂X=baTDerivative of quadratic function:
∂bTXTXc∂X=X(bcT+cbT)
∂(Bx+b)TC(Dx+d)∂x=BTC(Dx+d)+DTCT(Bx+b)
∂xTBx∂x=(B+BT)x
∂bTXTDXc∂X=DTXbcT+DXcbTDerivative of determinant:
∂det[Y]∂x=det[T]tr[Y−1∂Y∂x]
∂det[Y]∂Y=det[Y]Y−TDerivative of log determinant:
∂log[det[Y]]∂Y=Y−TDerivative of inverse:
∂Y−1∂x=−Y−1∂Y∂xY−1Derivative of trace:
∂tr[F[X]]∂X=(∂F[X]∂X)T