# Average distance to perimeter of a polygon?

Trying to calculate heat transfer which is a function of distance of each molecule to the closest wall for various container shapes. For example, a rectangular prism versus a cylinder.

So I think that a 'thin' rectangular prism of volume V average distance to wall can be much less than average distance of a cylinder. Reducing only to the cross section, assuming a rectangle of dimension $x$, $.5x$, versus a cylinder of of radius $\sqrt{\frac{x^2}{2 \pi}}$ (which is same volume I think) what is the average distance from a point in the circle to the perimeter versus the average distance of a point in the rectangle to its closest perimeter?

For a circle I have this idea that if inscribe a smaller circle inside the big circle with the same center point, such that the smaller circle contains 1/2 the volume of the outer circle, then the average distance is radius of outer circle minus radius of inner circle. Is that correct?

For the rectangle I don't quite know -- whether the same approach could be used to inscribe a rectangle of the same aspect ratio which contains 1/2 the area of the outer rectangle and the average distance is the length of the perpendicular connecting the inner and outer rectangle?

Is this a correct approach?

The expected distance from a unit circle to a randomly chosen point inside the circle is given by $$\frac{1}{\pi}\int_{0}^{1}(1-r)(2\pi r)dr=\left(r^2-\frac{2}{3}r^3\right)\bigg\vert_{0}^{1}=\frac{1}{3};$$ as a function of the area of the circle, then, the expected distance is $${d}_{\text{circle}}(A)=\frac{1}{3\sqrt{\pi}}\sqrt{A} \approx 0.1881 \sqrt{A}$$ (which holds for circles of any size). For a square of side length $2$, the expected distance from the square to a random interior point (which can be calculated by considering a single quadrant) is $$\int_{0}^{1}y(2-2y)dy = \left(y^2-\frac{2}{3}y^3\right)\bigg\vert_{0}^{1}=\frac{1}{3}$$ as well, so $$d_{\text{square}}(A)=\frac{1}{6}\sqrt{A} \approx 0.1667 \sqrt{A}$$ for an arbitrary square. Finally, for a $2\times 4$ rectangle, you need to consider the short and long sides differently. Essentially you have two $2 \times 1$ end caps that behave like the square (so the average distance is $1/3$), and a $2\times 2$ central block for which the average distance is just $1/2$. The two components have equal areas, so the overall average distance is the average of $1/2$ and $1/3$, or $5/12$. Since the area of the entire rectangle is $8$, we have $$d_{\text{rect}}(A)=\frac{5}{24\sqrt{2}}\sqrt{A} \approx 0.1473 \sqrt{A}$$ for any rectangle with aspect ratio $2$.
If it helps, you can think of "unrolling" each shape, while preserving its area, so that the set of points at distance $d$ from the perimeter lies along $y=d$. For the circle and the square (and for any regular polygon), this gives a triangle with base equal to the original shape's perimeter. For the rectangle, though, it gives a trapezoid, because the points maximally distant from the perimeter are a line segment, not a single point.
• I think you forgot to multiply your first integral answer by $1\div \pi$. Apr 23, 2020 at 6:50
For a circle of radius $r$, the average distance to the circumference is $\frac 1{\pi r^2}\int_0^r (r-x)2\pi x dx$ because at radius $x$ the distance is $r-x$ and the area between $x$ and $x+ dx$ is $2 \pi x dx$. This gives $\frac 1{\pi r^2}\int_0^r (r-x)2\pi x dx=\frac 2{ r^2}(rx^2/2-x^3/3)|_0^r=\frac 13r$