Little notation question about matrix multiplications / quadratic forms I'm a bit confused about expanding out the notation of product of matrices, in the context of quadratic forms.
If $x \in \mathbb{R}^n, \, \, A \in \mathbb{R}^{n \times n}$ then
$$x^TAx = \sum_{i,j=1}^na_{ij}x_ix_j$$
But then if I consider a matrix $X \in \mathbb{R}^{n \times n}$ how should I write the expanded form of
$$X^TAX = \, \,...\, \, ?$$
This time the result will be a matrix.. will it be something like
$$X^TAX  = \sum_{i,j=1}^n a_{ij}x_ix_j^T$$
and if yes, why?
Sorry if this is pretty straightforward but it always happens to get a little bit stuck with matrix notation.
Many thanks,
James

The $(i,j)$-coefficient of the matrix $X^TAX$ is given by
\begin{equation}
\sum_{k,l=1}^nx_{ki}a_{kl}x_{lj},
\end{equation}
where $x_{ij}$ (resp. $a_{ij}$) is the coefficient of $X$ (resp. $A$).
