I'm following the open courseware content on Machine Learning from Stanford University. In the [lecture notes](http://www.stanford.edu/class/cs229/notes/cs229-notes1.pdf), it is given that


$$\Delta\_A \ tr(ABA^TC) = CAB + C^TAB^T$$


which I tried but couldn't prove easily. It is not required to follow the course content but I just wondered and wanted to learn its proof. Any suggestions?


Update: $A$, $B$, and $C$ are matrices and $\Delta\_A$ is the gradient operation on matrix $A$. 



Proof of a fact about traces
I guess $\Delta\_A$ denotes the derivative with respect to the elements of the matrix $A$ (more conventionally denoted by $\partial\_{A}$).


To evaluate the derivative with respect to $A\_{ij}$, write out the trace in terms of components and then use $\partial\_{A\_{ij}} A\_{mn} = \delta\_{im} \delta\_{jn}$,
$$\partial\_{A\_{ij}} \text{tr}(A B A^T C) = \partial\_{A\_{ij}}\sum\_{mnkl} A\_{mn} B\_{nk} A\_{lk} C\_{lm}= \sum\_{kl} B\_{jk}A\_{lk} C\_{li} + \sum\_{mn} A\_{mn} B\_{nj} C\_{im} $$
$$= ( C^T A B^T+ C A B )\_{ij}.$$
This is the component-wise version of your identity.


Note to the comment of Todd Trimble: the matrices $A,B$, and $C$ do not have to be necessarily square matrices. Their dimension just has to "match" ($A \in \mathbb{R}^{m \times n}$, $B\in \mathbb{R}^{n \times n}$, $C \in \mathbb{R}^{m \times m}$, with $m$ and $n$ arbitrary integers).


