# Is the point of a shape with the greatest average ray length also the "centroid"?

By a shape I mean one with a enclosed area. One example can be with $x^2+y^2+\sin{4x}+\sin{4y}=4$. I am dealing with implicit relations on a 2-d plane.

By the "ray length" I mean the length of the line segment from any chosen point inside the enclosed area to a point on the boundary of the shape.

Just in case you do not know how to find the average ray length you can start by converting an implicit relation into polar form. Just substitute $x=r\cos{\theta}$ and $y=r\sin{\theta}$ in $f(x,y)=0$.

Then to choose a point inside an implicit relation just convert $f(x+u,y+v)=0$ (because we want our chosen point at the pole) and with substitution get $f(r\cos\theta+u,r\sin\theta+v)$. From here you solve for $r$ In terms of $\theta$ $u$ and $v$ as $r=g(\theta)$ then take the area as $\frac{1}{2\pi}\int_{0}^{2{\pi}}g(\theta){d\theta}$ and find the $u$ and $v$ (u,v) with the greatest area. If this is not possible you could implicitly find the area under $f(r\cos\theta+u,r\sin\theta+v){d\theta}$ ,where $r>0$ and the area between $0<\theta<2\pi$. Then divide the area by $2\pi$ and once again find the $u$ and $v$ in point (u,v) with the greatest area.

