12

How can I find the average euclidean distance between two points randomly chosen (independent and uniform) on the surface of a unit $n$-cube? I am specifically interested in the closed forms of this average for a square and cube.


The related problem of determining the average distance with two points in (not on) a square is discussed here. In general, the formula for the expected distance between two random points of a unit $n$-cube is $$ \begin{aligned} \Delta(n) &= \int_{\vec{r},\,\vec{q} \in [0,1]^n} |\vec{r} -\vec{q}| \,\mathcal{D}\vec{r}\,\mathcal{D}\vec{q} \\ &= \int_{0}^{1} \!\cdots\int_{0}^{1} \bigl[(r_1 - q_1)^2 + \cdots +(r_n - q_n )^2\bigr]^{1/2} \,dr_1 \cdots dr_n\,dq_1 \cdots dq_n \end{aligned} $$

Also, the expected distance of a random point from any vertex of the $n$-cube is $$ B(n) = \int_{0}^{1} \!\cdots \int_{0}^{1} (r_1^2 + \cdots + r_n^2)^{1/2} \,dr_1 \cdots dr_n $$ However, I am not sure how to set up an equation that represents the problem above (the surface of the $n$-cube rather than inside the $n$-cube). The integrals above only represent a similar variant of this problem, or a specific case (only the vertex, not entire surface). Any insight is appreciated, thanks.

1 Answers1

11

It looks like even for $\Delta(n)$ a general closed form is not known, and this problem will be strictly harder. But if you are happy with solutions left in terms of iterated integrals, then we can do that here as well.

There are three cases for two points on the surface of the $n$-cube:

  1. Points on the same face. In this case, the average distance $D_{\text{same}}$ between them is simply $\Delta(n-1)$.
  2. Points on adjacent faces. In this case, the average distance $D_{\text{adj}}$ between them is $$D_{\text{adj}} = \int_0^1 \dots \int_0^1\sqrt{(q_1-r_1)^2 + \dots + (q_{n-2}-r_{n-2})^2 + r_{n-1}^2 + q_n^2}\,\mathrm dr_1 \dots \mathrm dr_{n-1} \mathrm dq_1 \dots \mathrm dq_{n-1}$$ where we think of the points as $(r_1, \dots, r_{n-1},0)$ and $(q_1, \dots, q_{n-2}, 0, q_n)$.
  3. Points on opposite faces. In this case, the average distances $D_{\text{opp}}$ between them is $$D_{\text{opp}} = \int_0^1 \dots \int_0^1\sqrt{(q_1-r_1)^2 + \dots + (q_{n-1}-r_{n-1})^2 + 1}\,\mathrm dr_1 \dots \mathrm dr_{n-1} \mathrm dq_1 \dots \mathrm dq_{n-1}$$ where we think of the points as $(r_1, \dots, r_{n-1},0)$ and $(q_1, \dots, q_{n-1}, 1)$.

No matter where the first point is, there are $2n$ equally likely faces to choose for the second point: $1$ same face, $2n-2$ adjacent faces, and $1$ opposite face. So we can combine the integrals above for a final answer of $$\frac1{2n} D_{\text{same}} + \frac{2n-2}{2n} D_{\text{adj}} + \frac1{2n} D_{\text{opp}}.$$ For the purposes of asymptotics, note that $D_{\text{same}} \le D_{\text{adj}} \le D_{\text{opp}}$, but $D_{\text{same}} = \Delta(n-1)$ is known to have some precise bounds on the order of $O(\sqrt n)$ (see the Wikipedia entry) and $D_{\text{opp}} \le D_{\text{same}} + 1$ by the triangle inequality. So the result here will be asymptotically the same as $\Delta(n-1)$ or $\Delta(n)$ as well.

Misha Lavrov
  • 159,700
  • 5
    Also, it's known that for large $n$ almost all points are near the surface. So, it's to be expected that the asympotics are the same. – leonbloy Feb 25 '25 at 19:57
  • 2
    @leonbloy True, though we have to be cautious about how we turn that expectation into concrete quantities. For example, I was briefly tempted to compare the average distance between $q,r \in [0,1]^n$ and their projections $q', r'$ onto the nearest surface. But if you do this, the location of $q', r'$ ends up biased toward the middle of that surface, because points near the middle have a wider possible range for the coordinate in $q$ or $r$ that got rounded to $0$ or $1$. – Misha Lavrov Feb 25 '25 at 20:37