Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to calculate the mean distance depending on circle shape points,

This is a mean for calculating all possible distances between any two points

for $N=2$, line, there is only 1 distance.

for $N=3$, triangle, again, there is only 1 distance

for $N=4$, square, henceforth there are more than 1 distance.. in this case we would have four distances for sides and two distances in diagonal path, $\sqrt{2}$, then the mean distance would be


for $N=30$, it would be a "pixeled" circle .. and $N=\infty$ is a circle

How to calculate it for $N>4$ ? Is there any general formula or can it be derived?


share|cite|improve this question
You could use the law of cosines to figure out the lengths of polygon chords... – J. M. Aug 14 '11 at 19:18
Actually, if the circle has unit radius, your example for N=4 has wrong distances: the long distances should be d=2. – leonbloy Aug 14 '11 at 20:03
I assume by "equidistributed" you mean the $n$ points are exactly the sides of a regular $n$-gon, as that's what your examples appear to intimate (although you seem to set the sides of the square of the $n=4$ case all equal to $1$, I will instead assume all points are located on the unit circle). In this case leonbloy's answer is the formula. – anon Aug 14 '11 at 20:16
up vote 3 down vote accepted

The average distances among all points must be equal that the average distances from a given point. By geometry: we have that the distance is $d=2 \sin(\theta/2)$, so:

$$\bar d = \frac{2}{N-1} \sum_{k=1}^{N-1} \sin\left(\frac{\pi k}{N}\right)$$

On the limit, $N\to \infty$, you replace the sum by an integral and you get the limit by Christian Blatter: $\bar d \to 4/ \pi$

For example, for $N=30$:

 >>>  N=30;
 >>>  r = 2* sin(pi*[1:N-1]/(N));
 >>> sum(r)/(N-1)
 ans =  1.3159
 >>> 4/pi
 ans =  1.2732

Update: If instead of having a unit circle (radius 1) we have that the distance among nearest neighbours is 1 (the question is not clear about this, and the example for N=4 only makes sense in this later case), we just divide the above result by $2\; \sin(\pi/N)$. In the limit, $\sin(\pi/N) \to \pi/N$ and so $\bar d \to N \; 2/\pi^2$

share|cite|improve this answer
Yes, the later I think Is the right answer, (because at least try to answer the right question!), I mean the real meaning of the question is for distance among nearest neighbours=1, so your answer would be $\bar d = \frac{1}{N-1} \frac{\sum_{k=1}^{N-1} \sin\left(\frac{\pi k}{N}\right)}{\sin(\pi/N)}$ Is it right? (I would like to have enough rep to upvote!) saludos desde Argentina! – Hernán Eche Aug 14 '11 at 23:44
@Hernan (tocayo y compatriota): Yes, that's right. – leonbloy Aug 15 '11 at 1:19

When two points $z_1$, $z_2$ are independently uniformly distributed on the unit circle $S^1$ then their mean distance $\bar d$ is ${4\over\pi}$. To prove this one may keep $z_1$ fixed and let $z_2$ have an angular distance $\phi\in[0,\pi]$ from $z_1$ which is uniformly distributed on $[0,\pi]$. The euclidean distance between these two points is given by $d(z_1,z_2)=2\sin{\phi\over2}$,whence $$\bar d={1\over\pi}\int_0^\pi 2\sin{\phi\over2} \ d\phi={4\over\pi}\ .$$ This can be interpreted as follows: If you have a polygon $P$ with $N\gg 1$ vertices independently and uniformly distributed on $S^1$ then the mean distance between these vertices will be approximately ${4\over\pi}$.

share|cite|improve this answer
It also not hard to derive the distribution for the distance: $f(d) = \frac{2}{\pi} \frac{1}{\sqrt{4-d^2}}$ where $0<d<2$. – Sasha Aug 14 '11 at 21:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.