I was looking at the matrix cookbook, expected value of expression $ x^T A x $ in a multivariate gaussian which comes out to be $$E[x^T A x] = Tr(AΣ) + m^TAm $$. I tried to prove it but couldn't prove it. Please help or guide, I am basically stuck with the integration! Also if there's any other method than integration I would love to know it!
2026-04-23 05:54:09.1776923649
On
Proof for Expected value of expression in multivariate gaussian
347 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
If $A$ is a positive definite real matrix then it can be written as $A=B^{T}B$. Then $\mathbb{E}(Bx)=Bm$ and we know $\mathbb{E}[(x-m)^T(x-m)]=\Sigma$. Then $$\mathbb{E}[(x-m)^TA(x-m))]=\mathbb{E}[(Bx-Bm)^T(Bx-Bm)]=B^T\Sigma B$$ Now $B^T\Sigma B$ is a scalar. So $B^T\Sigma B=trace(B^T\Sigma B)=trace(B^TB\Sigma)=trace(A\Sigma)$
If $X$ is normally distributed with mean $\mu\in\mathbb{R}^n$ and covariance matrix $\Sigma\in\mathbb{R}^{n\times n}$, then $$ \mathbb{E}[X_iX_j]=\Sigma_{ij}+\mu_i\mu_j$$ for all $1\leq i,j\leq n$, hence if $A\in\mathbb{R}^{n\times n}$ then $$ \mathbb{E}[X^TAX]=\mathbb{E}\Big[\sum_{i,j=1}^na_{ij}X_iX_j\Big]=\sum_{i,j=1}^na_{ij}\mathbb{E}[X_iX_j]=\sum_{i,j=1}^na_{ij}\Sigma_{ij}+\sum_{i,j=1}^na_{ij}\mu_i\mu_j$$ $$ =\sum_{i=1}^n\sum_{j=1}^na_{ij}\Sigma_{ji}+\mu^TA\mu=\mathrm{tr}(A\Sigma)+\mu^TA\mu$$ using the fact that $\Sigma$ is symmetric in the last line.