Suppose ${\bf{x}}$ is a vector with, say, $n$ components, which is represented as a $n\times 1$ matrix. Let $A$ and $B$ be $n \times n$ matrices. I will denote by $(A{\bf{x}})_{i}$ the $i$-th entry of the vector $A{\bf{x}}$, the product of $A$ and ${\bf{x}}$. I have the following object: $$\sum_{i,j=1}^{n}(A{\bf{x}})_{i}B_{ij}(A{\bf{x}})_{j}$$ I came to the conclusion that: $$\sum_{i,j=1}^{n}(A{\bf{x}})_{i}B_{ij}(A{\bf{x}})_{j} = {\bf{x}}^{T}A^{T}BA^{T}{\bf{x}}$$
Is this identity true?
That quantity is $(Ax)^TB(Ax)=x^TA^TBAx$.