The centroid calculation for polygons relies on the shoelace formula (also known as the surveyor's formula) and principles of integral calculus applied to discrete coordinates:
Shoelace Formula for Area:
For a polygon with vertices (x₁,y₁), (x₂,y₂), ..., (xₙ,yₙ), the signed area is:
A = (1/2) × Σ(xᵢyᵢ₊₁ - xᵢ₊₁yᵢ) where the sum goes from i=1 to n, and (xₙ₊₁,yₙ₊₁) = (x₁,y₁)
Centroid Formula Derivation:
The centroid coordinates are derived from the first moment of area:
x̄ = (1/6A) × Σ(xᵢ + xᵢ₊₁)(xᵢyᵢ₊₁ - xᵢ₊₁yᵢ)
ȳ = (1/6A) × Σ(yᵢ + yᵢ₊₁)(xᵢyᵢ₊₁ - xᵢ₊₁yᵢ)
Mathematical Foundation:
These formulas come from Green's theorem applied to the double integrals that define centroid coordinates. The discrete sum approximates the continuous integral over the polygon area.
Complex Example Calculation:
Example: Calculate the centroid of a triangle with vertices A(0,0), B(4,0), C(2,3).
Step 1: Calculate signed area using shoelace formula:
A = (1/2)[(0×0 - 4×0) + (4×3 - 2×0) + (2×0 - 0×3)] = (1/2)[0 + 12 + 0] = 6
Step 2: Calculate centroid coordinates:
x̄ = (1/36)[(0+4)(0×0-4×0) + (4+2)(4×3-2×0) + (2+0)(2×0-0×3)] = (1/36)[0 + 72 + 0] = 2
ȳ = (1/36)[(0+0)(0×0-4×0) + (0+3)(4×3-2×0) + (3+0)(2×0-0×3)] = (1/36)[0 + 36 + 0] = 1
Result: Centroid is at (2, 1), which matches the known triangle centroid formula of averaging vertices.