For random variables $X \in \mathbb{R}^h$, and a positive semi-definite matrix $A$: Is there a simplified expression for the expected value, $\mathop {\mathbb E}[Tr(X^TAX)]$ and variance, $Var[Tr(X^TAX)]$? Please note that $A$ is not a random variable.


1 Answer 1


Since $X^TAX$ is a scalar, $$\text{Tr}(X^TAX)= X^TAX = \text{Tr}(AXX^T)$$ so that $$\text{E}(X^TAX) = \text{E}(\text{Tr}(AXX^T)) = \text{Tr}(\text{E} (A XX^T)) = \text{Tr}(A\text{E}(XX^T))$$.

Here we have used that the trace of a product are invariant under cyclical permutations of the factors, and that the trace is a linear operator, so commutes with expectation. The variance is a much more involved computation, which also need some higher moments of $X$. That calculation can be found in Seber: "Linear Regression Analysis" (Wiley)

  • 1
    $\begingroup$ Why is $Tr(X^T AX) = X^T AX$? $\endgroup$
    – Aqqqq
    Commented May 26, 2018 at 14:25
  • 3
    $\begingroup$ Because $X^TAX$ is a number $\endgroup$ Commented May 26, 2018 at 15:07
  • 1
    $\begingroup$ @kjetilbhalvorsen: Thanks, I have added your proof here. $\endgroup$
    – Joram Soch
    Commented Nov 3, 2021 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.