Derivative of $tr(A(C \circ X)BB'(C' \circ X')A')$ Can we differentiate this function:  $tr(A(C \circ X)BB'(C' \circ X')A')$ w.r.t $X$?
Also, $tr(A(C \circ X)Y)$ w.r.t $X$.

The Frobenius product is a convenient notation for the trace
$\,A:B = {\rm Tr}(A^TB)$
Define the matrices
$$\eqalign{
Y &= C\circ X &\implies dY &= C\circ dX \cr
W &= AYB &\implies dW &= A\,dY\,B \cr
}$$
Write the function in terms of these new variables. Then calculate its differential and gradient.
$$\eqalign{
\phi &= W:W \cr
d\phi
 &= W:dW + dW:W \cr
 &= 2W:dW \cr
 &= 2W:(A\,dY\,B) \cr
 &= 2(A^TWB^T):dY \cr
 &= 2(A^TWB^T):(C\circ dX) \cr
 &= 2\big(C\circ (A^TWB^T)\big):dX \cr
 &= 2\Big(C\circ\big(A^TA(C\circ X)BB^T\big)\Big):dX \cr
\frac{\partial\phi}{\partial X} &= 2C\circ\big(A^TA(C\circ X)BB^T\big) \cr
}$$
