# Average Distance on a Circle

What is the average distance between two points on a circle?

We define the distance as going through the circle as going around the circle reduces the problem to the problem of average distance on a line, see [Average Distance on a Line](Average Distance on a Line).

The circle as one of the most symmetric shapes we can thing of. Thus we can select the (1,0) on the unit circle and compute the average distance to any other point. If you use a browser supporting the “canvas” tag you should see an animated illustration of the problem below

Figure | Statistics | |
---|---|---|

Iterations | ||

Current | ||

Average | ||

"True value" | ||

Error |

The problem is to determine the average length of the blue line.

The unit circle is described by the function

$$ p( \theta ) = \sqrt{ (1-cos \theta )^2 + sin^2 \theta } $$

where we get our reference point when $$\theta = 0$$

Going through the circle we have the distance function

$$ d(x_0, p( \theta ) ) = \sqrt{ (1-\cos \theta )^2 + \sin^2 \theta } $$

Due to symmetry we can look at the circle in the upper plane, that is, for \( \theta \in [0;\pi] \). We are now ready to integrate the distance function

$$
\frac{1}{\pi} \int_{0}^{\pi} d(x_0, p( \theta ) d\theta

$$

Using the free collection of mathematical software Sage we get that

$$ \int d(x_0, p( \theta ) d\theta = \frac{-4}{ \sqrt{ \frac{\sin^2\theta}{(\cos \theta + 1)^2} + 1}} $$

However, if we use this indefinite integral to compute the result of the definite integral we get

$$
\frac{-4}{\pi} \left[

\frac{1}{ \sqrt{ \frac{\sin^2\pi}{(\cos \pi + 1)^2} + 1}} - \frac{1}{ \sqrt{ \frac{\sin^2 0}{(\cos 0 + 1)^2} + 1}}
\right]
$$

and a division with zero in the first term within the parenthethis. Bummer, we need to get a bit more creative.

If we approach \( \pi \) that is we get limit and using L’Hospitals rule once (L’Hospital on Mathworld we get

$$ \lim_{x \leftarrow \pi} \frac{\sin^2 x}{(\cos x + 1)^2} = \lim_{x \leftarrow \pi} \frac{- \cos x}{\cos x + 1} = 0 $$

because the denominator goes to zero while the nominator goes to -1.

Thus ``we set the first term to zero’’ we get the result that the average distance is

$$ \frac{-4}{\pi} (-1) = \frac{4}{\pi} $$

Monte-Carlo integration seems to verify the result - if the Javascript of this page is running you will see the Monte-Carlo estimate next to the animation above.