Shoelace formula

Last updated

Shoelace scheme for determining the area of a polygon with point coordinates
(
x
1
,
y
1
)
,
.
.
.
,
(
x
n
,
y
n
)
{\displaystyle (x_{1},y_{1}),...,(x_{n},y_{n})} Shoelace3.png
Shoelace scheme for determining the area of a polygon with point coordinates

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. [2] It has applications in surveying and forestry, [3] among other areas.

Contents

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. Jacobi. [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]

The polygon area formulas

Basic idea: Any polygon edge determines the signed area of a trapezoid. All these areas sum up to the polygon area. Trapez-formel-einf.svg
Basic idea: Any polygon edge determines the signed area of a trapezoid. All these areas sum up to the polygon area.

Given: A planar simple polygon with a positively oriented (counter clock wise) 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. [8]

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 : [9]

Shoelace formula

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. Shoelace3.png
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.

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

A particularly concise statement of the formula can be given in terms of the exterior algebra. If are the consecutive vertices of the polygon (regarded as vectors in the Cartesian plane) then

Example Trapez-formel-beispiel.svg
Example
Horizontal shoelace form for the example. Trapez-shoelace.svg
Horizontal shoelace form for the example.

Example

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.

Deriving the formulas

Trapezoid formula

Deriving the trapezoid formula Trapez-formel-prinz.svg
Deriving the 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

Triangle form: The color of the edges indicate, which triangle area is positive (green) and negative (red) respectively. Trapezformel-3eckform.svg
Triangle form: The color of the edges indicate, which triangle area is positive (green) and negative (red) respectively.

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 formulas

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.

Manipulations 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:

  1. Moving affects only and leaves unchanged. There is no change of the area if is moved parallel to .
  2. Purging changes the total area by , which can be positive or negative.
  3. Inserting point between changes the total area by , which can be positive or negative.

Example:

Manipulations of a polygon Trapez-f-beisp-dyn.svg
Manipulations of a polygon

With the above notation of the shoelace scheme one gets for the oriented area of the

One checks, that the following equations hold:

Generalization

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).

See also

Related Research Articles

In elementary algebra, the binomial theorem (or binomial expansion) describes the algebraic expansion of powers of a binomial. According to the theorem, it is possible to expand the polynomial (x + y)n into a sum involving terms of the form axbyc, where the exponents b and c are nonnegative integers with b + c = n, and the coefficient a of each term is a specific positive integer depending on n and b. For example, for n = 4,

In mathematics, the determinant is a scalar value that is a certain function of the entries of a square matrix. The determinant of a matrix A is commonly denoted det(A), det A, or |A|. Its value characterizes some properties of the matrix and the linear map represented, on a given basis, by the matrix. In particular, the determinant is nonzero if and only if the matrix is invertible and the corresponding linear map is an isomorphism. The determinant of a product of matrices is the product of their determinants.

<span class="mw-page-title-main">Geometric series</span> Sum of an (infinite) geometric progression

In mathematics, a geometric series is the sum of an infinite number of terms that have a constant ratio between successive terms. For example, the series

In geometry, a polygon is a plane figure made up of line segments connected to form a closed polygonal chain.

In mathematics, the Euler numbers are a sequence En of integers defined by the Taylor series expansion

<span class="mw-page-title-main">Floor and ceiling functions</span> Nearest integers from a number

In mathematics, the floor function (or greatest integer function) is the function that takes as input a real number x, and gives as output the greatest integer less than or equal to x, denoted x or floor(x). Similarly, the ceiling function maps x to the smallest integer greater than or equal to x, denoted x or ceil(x).

<span class="mw-page-title-main">Euler's constant</span> Constant value used in mathematics

Euler's constant is a mathematical constant, usually denoted by the lowercase Greek letter gamma, defined as the limiting difference between the harmonic series and the natural logarithm, denoted here by log:

In mathematics, a generating function is a representation of an infinite sequence of numbers as the coefficients of a formal power series. Unlike an ordinary series, the formal power series is not required to converge: in fact, the generating function is not actually regarded as a function, and the "variable" remains an indeterminate. Generating functions were first introduced by Abraham de Moivre in 1730, in order to solve the general linear recurrence problem. One can generalize to formal power series in more than one indeterminate, to encode information about infinite multi-dimensional arrays of numbers.

<span class="mw-page-title-main">Centroid</span> Mean position of all the points in a shape

In mathematics and physics, the centroid, also known as geometric center or center of figure, of a plane figure or solid figure is the arithmetic mean position of all the points in the surface of the figure. The same definition extends to any object in -dimensional Euclidean space.

<span class="mw-page-title-main">Heron's formula</span> Triangle area in terms of side lengths

In geometry, Heron's formula gives the area of a triangle in terms of the three side lengths Letting be the semiperimeter of the triangle, the area is

In linear algebra, the adjugate of a square matrix A is the transpose of its cofactor matrix and is denoted by adj(A). It is also occasionally known as adjunct matrix, or "adjoint", though the latter term today normally refers to a different concept, the adjoint operator which for a matrix is the conjugate transpose.

<span class="mw-page-title-main">Farey sequence</span> Increasing sequence of reduced fractions

