$(2\pi)^{-n/2}\int_{\mathbb{R}^n} q(x)e^{-\Vert x \Vert^2/2}\,dx = \mbox{trace}(Q)$ Let $Q$ be a symmetric matrix and consider the quadratic form $q: \mathbb{R}^n \rightarrow \mathbb{R}$, $q(x) = \langle Qx, x \rangle$
Show that
$(2\pi)^{-n/2}\int_{\mathbb{R}^n} q(x)e^{-\Vert x \Vert^2/2}$dx = tr(Q)
I tried to do this:
We can write $Q = UDU^*$, where U is unitary and D = diag($\lambda_1, \dots, \lambda_n)$, $\lambda_i$ are the eigenvalues of $Q$.
Then, given x $\in \mathbb{R}^n$, $q(x) = \langle Qx, x \rangle =  \langle UDU^*x, x \rangle = \langle DU^*x, U^*x \rangle = \sum_{i = 0}^n \lambda_i|(U^*X)_i|^2$.
So, $(2\pi)^{-n/2}\int_{\mathbb{R}^n} q(x)e^{-\Vert x \Vert/2}$dx $(2\pi)^{-n/2}\int_{\mathbb{R}^n} \sum_{i = 0}^n \lambda_i|(U^*X)_i|^2e^{-\Vert x \Vert/2}$dx 
I think we can use that $\Vert x\Vert^2 = \Vert U^*x \Vert^2$, since U is unitary.
I do not know how to proceed anymore!
 A: Hint.
$$
(2\pi)^{-n/2}\int_{\mathbb{R}^n} q(x)e^{-\Vert x \Vert^2/2}\,dx =
(2\pi)^{-n/2}\int_{\mathbb{R}^n} (x,Qx)e^{-\Vert x \Vert^2/2}\,dx\\
=
(2\pi)^{-n/2}\int_{\mathbb{R}^n} (Uy,QUy)e^{-\Vert Uy \Vert^2/2}\,\lvert\det U\rvert\,dy= (2\pi)^{-n/2}\int_{\mathbb{R}^n}\sum_{i=1}^n \lambda_i y_i^2e^{-\Vert Uy \Vert^2/2}\,dy\\ = (2\pi)^{-n/2}\sum_{i=1}^n\lambda_i\int_{\mathbb{R}^n} y_i^2e^{-\Vert y \Vert^2/2}\,dy.
$$
However, 
$$
\int_{\mathbb{R}^n} y_i^2e^{-\Vert y \Vert^2/2}\,dy=\left(\int_{\mathbb R}y_i^2e^{-y_i^2/2}\,dy_i\right)\prod_{j\ne i}\int_{\mathbb R}e^{-y_j^2/2}\,dy_j=(2\pi)^{(n-1)/2}\int_{\mathbb R}y_i^2e^{-y_i^2/2}\,dy_i
$$
A: Let $Q=S^TDS$ where $D=diag((\lambda_i))$ and $S\in SO(n)$. Put $y=Sx$; then $||x||^2=||y||^2$ and $dx=d(S^{-1}y)=\det(S^{-1})dy=dy$; $q(x)=(S^{-1}y)^TS^TDS(S^{-1}y)=y^TDy=\sum_i\lambda_iy_i^2$. Let $J=\int_{x\in \mathbb{R}^n} q(x)e^{-\Vert x \Vert^2/2}\,dx$; then $J=\int_{y\in\mathbb{R}^n} \sum_i\lambda_iy_i^2e^{-\Vert y \Vert^2/2}\,dy$ and it remains to show that, for every $i$, $J_i=\int_{y\in\mathbb{R}^n} y_i^2e^{-\Vert y \Vert^2/2}\,dy=(2\pi)^{n/2}$.
For instance, let $i=n$; we obtain $J_n=K\int_{y_n\in\mathbb{R}} y_n^2e^{-y_n^2/2}dy_n$ where $K=\int_{(y_1,\cdots,y_{n-1})\in\mathbb{R}^{n-1}} e^{-\sum_{i=1}^{n-1}y_i^2 /2}\,dy_1\cdots dy_{n-1}=(\int_{t\in \mathbb{R}} e^{-t^2 /2}dt)^{n-1}=(2\pi)^{(n-1)/2}$ (well-known result); moreover (integral by parts) $\int_{y_n\in\mathbb{R}} y_n^2e^{-y_n^2/2}dy_n=\int_{t\in \mathbb{R}} e^{-t^2 /2}dt=\sqrt{2\pi}$ and we are done.