(If you are not clear with how the area should be calculated treat the polar equation as cartesian implicit function. Replace $r=y$ and $\theta=x$ to get $f(y\cos{x}+u,y\sin{x}+v)$ and then proceed.

Here is an example with the circle https://files.acrobat.com/a/preview/38a501f2-5b63-4b76-b720-6cadb9c3e142

The centroid can be found online in https://en.wikipedia.org/wiki/Centroid.

When it came to a circle and ellipse I found the point of "highest average ray length" and "center of mass" to be the same. However I am not sure how to figure this out with more complicated implicit relations like $x^2+y^2+\sin{4x}+\sin{4y}=4$. Are there any approaches to finding the difference using calculus or numerical integration?

• For a circle of radius 1, I got that the average radius at the center is $\frac{2}{3}$, and that the radius from a point on the boundary is $\frac{32}{9\pi}\approx 1.13$. So I'm not sure how you got the conclusion about "highest average radius" for the circle. Dec 25, 2015 at 18:13
• Oh if you followed my procedure I cant understand but if not the average radius should be 1 in the center . At the boundary I got the average radius approximately .6366197. I'll clarify my procedure. Dec 25, 2015 at 18:48
• I was looking at the average radius to points in an enclosed region, and not to the points on the boundary. My mistake. Dec 25, 2015 at 18:53
• Would you mind explaining your calculations for the point on the boundary of a circle, i.e. the integral you were evaluating? Your definition of average radius is not at all syncing with my intuition of what it should be. Dec 25, 2015 at 19:11

No, consider a C-shaped area, where the center of mass is obviously outside of the shape, and cannot be within the shape. Perhaps you might want to consider convex shapes but even with those I do not believe center of mass is the point of the highest average radius. I think your idea could only (perhaps) work if you only consider the boundary of the shape and its mass (but the area within has no mass).

• Do you know of other kinds of centers I can look into? I think there could be other centers related to that of the average radius. Dec 24, 2015 at 22:15
• See e.g. en.wikipedia.org/wiki/List_of_centroids and you might also want to look into the center of mass of curve segments. Dec 24, 2015 at 22:24
• I realized by center of mass I meant centroid. Sorry for the confusion. Dec 24, 2015 at 22:55
• Is it okay if you modify your answer. Dec 28, 2015 at 15:24
• Here is the link files.acrobat.com/a/preview/… to clarify your result. Dec 30, 2015 at 12:39

The centroid is the point from which the average squared radius is minimized, but there is no such extremum characterization involving the average radius itself.

The only nonconstant functions $f(r)$ of the "radius" for which the centroid is always a point at which the average value of $f(r)$ is extremal, are $f(r)= Ar^2 + B$ for constant $A$ and $B$.

Updated after the edit to the question.

The preceding statements are correct for a given integration measure on the figure. The centroid and the average squared radius are computed with respect to that measure, whichever it may be.

If "figure" is meant as the interior of the curve then area measure is the standard choice and is what is always meant when speaking of centroids. If the curve is imagined as a bent physical wire of uniform density, the center of gravity of the wire is not the centroid of the 2-dimensional region bounded by the curve.

Using $d\theta$ relative to the center point of the rays as integration measure on the curve is not an averaging procedure, because the measure of intervals on the curve depends on the center point.

• Are you talking about the radius of gyration? Dec 24, 2015 at 23:00
• For point $P$, the average of $|PX|^2$, for $X$ in the figure.
– zyx
Dec 24, 2015 at 23:02
• So this is how to find the average radius from a centroid? Dec 24, 2015 at 23:13
• It is a quantity that is minimized when P is the centroid. If you are asking how to compute the average for a given P that is a different question (answered in any multivariable calculus textbook). I don't think there is any other function of distance (to P) that is minimized at the centroid except squared distance.
– zyx
Dec 24, 2015 at 23:19
• That is (postable as) a separate question about the circle and not general shapes. Surely the statement is correct, the difficulty is in proving it for general points P inside the circle. A reasonable guess is that average(P) increases as P moves closer to the circle.
– zyx
Dec 30, 2015 at 21:12

To recapitulate: You have a closed curve $\mathcal C$, and you choose an arbitrary point $\mathbf p$ in its interior. For any angle $\theta$ you shoot a ray from $\mathbf p$ at an angle $\theta$ to the $x$-axis, and define $r$ to be the distance from $\mathbf p$ to the point $\mathbf q$ where the ray hits $\mathcal C$. (Ignore for the moment that $r$ is only a function of $\theta$ if the region is star-shaped with respect to $\mathbf p$.) Your average ray length is $$\bar r = \frac1{2\pi}\int_0^{2\pi}r\,\mathrm d\theta.$$

Now if you consider a differential element of length $\mathrm d\ell$ along the curve, a little geometry shows that $$r\,\mathrm d\theta = \cos\phi\,\mathrm d\ell,$$ where $\phi$ is the angle between the vector $\mathbf r = \mathbf q - \mathbf p$ and the normal to the curve at $\mathbf q$. Furthermore, $$\cos\phi = \hat{\mathbf r}\cdot\hat{\mathbf n},$$ where $\hat{\mathbf r} = \mathbf r/\|\mathbf r\|$ and $\hat{\mathbf n}$ is the unit normal at $\mathbf q$. So the integral is really $$\bar r = \frac1{2\pi}\oint_{\mathcal C} \hat{\mathbf r}\cdot\hat{\mathbf n}\,\mathrm d\ell.$$ Conveniently, this integral is well-defined even if the region is not star-shaped, and turns out to be equivalent to taking $r$ to be the total length of the ray that lies inside the curve.

Now that last integral is nothing but the total flux of the vector field $\hat{\mathbf r}$ through the closed curve $\mathcal C$, so we can apply the divergence theorem to find that \begin{align} \bar r &= \iint_{\mathcal A}(\nabla\cdot\hat{\mathbf r})\,\mathrm dA \\ &= \iint_{\mathcal R}\frac1r\,\mathrm dA, \end{align} where $\mathcal R$ is the region enclosed by $\mathcal C$. In other words, if we define the convolution kernel $$h(\mathbf x) = \frac1{\|\mathbf x\|},$$ then the average ray length $\bar r$ as a function of $\mathbf p$ is a convolution $$\bar r(\mathbf p) = \iint_{\mathbf x\in\mathbb R^2} h(\mathbf x-\mathbf p) 1_{\mathcal R}(\mathbf x)\,\mathrm dA,$$ or simply $$\bar r = h*1_{\mathcal R},$$ where $1_{\mathcal R}$ is the indicator function of the region $\mathcal R$.

• The integration measure $d\theta$ used to define "average distance from $p$" is a function of $p$, unlike $d\ell$ which depends only on the curve. This is visible in the formula comparing $d\theta$ to $d\ell$. The dependence on the center point of the rays makes it hard to interpret which $p$ is extremal since average($p_1$) and average($p_2$) are summing the ray lengths from the center in different ways. It also is not possible to say if the centroid is extremal because centroid is undefined without a fixed measure on the curve. To define "extremizer of average $r$" we need a measure.
– zyx
Jan 3, 2016 at 16:00
• I don't understand your comment. Are you saying there is a flaw in my derivation? Note that in the formula $r\,\mathrm d\theta = \cos\phi\,\mathrm d\ell$ it is $\phi$ on the right-hand side that depends on $\mathbf p$.
– user856
Jan 3, 2016 at 19:45
• I assumed that the derivation is flawless. I am saying that your formulas make explicit why the formalization of "average ray length from P" as an integral with respect to uniform angle measure around P is not correct. The angle $d\theta$ subtended at P by an infinitesimal segment of length $d\ell$ on the curve varies with P and that is what the $\cos \phi$ term is picking up.
– zyx
Jan 3, 2016 at 20:14
• Oh, I see, you are taking issue with the definition itself. But how can a definition be incorrect? To me it is perfectly fine: it is the average taken from $\mathbf p$'s point of view. One can imagine speaking of how "the average brightness of the night sky" varies from place to place, without imposing a measure on all the stars in the galaxy.
– user856
Jan 3, 2016 at 20:20
• That's a nice way to look at it (though I will have to think a bit to resolve whether it negates what I wrote previously). But how are we supposed to compare the brightness to that from "the centroid" without imposing a measure so as to be able to calculate the centroid of the stars / curve?
– zyx
Jan 3, 2016 at 20:35

I have confused you with the definition of mean radius with the average ray length. When people think of average radius they think of "average squared minimized" or mean radius.

What I am focusing on was more of average ray length, where a ray is from a point inside an enclosed shape point on the boundary of the shape. Then as the angle of the ray (in radians) shifts from $0$ to $2\pi$ the ray length for each $\theta$ created a "ray function" or $r(\theta)$. I want find the average of that ray function from $0$ to $2\pi$.

$$\frac{1}{2\pi}\int_{0}^{2\pi}r(\theta)$$

I asked a similar question here where the user @Rahul understood what I meant and gave a better explanation.

"Suppose the curve is star-shaped with respect to your center point $\mathbf p=(u,v)$, so that any ray emanating from $\mathbf p$ meets the curve exactly once, at say point $\mathbf q$. Then $r = \|\mathbf q - \mathbf p\|$, $\theta$ is the angle between $\mathbf q-\mathbf p$ and the $x$-axis, and the average radius is" $$\frac1{2\pi}\oint_{\mathbf q\in\mathcal C}\|\mathbf q-\mathbf p\|\,\mathrm d\theta.$$

Using a software technique he was able to find the point with the highest average ray length for $x^2+y^2+\sin(4x)+\sin(4y)=4$. While the centroid was $(-.163523,-.070653)$ the point of highest average ray length is $(-.052594,-.052505)$.

Despite this counter-example I found for circles, ellipses, rectangles and many simpler enclosed shapes; the centroid is the point with the highest average ray length.

Consider a line segment, say with a length of one. The average radius with respect to the midpoint is $1/4$, but the average radius with respect to either endpoint is $1/2$.

If you want a $2$-dimensional example, just consider a very thin rectangle where the same argument holds.

• Is this for the centroid? Dec 25, 2015 at 1:01
• When you said "center of mass" earlier I assumed you meant centroid, so yes. Note that the centroid of a line segment is its midpoint, and the centroid of a rectangle is in the center of the rectangle, i.e. the intersection of the perpendicular bisectors, which corresponds to the midpoint of a line segment as the width goes to zero. Dec 25, 2015 at 3:45
• According to my calculations on sage software the centroid of the rectangle $|x/10+y|+|x/10-y|=10$ is (0,0) but so is the point with the highest average radius. Perhaps you can show me some calculation to prove me wrong. Dec 25, 2015 at 14:45
• So the rectangle in question has vertices at $(\pm 50,\pm 5)$. I got that the average radius at $(0,0)$ is about $25.32$. On the other hand, if I look at the point $(-50,0)$, then I see that at the points in the rectangle with positive $x$ coordinate (which is half of the rectangle) have distance at least $50$ from $(-50,0)$, while the points with $x$ coordinate between $-25$ and $0$ (which is $1/4$ of the triangle) have distance at least $25$ from $(-50,0)$, so without any serious calculations I see that the average radius has to be at least $1/2*50+1/4*25 = 31.25>25.32$. Dec 25, 2015 at 18:36
• See this files.acrobat.com/a/preview/… to clarify your conception about the center of the rectangle. Dec 27, 2015 at 20:15