Derivative of Trace of matrix product I am trying to compute the gradient with respect to a vector $\mathrm x \in \mathbb{R}^d$ of a complicated expression involving the trace of matrix product.
The expression is the following:
$$ F(\mathrm x) = \text{Tr}\left[ C \nabla (C^{-1} \mathrm f(\mathrm x))   \right],$$
where $C$ is a $d \times d$ matrix, and $\mathrm f(\mathrm x): \mathbb{R}^d \rightarrow \mathbb{R}^d$ a vector valued function.
What I have until now is
$$ \nabla F(\mathrm x) = \nabla \text{Tr}\left[ C  (C^{-1} J_f(\mathrm x))   \right],$$
where with $J_f(\mathrm x)$ I denote the Jacobian of $\mathrm f$.
However I do not know how to proceed and take the gradient of the trace.
Would it be like this? $$\nabla \text{Tr}\left[ C  (C^{-1} J_f(\mathrm x))   \right] =  \text{Tr}\left[\nabla\left( C  (C^{-1} J_f(\mathrm x))   \right)\right]$$

$CC^{-1}$ cancels each other in your second equation, you'll be left with
$$\nabla \text{Tr}[J_f(x)]=\nabla\left(\sum_{i=1}^d \frac{\partial f_i(x)}{\partial x_i}\right)=\sum_{i=1}^d \frac{\partial}{\partial x_i}\nabla f_i(x)$$
Or $\nabla(\nabla\cdot f)$ in vector calculus.
