So I have a function that takes matrices as inputs and returns a scalar. So the function looks something like this:
$f(A*B)$
Where A and B are two square matrices of same shape.
Now I want to calculate
$$\nabla_A \mbox{f}(A*B)$$
And here I know the gradient when $B$ is independent of $A$ but if let's say $B$ were to depend on $A$ then what will the expression look like using the chain rule.
Let's say if $B$ is independent of $A$ then the result of the gradient is $G$ (Which is also a matrix) so will the expression look something like this, I am not quite sure if this is correct though.
$G*$$(\nabla_A \mbox{B})$
I have no idea if this is correct, or how do I proceed?
Let $\mathbb{R}^{n\times n}$ the set of matrices of $n\times n$ order with coefficients in $\mathbb{R}$. Let $A\cdot B$ the product of matrices $A\in\mathbb{R}^{n\times n}$ and $B\in\mathbb{R}^{n\times n}$. Suppose that $f:\mathbb{R}^{n\times n}\to \mathbb{R}$ is derivable, i.e. there exists a linear transformation $$ \begin{array}{rrl} D f(A):&\hspace{-4mm}\mathbb{R}^{n\times n}&\hspace{-4mm}\to \mathbb{R}\\ &V &\hspace{-4mm}\mapsto \nabla f(A)\cdot V\\ \end{array} $$ such that $$ \lim_{\|V\|_{\mathbb{R}^{n\times n} \to 0}} \frac{| f(A+V)-f(A)-\nabla f(A)V |_{\mathbb{R}} }{\|V\|_{\mathbb{R}^{n\times n}}} =0 $$ Here the matrix norm $\|V\|_{\mathbb{R}^{n\times n}}$ is equal to $\sqrt[\,2]{\sum_{j=1}^n\sum_{i=1}^nV_{ij}^2}$. Then the derivative of function $$ \mathbb{R}^{n\times n}\ni A\longmapsto f(A\cdot B)\in\mathbb{R} $$ is the linear transformation $$ \nabla f(A\cdot B )\cdot (V\cdot B) $$ by cause $$ \lim_{\|V\|_{\mathbb{R}^{n\times n} \to 0}} \frac{| f(A\cdot B+V\cdot B)-f(A\cdot B)-\nabla f(A\cdot B)\cdot (V\cdot B) |_{\mathbb{R}} }{\|V\cdot B\|_{\mathbb{R}^{n\times n}}} =0 $$