Partial derivative with respect to a matrix

409 Views Asked by At

I am struggling on the derivative of a function with respect to a matrix. Let$f(B)=a^\prime_{1\times n} B_{n\times k}\left( B^{T}A_{n\times n}B\right) ^{-1}B^{T}a_{n\times 1}$, and $a$ is a $n\times 1$ vector of constant, $A_{n\times n}$ is a $n\times n$ full rank constant matrix, and $B_{n\times k}$ is a $n\times k$ matrix with rank $k$ (i.e., I assume $k<n$). What's partial derivative of $f(B)$ with respetive to $B$, i.e., $\frac{\partial f(B)}{\partial B}$? Thanks a lot!

1

There are 1 best solutions below

3
On BEST ANSWER

Define a new matrix variable and calculate the various differentials of it $$\eqalign{ M &= B^TAB \cr dM &= dB^T\,AB+B^TA\,dB \cr dM^{-1} &= -M^{-1}\,dM\,M^{-1} \cr }$$ Now write down the function and find the differential of it $$\eqalign{ f &= BM^{-1}B^T:aa^T \cr\cr df &= (dB\,M^{-1}B^T+B\,dM^{-1}\,B^T+BM^{-1}\,dB^T):aa^T \cr &= dB:aa^TBM^{-T} -BM^{-1}\,dM\,M^{-1}B^T:aa^T+aa^TBM^{-1}:dB \cr &= \Big(aa^TB(M^{-1}+M^{-T})-ABM^{-1}B^Taa^TBM^{-1}-A^TBM^{-T}B^Taa^TBM^{-T}\Big):dB \cr\cr \frac{\partial f}{\partial B} &= aa^TB(M^{-1}+M^{-T})-ABM^{-1}B^Taa^TBM^{-1}-A^TBM^{-T}B^Taa^TBM^{-T} \cr\cr }$$ In the above, colons are used to denote the trace/Frobenius product $$\eqalign{ A:B = {\rm tr}(A^TB) }$$