Derivative of matrix B with respect to matrix B

In summary: Your Name]In summary, the conversation is about creating an algorithm to calculate the partial derivative of a matrix product, specifically \frac{\partial\mathbf{ABA'}} {\partial\mathbf{B}} where \mathbf{B} is a k x k symmetrical matrix. The suggested approach is to use the chain rule and the Kronecker delta function to simplify the algorithm. This way, a four-dimensional array can be avoided and the computation can be made more efficient.
  • #1
Guillaume F.
1
0

Homework Statement


Homework Equations



Create an algorithm to calculate

[tex] \frac{\partial\mathbf{ABA'}} {\partial\mathbf{B}} [/tex]

where [tex]\mathbf{B}[/tex] is a k x k symmetrical matrix.

The Attempt at a Solution



We know that

[tex] \frac{\partial\mathbf{ABA'}} {\partial\mathbf{B}} =
\mathbf{A} \frac{\partial\mathbf{B}} {\partial\mathbf{B}} \mathbf{A'}.
[/tex]

Hence, we need to calculate [tex] \frac{\partial\mathbf{B}} {\partial\mathbf{B}} [/tex].

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 [tex] \frac{\partial\mathbf{B}} {\partial {B_{i,j}}} [/tex].

Furthermore, we know that

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

[tex] (\frac{\partial\mathbf{B}} {\partial\mathbf{B}})_{g,h,i,j}[/tex] 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 [tex] \frac{\partial\mathbf{B}} {\partial\mathbf{B}} [/tex]. Could you help me on this one, or point me in a good direction?

Thanks,
Guillaume
 
Physics news on Phys.org
  • #2


Dear Guillaume,

Thank you for your question. you are correct in your approach to solving this problem using the chain rule. However, I would like to offer some suggestions to improve your algorithm.

Firstly, instead of creating a four-dimensional array, it would be more efficient to create a k x k matrix of zeros and then fill in the appropriate elements with ones using a for loop. This way, you will save memory and time in your computation.

Additionally, you can use the Kronecker delta function to simplify your algorithm. The Kronecker delta function, denoted by δ_ij, is defined as 1 when i = j and 0 otherwise. Hence, your algorithm can be written as:

1. Create a k x k matrix of zeros, let's call it D.
2. Use a for loop to iterate through the elements of D.
3. For each element (i,j) of D, use the Kronecker delta function to determine whether to assign a 1 or 0 to that element.
4. Once D is filled with ones and zeros, you can simply multiply it by A and A' to get the final result.

I hope this helps you in solving the problem. Let me know if you have any further questions.
 

1. What is the definition of derivative of a matrix with respect to itself?

The derivative of a matrix B with respect to itself is the rate of change of each element in the matrix with respect to a small change in each element of the matrix. It is a matrix of the same size as B, where each element is the partial derivative of the corresponding element in B.

2. How is the derivative of a matrix B with respect to itself calculated?

The derivative of a matrix B with respect to itself is calculated by taking the partial derivative of each element in B with respect to each element in B. This results in a matrix of the same size as B, where each element is the partial derivative of the corresponding element in B.

3. What is the purpose of calculating the derivative of a matrix with respect to itself?

The derivative of a matrix B with respect to itself is used to find the rate of change of each element in the matrix, which can be useful in optimizing and analyzing functions involving matrices. It can also be used in applications such as machine learning and data analysis.

4. Is the derivative of a matrix B with respect to itself always a square matrix?

Yes, the derivative of a matrix B with respect to itself is always a square matrix of the same size as B, since each element in B has a corresponding partial derivative in the derivative matrix.

5. Can the derivative of a matrix B with respect to itself be calculated for any type of matrix?

Yes, the derivative of a matrix B with respect to itself can be calculated for any type of matrix, including square matrices, rectangular matrices, and even non-square matrices. However, the resulting derivative matrix may not have the same properties as the original matrix, such as being invertible.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
577
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
869
Replies
33
Views
3K
  • Calculus and Beyond Homework Help
Replies
6
Views
551
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Special and General Relativity
Replies
28
Views
656
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
839
Back
Top