Shoelace formula
Mathematical algorithm for calculating area of a simple polygon

The shoelace formula, also known as Gauss's area formula and the surveyor's formula, is a mathematical algorithm to determine the area of a simple polygon whose vertices are described by their Cartesian coordinates in the plane. It is called the shoelace formula because of the constant cross-multiplying for the coordinates making up the polygon, like threading shoelaces. It has applications in surveying and forestry, among other areas.
The formula was described by Albrecht Ludwig Friedrich Meister (1724-1788) in 1769 and is based on the trapezoid formula which was described by Carl Friedrich Gauss and C.G.J. Jacobi. 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. 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.
01The polygon area formulas
Given: A planar simple polygon with a positively oriented (counterclockwise) sequence of points in a Cartesian coordinate system.
For the simplicity of the formulas below it is convenient to set .
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 of the formulas is negative. In any case
is the sought area of the polygon.
Trapezoid formula
The trapezoid formula sums up a sequence of oriented areas of trapezoids with
as one of its four edges (see below):
Triangle formula
The triangle formula sums up the oriented areas of triangles
:
Shoelace formula
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.
Other formulas
Exterior algebra
A particularly concise statement of the formula can be given in terms of the exterior algebra. Let be the consecutive vertices of the polygon. The Cartesian coordinate expansion of the outer product with respect to the standard ordered orthonormal plane basis
gives
and the oriented area is given as follows.
Note that the area is given as a multiple of the unit area
.


02Example
For the area of the pentagon with
one gets
The advantage of the shoelace form: Only 6 columns have to be written for calculating the 5 determinants with 10 columns.

03Deriving the formulas
Trapezoid formula
The edge determines the trapezoid
with its oriented area
In case of the number
is negative, otherwise positive or
if
. In the diagram the orientation of an edge is shown by an arrow. The color shows the sign of
: red means
, green indicates
. In the first case the trapezoid is called negative in the second case positive. The negative trapezoids delete those parts of positive trapezoids, which are outside the polygon. 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). In any case the result is
Triangle form, determinant form
Eliminating the brackets and using
(see convention
above), one gets the determinant form of the area formula:
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.
Other formulae
With (see convention
above) one gets
Combining both sums and excluding
leads to
With the identity
one gets
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.

04Manipulations of a polygon
indicates the oriented area of the simple polygon
with
(see above).
is positive/negative if the orientation of the polygon is positive/negative. From the triangle form of the area formula or the diagram below one observes for
:
In case of
one should first shift the indices.
Hence:
- Moving
affects only
and leaves
unchanged. There is no change of the area if
is moved parallel to
.
- Purging
changes the total area by
, which can be positive or negative.
- Inserting point
between
changes the total area by
, which can be positive or negative.
Example:
With the above notation of the shoelace scheme one gets for the oriented area of the
- blue polygon:
- green triangle:
- red triangle:
- blue polygon minus point
:
- blue polygon plus point
between
:
One checks, that the following equations hold:

05Generalization
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. 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 and the polyhedron
with boundary
consisting of triangular faces
:
So
For each triangular face with vertices
,
denote the outward normal vector by
, denote the area by
.
is the normal vector of
with magnitude
.
The flux of through
is
For each point on
,
is the projection of the vector
onto the unit normal vector
, which is the height
of the tetrahedron formed by
and
.
So the integrand is constant
on
.
where is 6×the volume of the tetrahedron formed by
and
. The sign of the pseudoscalar value
represents the orientation of our area, and needs to be taken into account to calculate the total flux.
The total flux is the sum of the fluxes through all faces:

Sources and credits
This article is adapted from the Wikipedia article “Shoelace formula”, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.
Images, from Wikimedia Commons:
- Shoelace3.png by Job Bouwman, CC BY-SA 4.0
- Trapez-formel-einf.svg by Ag2gaeh, CC BY-SA 4.0
- Trapez-formel-beispiel.svg by Ag2gaeh, CC BY-SA 4.0
- Shoelace formula example.svg by cmglee, CC BY-SA 4.0
- Trapez-formel-prinz.svg by Ag2gaeh, CC BY-SA 4.0
- Trapezformel-3eckform.svg by Ag2gaeh, CC BY-SA 4.0
- Trapez-f-beisp-dyn.svg by Ag2gaeh, CC BY-SA 4.0
Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.