6

How do I compute the average distance of point inside an hypercube to the center of the hypercube as a function of the dimensionality of the space?

Here I consider the hypercube defined as $C_n=\{x\in\mathbb{R}^n: -\frac{1}{2}\leq x_i\leq\frac{1}{2}, \forall_{i\leq n}\}$ with center $(0, ..., 0)\in\mathbb{R}^n $

Since for a random point in $C_n$ we have that each component $X_i$ is uniformly distributed between $-\frac{1}{2}$ and $\frac{1}{2}$. And since all such components are independent, does it follow that:

$$E\left[\sqrt{\sum_{i=1}^n X_i^2}\right] = \sqrt{E\left[\sum_{i=1}^n X_i^2\right]}=\sqrt{\sum_{i=1}^n E\left[X_i^2\right]}=\sqrt{\sum_{i=1}^n \frac{1}{12}}=\sqrt{\frac{n}{12}}$$ ?

Edit: Of course my calculation is wrong! the square root of the expected value is not the expected value of the square root!

But the question remains: What is the correct expression?

If we don't have closed form, could we even try to get the value recursively?

as

$\begin{align} A(n) &= \int_0^{\frac{1}{2}}...\int_0^{\frac{1}{2}}\sqrt{x_1^2 + ... + x_n^2}dx_1...dx_n\\ &= \int_0^{\frac{1}{2}}...\int_0^{\frac{1}{2}}x_n\sqrt{\frac{x_1^2 + ... + x_{n-1}^2}{x_n^2}+1}dx_1...dx_n \\ &= \int_0^{\frac{1}{2}}x_n\left(\int_0^{\frac{1}{2}}...\int_0^{\frac{1}{2}}\sqrt{\frac{x_1^2 + ... + x_{n-1}^2}{x_n^2}+1}dx_1...dx_{n-1}\right)dx_n \\ &=? \int_0^{\frac{1}{2}}x_ng(A(n-1), x_n)dx_n \end{align}$

gota
  • 911
  • 1
    $E(\sqrt Y)=\sqrt{E(Y)}$? If only! – Angina Seng Mar 14 '19 at 18:51
  • 1
    By symmetry, $$C_n = \left[,-\frac{1}{2},\frac{1}{2},\right]^n$$ can be reduced to the first quadrant $$C_n' = \left[,0,\frac{1}{2},\right]^n$$ without changing the average distance computation. If we index points in $\mathbb{R}^n$ as $(x_1, x_2,x_3,...x_n)$, then we compute the desired average distance as: $$2^n\int_{0}^{1/2}\int_{0}^{1/2}\int_{0}^{1/2}\cdots \int_{0}^{1/2}\left(\sqrt{\displaystyle\sum_{k=1}^n x_k^2},\right)dx_1,dx_2,dx_3,\cdots,dx_n$$

    The volume of $C_n'$ is $1/2^n$, and we must divide by this volume. The innermost integrand is the distance formula.

    – Zubin Mukerjee Mar 14 '19 at 19:06
  • 1
    This question has a MathWorld page: http://mathworld.wolfram.com/HypercubePointPicking.html – vadim123 Mar 15 '19 at 05:07

1 Answers1

2

For $n=2$, we have a square given by $$C_2 = [-1/2, 1/2] \times [-1/2, 1/2]$$

Let the portion of $C_2$ in the first quadrant be $$C_2' = [0,1/2]\times[0,1/2]$$

By symmetry, the average distance from a point $P$ (chosen uniformly randomly from the interior of $C_2$) to the origin, will be the same as the average distance of a point $P'$ (chosen uniformly randomly from the interior of $C_2'$) to the origin.

We can find this average distance by integrating the distance formula over the quarter square, then dividing by the area of the region:

$$\displaystyle\frac{1}{\left(1/2\right)^2}\int_0^\frac{1}{2}\int_{0}^\frac{1}{2} \sqrt{x^2+y^2}\,dx\,dy = 4\int_0^\frac{1}{2}\int_{0}^\frac{1}{2} \sqrt{x^2+y^2}\,dx\,dy$$


In general, in $\mathbb{R}^n$, we can index points as $(x_1, x_2,x_3, ... , x_n)$. We have $$C_n = \left[\,-\frac{1}{2},\frac{1}{2}\,\right]^n$$

$$C_n' = \left[\,0,\frac{1}{2}\,\right]^n$$

The volume of the reduced portion of the $n$-dimensional hypercube, $C_n'$, is $1/2^n$. Therefore, we can compute the average distance as

$$\boxed{\mathbb{E}\,\left[\sqrt{\displaystyle\sum_{k=1}^n x_k^2}\,\right]=2^n\underbrace{\int_{0}^\frac{1}{2}\int_{0}^\frac{1}{2}\int_{0}^\frac{1}{2}\cdots \int_{0}^\frac{1}{2}}_{n\text{ integrals}}\left(\sqrt{\displaystyle\sum_{k=1}^n x_k^2}\,\right)dx_1\,dx_2\,dx_3\,\cdots\,dx_n\,\,}$$


In computation of the above integral, the following fact is useful:

If $A \in \mathbb{R}$ is a non-negative constant, then for any constant $B \in \mathbb{R}$, we have the antiderivative $$\int\sqrt{x^2+A} \,\,dx = \frac{A\ln\left|x+\sqrt{x^2+A}\right| + x\sqrt{x^2+A}}{2} + B$$

This fact makes the computation possible, albeit extremely messy.