I am really stuck at calculating
$$\frac{d}{dC} \operatorname{trace} \left( X C P (X C)^T \right)$$
where $P \in R^{r\times r}$, $X \in R^{m\times n}$ and $C \in R^{n\times r}$ . Do I need to recall $A=XC$ and then apply chain rule such that
$$\frac{d \operatorname{trace}(XCP(XC)^T)}{dC}=\frac{d\operatorname{trace}(APA^T)}{dA}\cdot \frac{dA}{dC}$$
where first factor equals $A (P+P^T) $ (following this reference) and the second is $X$. Am I right ?
More correctly, by a quick dimensionality check, it would make more sense to have $X^T (XC) (P+P^T)$ at the end. Is it right ? Could someone help me prove it ?
Moreover, is $\operatorname{trace}(XCP(XC)^T)$ convex w.r.t. $C$ ?