In mathematics, the Farey sequence of order n is the sequence of completely reduced fractions, either between 0 and 1, or without this restriction, which when in lowest terms have denominators less than or equal to n, arranged in order of increasing size.

In mathematics, specifically linear algebra, the Cauchy–Binet formula, named after Augustin-Louis Cauchy and Jacques Philippe Marie Binet, is an identity for the determinant of the product of two rectangular matrices of transpose shapes. It generalizes the statement that the determinant of a product of square matrices is equal to the product of their determinants. The formula is valid for matrices with the entries from any commutative ring.

<span class="mw-page-title-main">Trapezoidal rule</span> Numerical integration method

In calculus, the trapezoidal rule is a technique for numerical integration, i.e., approximating the definite integral:

In mathematics, the matrix exponential is a matrix function on square matrices analogous to the ordinary exponential function. It is used to solve systems of linear differential equations. In the theory of Lie groups, the matrix exponential gives the exponential map between a matrix Lie algebra and the corresponding Lie group.

In geometry, Plücker coordinates, introduced by Julius Plücker in the 19th century, are a way to assign six homogeneous coordinates to each line in projective 3-space, . Because they satisfy a quadratic constraint, they establish a one-to-one correspondence between the 4-dimensional space of lines in and points on a quadric in . A predecessor and special case of Grassmann coordinates, Plücker coordinates arise naturally in geometric algebra. They have proved useful for computer graphics, and also can be extended to coordinates for the screws and wrenches in the theory of kinematics used for robot control.

The second moment of area, or second area moment, or quadratic moment of area and also known as the area moment of inertia, is a geometrical property of an area which reflects how its points are distributed with regard to an arbitrary axis. The second moment of area is typically denoted with either an or with a . In both cases, it is calculated with a multiple integral over the object in question. Its dimension is L (length) to the fourth power. Its unit of dimension, when working with the International System of Units, is meters to the fourth power, m4, or inches to the fourth power, in4, when working in the Imperial System of Units or the US customary system.

In mathematics, Newton's identities, also known as the Girard–Newton formulae, give relations between two types of symmetric polynomials, namely between power sums and elementary symmetric polynomials. Evaluated at the roots of a monic polynomial P in one variable, they allow expressing the sums of the k-th powers of all roots of P in terms of the coefficients of P, without actually finding those roots. These identities were found by Isaac Newton around 1666, apparently in ignorance of earlier work (1629) by Albert Girard. They have applications in many areas of mathematics, including Galois theory, invariant theory, group theory, combinatorics, as well as further applications outside mathematics, including general relativity.

In linear algebra, the Laplace expansion, named after Pierre-Simon Laplace, also called cofactor expansion, is an expression of the determinant of an n × n-matrix B as a weighted sum of minors, which are the determinants of some (n − 1) × (n − 1)-submatrices of B. Specifically, for every i, the Laplace expansion along the ith row is the equality

<span class="mw-page-title-main">Ramanujan's master theorem</span> Mathematical theorem

In mathematics, Ramanujan's Master Theorem, named after Srinivasa Ramanujan, is a technique that provides an analytic expression for the Mellin transform of an analytic function.

References

  1. Bart Braden (1986). "The Surveyor's Area Formula" (PDF). The College Mathematics Journal. 17 (4): 326–337. doi:10.2307/2686282. JSTOR   2686282. Archived from the original (PDF) on 29 June 2014.
  2. 1 2 Dahlke, Karl. "Shoelace Formula" . Retrieved 9 June 2008.
  3. Hans Pretzsch, Forest Dynamics, Growth and Yield: From Measurement to Model , Springer, 2009, ISBN   3-540-88306-1, p. 232.
  4. Meister, A. L. F. (1769), "Generalia de genesi figurarum planarum et inde pendentibus earum affectionibus", Nov. Com. Gött. (in Latin), 1: 144.
  5. Max Koecher, Aloys Krieg: Ebene Geometrie, Springer-Verlag, 2013, ISBN 3662068095, 9783662068090, p. 116
  6. P.W. Shor; C.J. Van Wyk (1992), "Detecting and decomposing self-overlapping curves", Comput. Geom. Theory Appl., 2 (1): 31–50, doi: 10.1016/0925-7721(92)90019-O
  7. Ralph P. Boland; Jorge Urrutia (2000). Polygon Area Problems. 12th Canadian Conference on Computational Geometry. pp. 159–162.
  8. Antti Laaksonen: Guide to Competitive Programming: Learning and Improving Algorithms Through Contests, Springer, 2018, ISBN 3319725475, 9783319725475, p. 217
  9. Mauren Abreu de Souza, Humberto Remigio Gamba, Helio Pedrini: Multi-Modality Imaging: Applications and Computational Techniques, Springer, 2018, ISBN 331998974X, 9783319989747, p. 229
  10. Allgower, Eugene L.; Schmidt, Phillip H. (1986). "Computing Volumes of Polyhedra" (PDF). Mathematics of Computation. 46 (173): 171–174. doi: 10.2307/2008221 . ISSN   0025-5718. JSTOR   2008221.