Average distance from centre of regular polygon to perimeter I am trying to find the average distance between the centre of an $n$-sided regular polygon, and all its points on the perimeter in terms of its side length $x$, and its number of sides $n$.
I have tried taking the maximum and minimum possible distances and then averaging them, however I am fairly certain this will only give a rough approximation. Maybe there is some calculus approach that I'm missing?
Any ideas?
Progress edit:
I simplified this question down (by symmetry) to finding the average distance from the corner of a right triangle (with shorter sides of $\frac{x}{2}\cot{\frac{\pi}{n}}$ and $\frac{x}{2}$) to the opposite edge:
I led the distance be $d$:
so $d=\frac{x}{2\tan{\frac{\pi}{n}}}\sec{\theta}$, where $\theta$ is the angle between the base of the triangle and $d$.
Then I took the average of $d$ as $\theta$ ranges from $0$ to $\frac{\pi}{n}$:
Average = $$\frac{n}{\pi}\int_0^{\frac{\pi}{n}}{\frac{x}{2\tan{\frac{\pi}{n}}}\sec{\theta}d\theta}$$
which I then found to be
$$=\frac{nx}{2\pi\tan{\frac{\pi}{n}}}ln{|\sec{\frac{\pi}{n}}+\tan{\frac{\pi}{n}}|}$$
Have I done something wrong here? Am I taking the average with respect to the wrong variable?
 A: tl; dr: There are multiple ways to define and compute the average distance requested, depending on the "measure" we put on each side of our $n$-gon. No one of them is The True Mathematical Answer. Instead, the measure must be chosen as part of the question. (Many probability "paradoxes" result from glossing over this central detail by assuming "at random" has a single geometric meaning.)

To fix coordinates, parametrize one side of our $n$-gon using the polar angle $\theta$, so that
$$
(x, y) = (\cos\tfrac{\pi}{n}, \sin\theta),\qquad
0 \leq \theta \leq \tfrac{\pi}{n}.
$$
The distance function to the center is
$$
r = \sqrt{x^{2} + y^{2}} = \sqrt{\cos^{2}\tfrac{\pi}{n} + \sin^{2}\theta}.
$$
The average with respect to a measure $d\mu$ is
$$
\int_{-\pi/n}^{\pi/n} r\, d\mu.
$$
$n$-gon" />
Three measures are shown in the diagram:

*

*The "angle" measure $d\theta$, for which small pieces of the side are counted proportionally to the subtended angle at the origin. The probability density is the constant function (green) $\frac{n}{2\pi}$ on $(-\frac{\pi}{n}, \frac{\pi}{n}]$ whose integral is $1$. (The height is doubled for visual clarity.) The average distance in this measure is
$$
\frac{n}{2\pi}\int_{-\pi/n}^{\pi/n} \sqrt{\cos^{2}\tfrac{\pi}{n} + \sin^{2}\theta}\, d\theta
= \frac{n}{\pi}\int_{0}^{\pi/n} \sqrt{\cos^{2}\tfrac{\pi}{n} + \sin^{2}\theta}\, d\theta.
$$


*The "arc length" measure $ds = dy = \cos\theta\, d\theta$, for which small pieces of the side are counted proportionally to their Euclidean length. The probability density is the function $(\cos\theta)/2\sin(\pi/n)$ (blue, again with height doubled for clarity in the diagram). This density is smaller near the endpoints because an interval of length $ds$ subtends a smaller angle at the center the further the lies from the midpoint of its side. (Equivalently, a fixed angular increment describes a longer interval farther from the midpoint.) The average distance in this measure is
$$
\frac{1}{2\sin(\pi/n)}\int_{-\pi/n}^{\pi/n} \sqrt{\cos^{2}\tfrac{\pi}{n} + \sin^{2}\theta}\cos\theta\, d\theta
= \frac{1}{\sin(\pi/n)}\int_{0}^{\pi/n} \sqrt{\cos^{2}\tfrac{\pi}{n} + \sin^{2}\theta}\cos\theta\, d\theta.
$$
This may be evaluated using first-year calculus. (I haven't evaluated, but the formula in your post, which resembles the antiderivative of $\sqrt{a^{2} + u^{2}}\, du$, in not implausible.)


*The "delta" measure supported at the midpoint and vertex, for which a small piece of side has "mass" $\frac{1}{2}$ if it contains the midpoint or vertex. Loosely, the density function (purple) should be viewed as infinite at these two points, signified by the dashed arrows. (To make this intuition mathematically rigorous it's necessary to re-cast "measures as integrals of probability densities" in other terms.) The average distance in this measure is your first estimate:
$$
\tfrac{1}{2}(\cos\tfrac{\pi}{n} + 1).
$$
