I am trying to find the gradient
$$\nabla \mbox{trace}(Axx^TB)$$
where both $A$ and $B$ are $n \times n$ matrices, and $x$ is an $n$-length column vector
I'm not exactly sure how to approach this problem in order to lead me to the solution. I know that $xx^T$ forms an $n \times n$ matrix with squares along the diagonal, but how do both other matrices multiply with that to achieve the trace?
$\operatorname{trace}(Axx^TB) = \langle Ax, B^Tx \rangle = \sum_{i\in[n]} (Ax)_{i} \times (B^Tx)_{i} = \sum_{i\in[n]} (A_i \cdot x) \times (B^i \cdot x),$ where $A_i$ is the $i$-th row of A, and $B^i$ is the $i$-th column of B.
$\langle X,Y \rangle = \operatorname{trace}(X^T Y)$ (Euclidean [matrix] inner product)
$x \cdot y = \sum_i x_i \times y_i$ (Euclidean [vector] inner product)