# Expected distance between random points on hyperplanes

Let $$\mathbf{p}$$ be a point on a unit $$n$$-sphere $$S_n$$ and let $$\mathcal{H}_n$$ be the set all hyperplanes passing through the center of $$S_n$$.

Question: What is the simplest way to calculate the expected Euclidean distance $$\mathbb{E}[d]$$ between $$\mathbf{p}$$ and a hyperplane selected uniformly at random from $$\mathcal {H}_n$$?

Should we calculate

$$\mathbb{E}[d]=\mathbb{E}\left[\frac{|x_n|}{\sqrt{\sum_{i=1}^n x_i^2}}\right]$$

where $$x_1, x_2, \ldots, x_n$$ are the values taken by the i.i.d. random variables $$X_1, X_2, \ldots, X_n \sim \mathcal{N}(0,1)$$?

Your method would yield the right answer, but it's more complicated than it needs to be. From this answer, to generate a random hyperplane passing through the origin, first pick a random point from the surface of the $$n$$-sphere. The hyperplane would then be defined by $$\langle x,u\rangle=0$$.
WLOG, let $$\mathbf{p} = (1, \underbrace{0, ..., 0}_{n-1})$$. The distance from the hyperplane defined by $$\langle x,u\rangle=0$$ to $$\mathbf{p}$$ would then be $$\left| \langle u, \mathbf{p}\rangle \right|$$. This is then simply $$|u_1|$$. This is the integral of $$|x_1|$$ over the $$n$$-sphere, divided by the "surface area" of the sphere. From this, this is given by $$\frac{\frac{2\pi^{\frac{n-1}{2}}}{\Gamma\left(\frac{n+1}{2}\right)}}{\frac{2\pi^{\frac{n}{2}}}{\Gamma\left(\frac{n}{2}\right)}} = \frac{\Gamma\left( \frac{n}{2}-1 \right)}{\Gamma\left(\frac{n-1}{2} \right)\sqrt{\pi}}$$