# Average distance from a square's perimeter to its center

What is the average distance from any point on a unit square's perimeter to its center?

The distance from a square's corner to its center is $$\dfrac{\sqrt{2}}{2}$$ and from a point in the middle of a square's side length is $$\dfrac{1}{2}$$. A visual explanation of what I'm trying to explain

So, what would the average distance be, accounting for all the points along a square's perimeter?

Also if possible, a general formula for finding the average distance from center to edge of any $$n$$-sided regular polygon would be super awesome.

• Please learn how to ask a good question; math.meta.stackexchange.com/questions/9959/… Jun 1, 2020 at 5:03
• Unfortunately, a decent answer to your (quite interesting, but badly worded) question does require calculus. Jun 1, 2020 at 5:05
• Look at (0,0) to (1,0) to (1,1) to (0,0). Jun 1, 2020 at 5:13
• I apologize, this is my first question, so I'd appreciate your patience with me improving! Jun 1, 2020 at 5:45
• “Average distance” isn’t well-defined. You get a different result if you average over the angle to the point than if you average over the distance along the side of the square.
– amd
Jun 1, 2020 at 20:36

Consider a square ABCD of side $$a$$ centered at the origin $$O$$ (as shown in above figure) By symmetry, the square ABCD is divided into $$8$$ congruent right triangles.

Consider any arbitrary point $$P$$ on square in first quadrant at an angle $$x$$ with +ve X-axis. The distance of point P from the center O is $$\dfrac{a}{2}\sec x$$. Taking average of distances of all the points on the perimeter of square (using symmetry of quadrants) as follows $$D_\text{avg}=\frac{8\int_0^{\pi/4}\frac{a}{2}\sec x\ dx}{2\pi}$$ $$=\frac{2a}{\pi}\int_0^{\pi/4}\sec x\ dx$$ $$=\frac{2a}{\pi}\left[\ln\left|\tan\left(\frac{x}{2}+\frac{\pi}{4}\right)\right|\right]_0^{\pi/4}$$ $$=\frac{2a}{\pi}\ln(\sqrt2+1)$$ Therefore, the average distance from the center of all the points on the perimeter of a unit square ($$a=1$$) will be $$\frac{2}{\pi}\ln(\sqrt2+1)\approx 0.561099852 \ \mathrm{unit}$$

As mentioned in the comments, this answer requires calculus, I'll provide a general solution that should be applicable to all regular polygons.

Consider only $$\frac 1{2n}$$th of a n-sided polygon, from the centre of one side to the nearest vertex. Finding the average distance of this segment to the centre is sufficient, as the average will be the same for all other segments.

If this segment subtends a total angle of $$\theta$$ at the centre, then the distance from centre of a point on this segment is given by $$d = r\cos\theta \sec\alpha$$ Where $$\alpha$$ is the angle of this point. The average distance can be found by integrating through the angle $$\theta$$ $$\overline d = \frac{\int_0^\theta r\cos\theta \sec\alpha d\alpha}{\theta}\\ \overline d = \frac r \theta \cos\theta \ln|\sec\theta + \tan\theta|$$

For a n-sided polygon, $$\theta = \frac \pi n$$ and $$r$$ is the distance of a vertex from the centre. Substituting $$n=4$$ and $$r=\frac {1}{ \sqrt{2}}$$ should give you the distance for a square of unit side.

• A diagram would explain this better but I'm currently on a mobile :/ Jun 1, 2020 at 5:23