Shoelace formula

The shoelace formula, also known as Gauss's area formula and the surveyor's formula,[1] is a mathematical algorithm to determine the area of a simple polygon whose vertices are described by their Cartesian coordinates in the plane.

[2] It is called the shoelace formula because of the constant cross-multiplying for the coordinates making up the polygon, like threading shoelaces.

The formula was described by Albrecht Ludwig Friedrich Meister (1724–1788) in 1769[4] and is based on the trapezoid formula which was described by Carl Friedrich Gauss and C.G.J.

[5] The triangle form of the area formula can be considered to be a special case of Green's theorem.

The area formula can also be applied to self-overlapping polygons since the meaning of area is still clear even though self-overlapping polygons are not generally simple.

[6] Furthermore, a self-overlapping polygon can have multiple "interpretations" but the Shoelace formula can be used to show that the polygon's area is the same regardless of the interpretation.

[7] Given: A planar simple polygon with a positively oriented (counter clock wise) sequence of points

The formulas: The area of the given polygon can be expressed by a variety of formulas, which are connected by simple operations (see below): If the polygon is negatively oriented, then the result

[8] The trapezoid formula sums up a sequence of oriented areas

The triangle formula sums up the oriented areas

The triangle formula is the base of the popular shoelace formula, which is a scheme that optimizes the calculation of the sum of the 2×2-Determinants by hand:

Sometimes this determinant is transposed (written vertically, in two columns), as shown in the diagram.

A particularly concise statement of the formula can be given in terms of the exterior algebra.

The Cartesian coordinate expansion of the outer produce with respect to the standard ordered orthonormal plane basis

In the diagram the orientation of an edge is shown by an arrow.

In case of a convex polygon (in the diagram the upper example) this is obvious: The polygon area is the sum of the areas of the positive trapezoids (green edges) minus the areas of the negative trapezoids (red edges).

In the non convex case one has to consider the situation more carefully (see diagram).

Because one half of the i-th determinant is the oriented area of the triangle

this version of the area formula is called triangle form.

Alternatively, this is a special case of Green's theorem with one function set to 0 and the other set to x, such that the area is the integral of xdy along the boundary.

indicates the oriented area of the simple polygon

From the triangle form of the area formula or the diagram below one observes for

Hence: Example: With the above notation of the shoelace scheme one gets for the oriented area of the One checks, that the following equations hold:

In higher dimensions the area of a polygon can be calculated from its vertices using the exterior algebra form of the Shoelace formula (e.g. in 3d, the sum of successive cross products):

(when the vertices are not coplanar this computes the vector area enclosed by the loop, i.e. the projected area or "shadow" in the plane in which it is greatest).

This formulation can also be generalized to calculate the volume of an n-dimensional polytope from the coordinates of its vertices, or more accurately, from its hypersurface mesh.

[10] For example, the volume of a 3-dimensional polyhedron can be found by triangulating its surface mesh and summing the signed volumes of the tetrahedra formed by each surface triangle and the origin:

where the sum is over the faces and care has to be taken to order the vertices consistently (all clockwise or anticlockwise viewed from outside the polyhedron).

Alternatively, an expression in terms of the face areas and surface normals may be derived using the divergence theorem (see Polyhedron § Volume).

Apply the divergence theorem to the vector field

Shoelace scheme for determining the area of a polygon with point coordinates
Basic idea: Any polygon edge determines the signed area of a trapezoid. All these areas sum up to the polygon area.
Shoelace scheme, vertical form: With all the slashes drawn, the matrix loosely resembles a shoe with the laces done up, giving rise to the algorithm's name.
Example
Horizontal shoelace form for the example.
Deriving the trapezoid formula
Triangle form: The color of the edges indicate, which triangle area is positive (green) and negative (red) respectively.
Manipulations of a polygon