# Geometrically find the center of a pentagon or hexagon

I wondered, is there a geometrical way to find the center of a pentagon or a hexagon? I'm not talking about equal sides, just polygons with 5 or 6 corners.

Like, with a triangle you can take the intersection of two medians to find the center. With a quadrilateral, the center is the intersection of the bimedians.

Is it possible to construct the center of pentagons and hexagons in a similar way?

Edit: Apparently is rather difficult, so I probably have to settle for a formula to calculate the centroid. I always learned that the $x$ and $y$ values of the centroid are just the mean values of the $x_i$ and $y_i$ values of the corners respectively, but Wikipedia says otherwise (Wiki):

$C_x = \dfrac{1}{6A} \displaystyle \sum_{i=0}^{n-1} (x_i+x_{i+1})(x_iy_{i+1}-x_{i+1}y_i)$

$C_y = \dfrac{1}{6A} \displaystyle \sum_{i=0}^{n-1} (y_i+y_{i+1})(x_iy_{i+1}-x_{i+1}y_i)$

Where $A = \dfrac{1}{2} \displaystyle \sum_{i=0}^{n-1} (x_iy_{i+1}-x_{i+1}y_i)$

I'm not entirely sure, but wouldn't those $(x_iy_{i+1}-x_{i+1}y_i)$ terms cancel out because you divide by the summation over the same interval? That would leave:

$C_x = \dfrac{1}{12} \displaystyle \sum_{i=0}^{n-1} (x_i+x_{i+1})$

which is rubbish, except for when your polygon has 6 corners -- and that's exactly the case on the source from Wikipedia, here.

Therefore I wonder, is my math correct and is this formula just a very elaborate way to calculate the centroid of a hexagon (and no other polygons), or is it just coincidence? If so, please explain the formula.

-
Convex polygons only? –  Guess who it is. Nov 27 '11 at 15:45
...can you define what you mean by "geometric"? Straightedge and compass? –  Guess who it is. Nov 27 '11 at 16:02
There's a marked difference between a ruler and a straightedge... –  Guess who it is. Nov 27 '11 at 16:05
@J.M., pun intended? I didn't know the difference. –  Ailurus Nov 27 '11 at 16:08
There might be a question of what "center" means. What's the center of a triangle? Google "triangle center" and you'll actually find an online encyclopedia listing dozens (maybe hundreds) of different kinds of "centers" of a triangle, with articles on their mathematical properties, and theorems proving that particular sets of four of them are concyclic, etc. etc. etc. For hexagons the story could be more complicated, I would think. –  Michael Hardy Nov 27 '11 at 16:34

You can find the centroid of a pentagon by noticing that a pentagon can be decomposed into the union of a triangle and a quadrilateral in different ways, and that the centroid of the pentagon lies on the line connecting the centroid of the quadrilateral and the triangle. So to find the centroid of a convex pentagon choose two nonadjacent vertices draw a line connecting them, compute the centroids of the triangle and quadrilateral, and draw the line connecting them. Then choose two different nonadjacent vertices, and repeat the procedure. The centroid lies at the intersection of the the two lines through the centroids. Non convex pentagons are dealt with similarly, but some care is necessary to avoid getting a triangle or quadrilateral with a vertex inside.

The same technique applies to hexagons, but you decompose them into two quadrilaterals.

This, combined with a general divide and conquer method should be enough to deal with any size polygon.

-
Very interesting, that's exactly what I was looking for! But how can one prove that the centroid is on the line connecting the two centroids (from the triangle and quadrilateral)? –  Ailurus Nov 28 '11 at 14:10
The centroid is the intersection of all the lines on which the polygon balances, and conversely, the polygon balances on any line through the centroid. So, as each piece would balance on the line through the two centroids the whole polygon does, and therefore as the whole polygon balances on that line, the centroid lies on that line. –  deinst Nov 28 '11 at 15:31
Very intuitive, thanks for this explanation :) –  Ailurus Nov 28 '11 at 15:49

Although I didn't check the formulas with which you are struggling, the logic behind them is as follows. Partition the polygon into triangles. This is especially easy for a convex polygon, as diagonals from one vertex to all other non-adjacent vertices triangulates. Compute the areas of the triangles. That's what the quadratic terms in your expressions represent. Compute the centroid of each triangle (by summing the coordinates of the three corners and dividing by 3). Form a weighted sum of (triangle area) $\times$ (triangle centroid). Finally, divide by the total area of the polygon.

C code for this computation (which works for nonconvex polygons as well) can be obtained at this link.

-
Thanks for your clarification! Am I correct in assuming that this formula results in the same centroid position as taking the mean $x$ and $y$ values of the corners, for convex polygons? In other words, the result is (or might be) only different when the polygon is not convex, right. –  Ailurus Nov 27 '11 at 22:12
@Ailurus the mean of the $x$ and $y$ values is not in general the centroid of the convex polygon. To see this take a convex polygon and add a bunch of new vertices infinitesimally close to one of the original vertices. The mean of the vertices will move close to the pile of new points, but the centroid will remain in the same place. The centroid is the mean of all the points in the polygon, not just the vertices. –  deinst Nov 28 '11 at 0:18