# Second moment of cos(x,y) for Normal x,y?

I'm trying to figure out second moment of the following quantity

$$y = \frac{\langle x_1, x_2 \rangle}{\left\|x_1\right\|\left\|x_2\right\|}$$

Where $x_1$, $x_2$ are sampled independently from $\mathcal{N}(0, \Sigma)$

This can be solved exactly in 2-dimensions using algebraic manipulation: suppose eigenvalues of $\Sigma$ are $a$ and $b$, then

$$E[y^2] = \frac{a+b}{\left(\sqrt{a}+\sqrt{b}\right)^2}$$

Is there a similarly elegant expression for $n$ dimensions?

(update, I extended this formula to eigenvalues $a,b,c$ "by analogy" and it seems to hold numerically)

This $y = \frac{<x_1, x_2>}{\|x_1\|\|x_2\|}$ is the distribution of the $cos \theta$ where $\theta$ is known as the canonical angle/principal angle of two random vectors $x_1,x_2$. $cos\theta$ is known as the canonical correlation between $X_1,X_2$ since we know their joint distribution $(X_1,X_2)$ from independence.

Usually we discussed when $(X_1,X_2)$ are assumed to be eigenvectors corresponding to a random matrix. And the derivation actually does not require normality assumption and can be extended to higher $r$, see [Anderson] Chap.10 for example.

The derivation can be done as shown in [Anderson] using iterative optimization, however, there is a general treatment [Anderson2][Hsu] which derives the exact distribution of eigenvectors and therefore the moments associated under normality assumption of the sample.

Update: I have answer a updated version of this question using directional statistics here, now it can be addressed by using projected normal distribution: https://stats.stackexchange.com/questions/263896/moment-mgf-of-cosine-of-two-random-vectors

[Anderson]An Introduction to Multivariate Statistical Analysis,1958,Wiley

[Anderson2]Multiple discoveries: Distribution of roots of determinantal equations T.W. Anderson

[Bartlett]Bartlett, M. S. "The general canonical correlation distribution." The Annals of Mathematical Statistics (1947): 1-17.http://projecteuclid.org/download/pdf_1/euclid.aoms/1177730488

[Hsu]Hsu, P. L. "On the distribution of roots of certain determinantal equations." Annals of Human Genetics 9.3 (1939): 250-258.

• I tracked down Anderson reference and following derivations there I can get first moment of $cos \theta$ which is 0, not sure how to go about second moment. Thanks for the terminology pointer though, canonical correlation coefficients are square roots of eigenvalues as well which I guess is not a coincidence. – Yaroslav Bulatov Feb 28 '17 at 4:52
• @YaroslavBulatov I added refs. Under normality assumptions, the distribution of eigenvalues and associated canonical angles(cosine of angles=eigenvalues ) can be derived explicitly and hence their moments. See also mathoverflow.net/questions/102153/angle-between-subspaces – Henry.L Feb 28 '17 at 12:35