I am trying to understand the following identity (context Maximum Likelihood Estiation), where $M$ is the inverse of a symmetric matrix:
$$\frac{1}{n}\sum_{i=1}^{n}x^T_iMx_i=\operatorname{tr}\left[\frac{1}{n}x_ix^T_iM\right].$$
I tried this equation with n = 1 and $x \in \mathbb{R}^2$ and M as a 2 by 2 matrix but I dont get the same result. Is this identity false?
EDIT: Corrected the identity, now the small example is correct :).