# Variance of x_i chosen from uniformly distributed hypersphere

I'm looking for an expression of the variance of a single component of a point chosen from within a uniformly distributed n-ball with radius r for any n.

There are a few proofs showing that components of a point chosen this way become increasingly normally distributed as n tends to infinity. I can't seem to find expressions for any n.

I didn't totally follow @kimchi lover's answer (particularly his assumption of normality), so here is a similar approach.

Suppose X is hyperspherically uniformly distributed with r=1, so each $$X_i$$ has $$E[X_i] = 0$$, and we want to compute $$VAR[X_i]$$. Since $$E[X_i]=0$$, by the variance-squares identity, we have $$VAR[X_i] = E[X^{2}_i] - E[X_i]^2 = E[X^{2}_i]$$, so we really just need to compute $$E[X^{2}_i]$$.

Notice that $$r^2 = \Sigma_{i=1}^n X^{2}_i$$, so we have $$E[r^2] = nE[X^{2}_i]$$. Since we know that r has pdf $$p_n (r) = nr^{n-1}$$, we can trivially compute $$E[r^2] = \int_0^1 r^2 nr^{n-1}dr = \frac{n}{n+2}$$, so then $$E[X^{2}_i] = VAR[X_i] = \frac{E[r^2]}{n} = \frac{1}{n+2}$$.

• How do you get obtian a formula for $p_n(r)$ for a generic $n$? Aug 24, 2020 at 21:24
• You can probably be more rigorous about it, but off-hand I know that volume of a hypersphere is proportional to $r^n$, so $V_n (r) \propto r^n$, so then the surface area of the shell at a given radial distance is $\frac{dV_n (r)}{dr} \propto nr^{n-1}$, i.e., $p_n (r) \propto nr^{n-1}$. To get the constant of proportionality, we just integrate $\int_0^R k*p_n (r) dr = 1$, which yields k=1, so $p_n (r)$ is actually equal to $nr^{n-1}$, not just proportional. Aug 24, 2020 at 22:01
• Ah I see. For the 3-D case, the way I would get $p_3(r)$ is to divide the volume of a sphere of radius $r$ (enclosed within the sphere of radius $R$), and we see that the CDF is $F_3(r) = \frac{r^3}{R^3}$, and then we differentiate this with respect to $r$ and get $3r^2/R^3$. Aug 24, 2020 at 23:04
• I think this approach might actually generalize to higher $n$. I just don't know what the volume of an n-th order hypersphere is, but it seems the CDF $F_n(r)$ will always be $r^3 / R^3$. I think the constant of proportionality is always $1$ for any $n$ and for any radius. Aug 24, 2020 at 23:05
• Yeah, that makes total sense, since the constants of proportionality in the numerator and denominator always just cancel to give 1. Aug 25, 2020 at 16:10

Assume first the radius of the ball is $$r=1$$.

Write your point $$X$$ as a scaled point of the surface of the unit sphere: $$X=R\sigma$$, where $$R=\|X\|$$ and $$\sigma=X/R$$. It should be easy to convince yourself (using spherical symmetry) that $$R$$ and $$\sigma$$ are independent, and that what you want is $$E[R^2]E[\sigma_1^2]$$. The density function for $$R$$ is $$n\rho^{n-1}$$, and $$E[\sigma_1^2] = E[Z_1^2/(Z_1^2+\cdots+Z_n^2)]= 1/n$$, where the $$Z_i$$ are iid $$N(0,1)$$ variates. Thus, $$\text{Var}(X_1) = E[X_1^2] -(E[X_1])^2 = E[X_1^2]-0^2 = \int_0^1 n\rho^{n-1} \rho^2\,d\rho \times \frac 1 n = \frac {n}{n+2} \times\frac 1 n = \frac 1 {n+2}.$$

Relaxing the assumption that $$r=1$$, a simple rescaling give the general expression that $$\text{Var}(X_1)=\frac{r^2}{n+2}$$. (Because if $$X$$ is uniformly distributed on the $$1$$-ball then $$rX$$ is uniformly distributed on the $$r$$-ball and for any random variable $$Y$$, we always know $$\text{Var}(rY) = r^2\text{Var}(Y)$$.)

Note we distinguish here between the non-random $$r$$, the radius of the problem-statement ball; $$R$$ the length of the random point in the ball; and $$\rho$$, the variable of integration when taking the expectation of $$R^2$$.

Going beyond the question asked here, this formulation can help in evaluating higher moments $$E\|X_1\|^k$$ for $$k>2$$, at the price of added complexity. One has $$E\|X_1\|^k=r^k E[R^k]E[\sigma_1^k]$$. The first expectation is just $$\int_0^1n\rho^{n-1}\rho^k d\rho$$ but the second involves the $$$$Beta'' distribution, and is given by a ratio of gamma functions.

• You're a star @kimchi; thank you. Marked answered. If you get a moment, could you elaborate on how you got $\frac{r^2}{n+2}$? Apr 24, 2019 at 21:10
• He got it from $VAR[cX] = c^2 VAR[X]$. May 15, 2019 at 18:43
• @Zwiddletwix Thanks for the catch! Feb 22, 2020 at 22:19