I want to find derivative of matrix $(A^TA)^{-1/2}D(A^TA)^{-1/2}$ w.r.t. $A_{ij}$ where D is a diagonal matrix. Alternatively, it is okay too to have

$$\frac{\partial}{\partial A_{ij}} a^T(A^TA)^{-1/2}D(A^TA)^{-1/2}b$$

Is there any reference for such problem? I have the matrix cookbook which gives results when $D=I$. But how is this general form evaluating to?

To give more information, empirical distribution of diagonal of diagonal matrix D converges to some known distribution.

  • 1
    $\begingroup$ try matrixcalculus.org ... $\endgroup$
    – Suvrit
    Jun 11, 2021 at 23:55
  • $\begingroup$ I'm afraid it does not support square root of matrix. $\endgroup$
    – Daniel Li
    Jun 12, 2021 at 0:05

1 Answer 1


Since calculating the derivative of $B=(A^T A)^{-1}$ with respect to $A$ is familiar, $$dB=-(A^TA)^{-1}(dA^TA+A^TdA)(A^TA)^{-1},$$ let me compute the derivatives with respect to $B$, to focus on the square root difficulties. So we seek the derivative of $X=\sqrt{B}D\sqrt{B}$ with respect to the symmetric positive definite matrix $B$. Start from $$dX=(d\sqrt{B})D\sqrt B+\sqrt{B}D(d\sqrt{B}).$$ Vectorize, $$\text{vec}\,dX=\bigl[\sqrt{B} D\otimes I+I\otimes \sqrt{B}D\bigr]\,\text{vec}\,(d\sqrt{B}),$$ and use the identity $$\text{vec}\,(d\sqrt{B})=(\sqrt{B}\oplus\sqrt{B})^{-1}\,\text{vec}\,dB,$$ to arrive at $$\text{vec}\,d(\sqrt{B}D\sqrt{B})=\bigl[\sqrt{B} D\otimes I+I\otimes \sqrt{B}D\bigr]\,(\sqrt{B}\oplus\sqrt{B})^{-1}\,\text{vec}\,dB.$$ Here $\otimes$ and $\oplus$ are Kronecker products and sums.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.