Derivative of $c^TX^TXc$ with respect to $X$ What is the derivative of $c^TX^TXc$ with respect to $X$? Here, all the entries are real and $X$ is a matrix while $c$ is a vector.
I keep getting confused with the left and right multiplication. Hence, if I have these answers in both these angles, I might remember this better, based on the simple one or two line approach you would take.
The image attached below shows these results in the appendix of a book:

Let me know how we get there.
 A: You can do both questions simultaneously, as each of these functions is of the form $X\longmapsto F(X,X)$ for some $F$ bilinear continuous.

Fact: If $(X,Y)\longmapsto F(X,Y)$ is bilinear and continuous in the sense that there exists $M>0$ such that $\|F(X,Y)\|\leq M \|X\|\|Y\|$, then $F$ is differentiable with derivative
  $$
dF_{(X,Y)}(H,K)=F(X,K)+F(H,Y).
$$

Proof: the map $\theta:(H,K)\longmapsto F(X,K)+F(H,Y)$ is linear and continuous. Now
$$
\|F(X+H,Y+K)-F(X,Y)-\theta(H,K)\|=\|F(H,K)\|\leq M\|H\|\|K\|\leq M (\|H\|^2+\|K\|^2).
$$
So
$$
\lim_{(H,K)\rightarrow (0,0)}\frac{F(X+H,Y+K)-F(X,Y)-\theta(H,K)}{\sqrt{\|H\|^2+\|K\|^2}}=0.
$$
This proves, by definition, that $\theta$ is the derivative of $F$ at $(X,Y)$. QED.

Consequence: with a bilinear continuous function $F$, the compostion $G(X):=F(X,X)$ si differentiable with derivative
  $$
dG_{X}(H)=F(X,H)+F(H,X).
$$

Proof: chain rule, given that the derivative of the linear continuous map $\theta(X)=(X,X)$ is $\theta$ at every $X$. QED.
Application: note that everything is continuous since we are in finite dimension.

  
*
  
*With the function $F_1(X,Y)=Xcc^TY^T\;$, we get $G_1(X)=Xcc^TX^T$. Hence
  $$
dG_{1_{X}}(H)=F_1(X,H)+F_1(H,X)=Xcc^TH^T+Hcc^TX^T.
$$
  
*With the function $F_2(X,Y)=c^TX^TYc\;$, we get $G_2(X)=c^TX^TXc$. Hence
  $$
dG_{2_{X}}(H)=F_2(X,H)+F_2(H,X)=c^TX^THc+c^TH^TXc.
$$
  

Now to find the gradient and turn the answer into the form of the book, observe, e.g. for the second one, that
$$
c^TX^THc=c^TH^TXc=\mbox{real number}=\mbox{Trace}(c^TX^THc)=\mbox{Trace}((Xcc^T)^TH)
$$
hence
$$
\nabla_X(c^TX^TXc)=2Xcc^T.
$$
A: Let's go back to the definition of derivative. Let $F : M_n(\mathbb{R}) \to M_n(\mathbb{R})$ be given by $$F(X) = Xcc^T X^T.$$ Fix $X \in M_n(\mathbb{R})$. Then for any $h \in M_n(\mathbb{R})$,
$$
 F(X+h) = (X+h)cc^T(X+h)^T = Xcc^T X + h cc^T X^T + X cc^T h^T + h cc^T h^T,
$$
which is to say that in terms of your favourite matrix norm,
$$
 F(X+h) = F(X) + (h cc^T X^T + X cc^T h^T) + o(\|h\|).
$$
Thus, by definition, the derivative $DF(X) : M_n(\mathbb{R}) \to M_n(\mathbb{R})$ of $F$ at $X$ is
$$
 DF(X)(h) = h cc^T X^T + X cc^T h^T.
$$
Note the importance of the order of multiplication!
In the same way, let $f : M_n(\mathbb{R}) \to \mathbb{R}$ be given by
$$
 f(X) = c^T X^T X c.
$$
Fix $X \in M_n(\mathbb{R})$. Then for any $h \in M_n(\mathbb{R})$,
$$
 f(X+h) = c^T (X+h)^T (X+h) c = c^T X^T X c + c^T h^T X c + c^T X^T h c + c^T h^T h c,
$$
so that
$$
 f(X+h) = f(X) + (c^T h^T X c + c^T X^T h c) + o(\|h\|),
$$
and hence
$$
 Df(X)(h) = c^T h^T X c + c^T X^T h c = 2 c^T X^T h c,
$$
where we used the fact that $c^T h^T X c$ is a scalar, so that
$$
 c^T h^T X c = (c^T h^T X c)^T = c^T X^T h c.
$$
Now, in the case of $f : M_n(\mathbb{R}) \to \mathbb{R}$, if we view $M_n(\mathbb{R})$ as an inner product space with inner product $\DeclareMathOperator{\Tr}{Tr} \langle X,Y\rangle = \Tr(X^T Y)$, then $\nabla f (X)$ is the unique matrix in $M_n(\mathbb{R})$ such that 
$$
 \forall h \in M_n(\mathbb{R}), \quad Df(X)(h) = \langle \nabla f(x),h\rangle := \Tr((\nabla f(x))^T h).
$$
Now, let $C$ be the matrix with first column $c$ and everything else $0$. Check, then, that
$$
 Df(X)(h) = 2 c^T X^T h c = \Tr(2 C^T X^T h C) = \Tr(2 C C^T X^T h) = \langle 2 X C C^T, h\rangle,
$$
so that once you convince yourself that $C C^T = c c^T$,
$$
 \nabla f(X) = 2 X C C^T = 2 X c c^T.
$$
