# Derivative of matrix B with respect to matrix B

1. Jul 18, 2009

### Guillaume F.

1. The problem statement, all variables and given/known data
2. Relevant equations

Create an algorithm to calculate

$$\frac{\partial\mathbf{ABA'}} {\partial\mathbf{B}}$$

where $$\mathbf{B}$$ is a k x k symmetrical matrix.

3. The attempt at a solution

We know that

$$\frac{\partial\mathbf{ABA'}} {\partial\mathbf{B}} = \mathbf{A} \frac{\partial\mathbf{B}} {\partial\mathbf{B}} \mathbf{A'}.$$

Hence, we need to calculate $$\frac{\partial\mathbf{B}} {\partial\mathbf{B}}$$.

This will result in a four dimensional k x k x k x k array, with each element (:,:,i,j) corresponding to the matrix of partial derivative $$\frac{\partial\mathbf{B}} {\partial {B_{i,j}}}$$.

Furthermore, we know that

$$\frac{\partial{B_{g,h}}} {\partial {B_{i,j}}}$$ equals 1 if g = i and h = j, and 0 otherwise. Hence,

$$(\frac{\partial\mathbf{B}} {\partial\mathbf{B}})_{g,h,i,j}$$ will equal 1 when g = i and h = j, and 0 otherwise.

However, I am still not capable of finding a good way to build $$\frac{\partial\mathbf{B}} {\partial\mathbf{B}}$$. Could you help me on this one, or point me in a good direction?

Thanks,
Guillaume