Compute $\frac{\partial \ln|A+B|}{\partial a_{ij}}$

67 Views Asked by At

before diving into the question, i admit that i don't know anything about matrix calculus, but i need it for my master thesis.
Given two symmetric matrices $A,B \in \mathbb{R}^{n \times n}$, i need to compute $\frac{\partial \ln|A+B|}{\partial a_{ij}}$. From the matrix notebook i know that $\frac{\partial \ln|A|}{\partial A} = A^{-T}$. Then, i've done this derivation:
$ \begin{align} \frac{\partial \ln|A+B|}{\partial a_{ij}} = \frac{\partial \ln|A+B|}{\partial (A+B)} \frac{\partial(A+B)}{\partial a_{ij}} = (A+B)^{-T}\frac{\partial A}{\partial a_{ij}} = (A+B)^{-T}J_{ij} \end{align} $
where $J_{ij}$ is the $n \times n$ matrix with only a 1 in position $(i,j)$ and 0 elsewhere.
Is it somehow corret?

2

There are 2 best solutions below

7
On BEST ANSWER

I suggest you to use Einstein Notation.

Let's define: $f(\mathbf{A}) = f^*(\mathbf{A} + \mathbf{B}) = \ln(|\det(\mathbf{A}+\mathbf{B})|)$

From Equation (57) of the matrix cookbook:

$$ \frac{\partial\,f^*(\mathbf{A}+\mathbf{B})}{\partial\,(A+B)_{pq}} = (A+B)_{pq}^{-T}$$


Since $\mathbf{B}$ does not depend on $\mathbf{A}$, we have:

$$\frac{\partial\,(A+B)_{pq}}{\partial A_{ij}} = \frac{\partial A_{pq}}{\partial A_{ij}} = \delta_{pi}\,\delta_{jq} $$

where $\delta$ is the Kronecker delta.


Therefore:

$$ \frac{\partial\,f(\mathbf{A})}{\partial A_{ij}} = \frac{\partial f^*(\mathbf{A}+\mathbf{B})}{\partial\,(A+B)_{pq}} \,\cdot\, \frac{\partial\,(A+B)_{pq}}{\partial A_{ij}} = (A+B)_{pq}^{-T}\,\delta_{pi}\,\delta_{jq} = (A+B)_{ij}^{-T}$$

In matrix notation:

$$\boxed{\frac{\partial\,f(\mathbf{A})}{\partial \mathbf{A}} = \mathbf{(A+B)^{-T}}}$$

0
On

$\def\p{{\partial}}\def\grad#1#2{\frac{\p #1}{\p #2}}$For typing convenience, define the matrix variable $$X = A+B = X^T \quad\implies\quad dX=dA$$ and the trace/Frobenius product $$\eqalign{ A:B &= \sum_{i=1}^m \sum_{j=1}^n A_{ij} B_{ij} \;=\; {\rm Tr}(AB^T) \\ A:A &= \big\|A\big\|_F^2 \\ }$$ Write the function using the above notation, then use Jacobi's formula to calculate the differential and gradient. $$\eqalign{ \phi &= \log\det X \\ d\phi &= X^{-T}:dX = (A+B)^{-T}:dA \\ \grad{\phi}{A} &= (A+B)^{-T} \\ }$$