# Scalar product of random unit vectors

Let $$X,X'$$ be two random vectors on the sphere $$S^{d-1}$$. What is the distribution of their dot product $$X\cdot X'$$ in the following cases:

1. $$X,X'$$ independent with uniform distribution on the sphere $$S^{d-1}$$

2. $$X\in S^{d-1}$$ deterministic, $$X'$$ uniformly distributed on $$S^{d-1}$$ ?

• By conditioning with respect to $X$, the solution to both questions is the same. Now the probability that the dot product belongs to $[-1,x]$ is the ratio of the volume of a certain spherical cap to the volume of the whole sphere, which is a simple integral computation. I got a density $(1-x^2)^{(d-1)/2}\mathrm dx$ up to constant, but I might be wrong. There are formulas on Wikipedia. – Pierre PC May 28 '20 at 22:23
• In additon we may assume that $X \equiv (1,0,\ldots,0)$. – Dieter Kadelka May 28 '20 at 22:26
• @DieterKadelka Absolutely, and that's what I actually did. Apologies, a plus sign turned to a negative one; I found $\sqrt{1-x}^{d-3}\mathrm dx$ up to a constant. If $\mathbb S^{d-1}$ is parametrised as $(\sqrt{1-h^2}\cdot\theta,h)$ for $\theta\in\mathbb S^{d-2}$ and $h\in(-1,1)$, then the volume form is $(1-h^2)^{d/2-1}\mathrm d\theta\cdot(1-h^2)^{-1/2}\mathrm dh$. – Pierre PC May 28 '20 at 22:57
• I think this is worth an answer. – Dieter Kadelka May 28 '20 at 23:35

## 1 Answer

As noted in the comments, by the spherical symmetry, the distribution of the dot product in both parts of your question is the same that of $$X\cdot(1,0,\dots,0)$$. Moreover, the distribution of $$X$$ is the same as that of the random vector $$\frac{Z}{\sqrt{Z_1^2+\dots+Z_d^2}},$$ where $$Z=(Z_1,\dots,Z_d)$$ is a standard normal random vector. So, the distribution of the dot product in question is the same that of $$R:=\frac{Z_1}{\sqrt{Z_1^2+\dots+Z_d^2}}.$$ The distribution of $$R$$ is obviously symmetric, and the distribution of $$R^2$$ is the beta distribution with parameters $$\frac12,\frac{d-1}2$$. It follows that the probability density function (pdf) $$f_R$$ of $$R$$ is given by $$f_R(r)=\frac{\Gamma \left(\frac{d}{2}\right)}{\sqrt{\pi }\, \Gamma \left(\frac{d-1}{2}\right)}\,\left(1-r^2\right)^{\frac{d-3}{2}}\, 1\{|r|<1\},$$ and the dot product in question has the same pdf.

• One beautiful fact here is that when $d=3$, this is a uniform distribution. Actually, this fact is in some sense due to Archimedes, who showed that the sphere and cylinder have the same surface area. More precisely, the height and polar angle are Darboux coordinates for both spaces. – Gabe K May 29 '20 at 1:39
• @GabeK : Good point. – Iosif Pinelis May 29 '20 at 2:29
• Thank you! And if I didn't make mistakes it should be possible to rewrite the distribution $f_R$ as $f(\alpha) = C(d) \sin^{d-2}(\alpha) \,1\{0<\alpha<\pi\}$ in order ti obtain the distribution of the angle between vectors $X,X'$ – Gin Pat May 29 '20 at 7:42