How to find expected angle between two randomly generated vectors? Let us say two random points have been generated in a d-dimensional space by uniformly sampling from a unit cube centered at origin. How to calculate the expected angle between them?
 A: The expected angle between two randomly generated vectors in an n-dimensional space ($n>1$) is 90 degrees. $P(x.y=a)=P(x.y=-a)$ since $P(y)=P(-y)$ since $y$ is a random vector.  Thus $P(cos(\theta) = b) = P(cos(\theta) = -b)$ and $P(\theta = 90+c) = P(\theta+ 90-c)$.  Thus
$\int_{0}^{180}  \theta P(\theta) d \theta = \int_{0}^{180} (\theta-90) P(\theta) d \theta + 90 \int_{0}^{180} P(\theta) d \theta = 0 + 90 \times 1 = 90$
where the first integral vanishes because
$\int_{0}^{180} (\theta-90) P(\theta) d \theta = \int_{0}^{90} (\theta-90) P(\theta) d \theta + \int_{90}^{180} (\theta-90) P(\theta) d \theta = 0$
the two integrals take opposite values due to symmetry.  Note that 
$\int_{0}^{180} P(\theta) d \theta =1$.
A: You can fix one of the vectors to be (for example) on the $x_1$-axis. Let's call the other vector $y = (y_1, y_2, \dots, y_d)$.
Let's calculate the expexted value of the inner product of the two vectors (since this defines the angle, the normalization doesn't really matter). Since we fixed the other vector to be $(1,0,0\dots, 0)$, it becomes just
$$\int_{-a}^a y_1 \space dy_1= 0$$
The expected angle is $\arccos 0 = \frac{\pi}{2}$.
