TITLE: How can I calculate the centroid of polygon?
QUESTION [10 upvotes]: What is the way to calculate the centroid of polygon? I have a concave polygon of 16 points, and I want know the centroid of that.
thanks

REPLY [7 votes]: II.  SOLVE THE PROBLEM
Why doesn't a simple mean give the position of a centroid in a polygon? leads to formulas.
Frown.  I want to know how to set up and solve the problem. A solution can always be converted to a formula. The reverse --figuring out how a problem was solved by looking at the formula-- is very hard.  So I will solve problem from scratch.
A working demonstration of the method below can be found here.  The linked document is a Geogebra worksheet; feel free to download it, examine the code, and use it as you see fit.
A. Observation
The centroid of triangle $\Delta ABC$ is the simple average of its vertices:
$\;\;\;D = (A+ B + C)/3$.  What? Point order does not matter here: take the vertices A,B,C, in any order, they are the same triangle.  To prove the formula is correct, I might Integrate the triangle area; Find the balance point of figure ABC; or, with compass and straightedge, draw the intersection of the medians.  I say, the point is the same in every case.
B. Procedure
I will convert the problem into one I know how to solve:
Proposition: Find the centroid of a set of weighted points.

Chop Jerome up into mutually exclusive triangles.
Say there are m triangles. For each triangle $\;\Delta_k, \;k =1, 2, \ldots, m,\;$ find the centroid $C_k$, and the area (weight) $w_k$.  The set of weighted points is then $[\frac{w_k C_k}{J}],$ where J is the area of Jerome.
Solution:  Add 'em up.
I say, the resulting point is the centroid of the polygon.

I have a general solution (I can always carry out this procedure). But it's messy: I don't have a triangulation rule. Now what? A good way to generalize is to start with a case I can solve.
C. Case: Jerome is Convex 
It is commonly known that, given a convex polygon $P$, we may choose any vertex, $V,$ draw segments from $V$ to every non-adjacent vertex, and $P$ is correctly triangulated.
I will also use the following formulas:
 -Let any two sides of $\Delta ABC$ be vectors ${\rm  u =(u_1, u_2),\;\; v= (v_1, v_2)}.\;$  Then
 $\;\;\;{\rm Area}_{\Delta ABC} = \tfrac{1}{2}|{\rm  u \times  v}|,\;\;\;\;\;$where (the determinant) ${\rm u \times v}={\rm u_1 v_2-u_2 v_1}$.  
-Let sides $AB, AC$ of $\Delta ABC$ be vectors ${\rm  u, v}.\;$  Then the centroid D= (A+B+C)/3 can be written
 $\;\;\;D = A + \tfrac{1}{3}|{\rm  u +  v}|.$
I have gathered what I need. 
D. Solution

Let the counterclockwise path of my n-gon be given, in order, by
$\;\;[A_i] = A_1, A_2, \ldots, A_n$ For covenience, I choose $V=A_1$.
Draw the n-1 vectors from A_1 to the other vertices:
$\;\;[{\rm a_i}] = (A_{k+1}-A_1),\;\; k = 1, 2, \ldots n\!-\!1$
I have n-2 adjacent triangles with centroids
$\;\;[C_i] = A_1 + \tfrac{1}{3}{\rm (a_k+a_{k+1})},\;\; k = 1, 2, \ldots n\!-\!2$
And areas (weights)
$\;\;[w_i] = \tfrac{1}{2}{\rm (a_k\times a_{k+1})},\;\; k = 1, 2, \ldots n\!-\!2$
(I dropped the absolute value: counter-clockwise, ${\rm u \times v}$ is positive.) Then
Total area = $\sum_{k=1}^{n-2} w_k$ and
The centroid $C_J$  of Jerome is the sum of weighted triangle 'roids, divided by total area:
$\;\;C_J= {\large \frac{\sum_{k=1}^{n-2} w_k C_k}{\sum_{k=1}^{n-2} w_k}}$,

which can be written
$$(2)\;\;C_J= A_1+{\large \frac{1}{3} \frac{\sum_{k=1}^{n-2} ({\rm a_k+ a_{k+1}})({\rm a_k \times  a_{k+1}})}{\sum_{k=1}^{n-2} ({\rm a_k \times  a_{k+1}})}
}$$
I say, that this is in fact the complete solution: the determinants give signed areas: +/- according as the direction of rotation from $A_k$ to $A_{k+1}$, about $A_1$ is positive or negative, preserving measure in either case.
Being the thing to be done.