Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question about how to calculate the expectation of the square of a quadratic form as follows, where $X$ is a random variable that uniformly distributed on the unit sphere: $$ E_X[(\mathbf{x}^\top A\mathbf{x})^2] =\int_{\mathbf{x}\in S}{p(\mathbf{x})(\mathbf{x}^\top A\mathbf{x})^2dS(\mathbf{x})} =\int_{\mathbf{x}\in S}{\frac{1}{4\pi}(\mathbf{x}^\top A\mathbf{x})^2dS(\mathbf{x})} $$ where $ S=\{\mathbf{x}\in\mathcal{R}^N|\mathbf{x}^\top\mathbf{x}=1\} $.

If $\mathbf{x}$ is Gaussian, there are some conclusions about the expectation of the quadratic forms. However, I find it difficult to deal with when the variable is distributed on a sphere. When the dimension is 2 or 3, this problem can be solved by representing it with polar coordinate. However, when the dimension is high, such a representation will be rather redundant, how can I calculate this integral then? Please give some help for this problem if you have any idea. Thank you very much!

share|cite|improve this question
You can find an orthogonal basis on which $A$ is diagonal: write $A=P^TDP$ wtih $D$ diagonal and $P$ orthogonal. Note that if $x\in S$ then $Px$ will be in $S$. – Davide Giraudo Nov 20 '11 at 13:34
Crossposted:… – Byron Schmuland Nov 20 '11 at 19:50
up vote 3 down vote accepted

Assuming $A$ is diagonalizable in an orthonormal basis with a diagonal of $a_k$'s, one asks for the expectation $C(A)$ of the random variable $$ (X^TAX)^2=\left(\sum\limits_ka_kX_k^2\right)^2=\sum\limits_ka_k^2X_k^4+\sum\limits_{k\ne \ell}a_ka_\ell X_k^2X_\ell^2, $$ where the vector $X=(X_k)_{1\leqslant k\leqslant d}$ is uniformly distributed on the Euclidean unit sphere. Hence, $$ C(A)=c_d\cdot\sum\limits_ka_k^2+c'_d\cdot\sum\limits_{k\ne\ell}a_ka_\ell=(c_d-c'_d)\cdot\sum\limits_ka_k^2+c'_d\cdot\left(\sum\limits_ka_k\right)^2, $$ with $$ c_d=\mathrm E(X_1^4),\qquad c'_d=\mathrm E(X_1^2X_2^2). $$ Since the $X_k^2$'s are identically distributed and sum to $\|X\|^2=1$, $\mathrm E(X_1^2)=1/d$ and $$ dc_d+d(d-1)c'_d=1. $$ Furthermore, a direct computation (1) yields $c'_d=1/(d(d+2))$ hence $c_d-c'_d=2/(d(d+2))$ and $$ C(A)=\frac1{d(d+2)}\cdot\left(2\sum\limits_ka_k^2+\left(\sum\limits_ka_k\right)^2\right). $$ Finally, $$ \color{red}{\mathrm E((X^TAX)^2)=\frac{2\text{tr}(A^2)+\left(\text{tr}(A)\right)^2}{d(d+2)}}. $$ Note:

(1) One can write $X$ as $X=Z/\|Z\|$ where the vector $Z=(Z_k)_{1\leqslant k\leqslant d}$ is i.i.d. standard gaussian. Thus, $$ X_1^2X_2^2=Z_1^2Z_2^2\|Z\|^{-4}=Z_1^2Z_2^2\,\int_0^{+\infty}\mathrm e^{-t\|Z\|^2}\cdot t\mathrm dt, $$ hence $$ X_1^2X_2^2=\int_0^{+\infty}Z_1^2\mathrm e^{-tZ_1^2}\cdot Z_2^2\mathrm e^{-tZ_2^2}\cdot \mathrm e^{-t(Z_3^2+\cdots+Z_d^2)}\cdot t\mathrm dt. $$ Integrating this, $$ c'_d=\mathrm E(X_1^2X_2^2)=\int_0^{+\infty}u'(t)^2\cdot u(t)^{d-2}\cdot t\mathrm dt\quad\text{with}\quad u(t)=\mathrm E(\mathrm e^{-tZ_1^2}). $$ A standard computation yields $u(t)=(1+2t)^{-1/2}$, hence $u'(t)=-(1+2t)^{-3/2}$ and $$ c'_d=\int_0^{+\infty}(1+2t)^{-d/2-2}\cdot t\mathrm dt=\left.\frac1{2d(1+2t)^{d/2}}-\frac1{2(d+2)(1+2t)^{d/2+1}}\right|_0^{+\infty}=\frac1{d(d+2)}. $$

share|cite|improve this answer
Hello Didier, it's so kind of you to answer my question. I will read your answer carefully. Thank you very much! – sypii Nov 20 '11 at 15:55
sypii, thanks for the appreciation. See the revised, simpler, version. – Did Nov 20 '11 at 18:05
Didier, thanks again for your supplementary of the answer! – sypii Nov 21 '11 at 1:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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