# Distribution of sum of two directions on hemisphere?

I previously asked the following question:

Is average of two random directions also a random direction?

Apparently the answer is no, so as a follow up question I would like to find an expression for the distribution of directions as a function of theta (it should be independent of phi).

-
The question is rather confusing in this form since the only thing you quote from the other question is the title and that title doesn't contain the crucial term "uniformly". Of course the normalized average of two uniformly random directions is a random direction, it's just not uniformly random. Please make the question more self-contained such that one doesn't have to follow the link to understand it correctly. – joriki May 24 '12 at 19:47

I think it's helpful to think of this not as the normalized sum of two vectors but as the midpoint between two points on the sphere, since this suggests that the Jacobian isn't as complicated as one might think from the complicated form of the normalization.

For a given midpoint, the two points forming it must both be in the hemisphere, and thus they must both be inside a spherical lune centred on the midpoint. We have to integrate the appropriate Jacobian over this lune. To find the Jacobian, fix one of the two points and move the other one. If you move towards the fixed point, the midpoint moves by exactly half as much, independent of the angles, whereas if you move in the perpendicular direction, the midpoint also moves in the perpendicular direction, but by a factor $\frac12\cos\alpha$ as much, where $\alpha$ is the angle between either of the two points and the midpoint. Thus, up to constant factors, the desired density is the integral over the lune of $\cos\alpha$.

Imagine the lune centred on the midpoint at the north pole. Then $\alpha$ is the polar angle, and $\cos\alpha$ is the $z$ coordinate. We can divide the lune into infinitesimal lunes that differ from each other by a rotation through an angle $\beta$ about the lune's diameter and have dihedral angle $\mathrm d\beta$. The integral of the $z$ coordinate over one of these is proportional to $\cos\beta\,\mathrm d\beta$, so the integral over the entire lune is proportional to

$$\int_{-\gamma}^\gamma\cos\beta\,\mathrm d\beta=2\sin\gamma\;,$$

where $2\gamma$ is the dihedral angle of the lune. Since $\gamma=\pi/2-\theta$, with $\theta$ the polar angle of the midpoint, the density for the midpoints is proportional to $\cos\theta$.

This is the density for the points, not for the angle $\theta$. To get that, we need to multiply by the density of points at angle $\theta$, which is proportional to $\sin\theta$, so the density for $\theta$ is proportional to $\sin\theta\cos\theta$, and thus to $\sin(2\theta)$, in agreement with Sasha's result.

-

Let $n_k = \{\sin(\theta_k) \sin( \phi_k), \sin(\theta_k) \cos(\phi_k), \cos(\theta_k)\}$ for $k=1,2,3$, where $n_3 = \frac{n_1+n_2}{| n_1+n_2 | }$, then with some algebra (I used CAS): $$\cos(\theta_3) = \frac{\cos(\theta_1) + \cos(\theta_2)}{\sqrt{2 \left(1+\cos(\theta_1) \cos(\theta_2) + \sin(\theta_1) \sin(\theta_2) \cos(\phi_1-\phi_2) \right)}}$$ Since $0 \leqslant \cos(\theta) \leqslant 1$ on the hemisphere, let $X_k = \cos^2(\theta_k)$, then: $$X_3 = \frac{ X_1 + X_2 + 2 \sqrt{X_1 X_2} }{2 \left( 1 + \sqrt{X_1 X_2} + \sqrt{(1-X_1)(1-X_2)} \cos(\phi_1-\phi_2) \right)}$$ where $f_{X_1}(x) = f_{X_2}(x) = \frac{1}{2 \sqrt{x}} I(0<x<1)$, i.e. $X_1, X_2 \sim \operatorname{Beta}(1/2,1)$. Now we have to compute, for $0<z<1$: $$F_{X_3}(z) = \mathbb{P}\left( X_1 + X_2 + 2 \sqrt{X_1 X_2} \leqslant 2 z \left( 1 + \sqrt{X_1 X_2} + \sqrt{(1-X_1)(1-X_2)} \cos(\phi_1-\phi_2) \right) \right)$$ It is easier to carry out integrals over $\phi_1$ and $\phi_2$ first. $$\begin{eqnarray} F_{X_3}(z) &=&\mathbb{E}\left( \mathbb{P}\left( \left. \cos(\phi_1 - \phi_2) \geqslant \frac{\left(X_1 + X_2 - 2 z\right) + 2 (1-z) \sqrt{X_1 X_2}}{2 z\sqrt{(1-X_1)(1-X_2)} } \right| X_1, X_2 \right)\right) \\ &=& \mathbb{E}\left( \frac{1}{\pi} \arccos \left( \mathcal{C}_{(-1,1)}\left( \frac{\left(2(1-z) - (1-X_1) -(1-X_2)\right) + 2 (1-z) \sqrt{X_1 X_2}}{2 z\sqrt{(1-X_1)(1-X_2)} } \right) \right) \right) \end{eqnarray}$$ here $\mathcal{C}_{(a,b)}(x) = \begin{cases} a & x \leqslant a \\ x & a<x<b \\ b & x \geqslant b \end{cases}$.

The above is a formidable integral, however the simulation and quadratures suggests that $F_{X_3}(z) = \mathcal{C}_{(0,1)}(z)$, i.e. that $X_3$ is a uniform random variable:

-
@AndreasBrink If $\cos^2(\theta_3)$ follows a uniform distribution, the $\theta_3$ itself has density $\sin(2 \theta_3)$ for $0 \leqslant \theta_3 \leqslant \frac{\pi}{2}$. – Sasha May 24 '12 at 20:44
With a result so simple, there must be a simple proof of it... – Sasha May 25 '12 at 6:03
There is; see my answer :-) – joriki May 25 '12 at 9:05