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

Algorithms for calculating variance play a major role in computational statistics. A key difficulty in the design of good algorithms for this problem is that formulas for the variance may involve sums of squares, which can lead to numerical instability as well as to arithmetic overflow when dealing with large values.

In mathematics, the Euler–Maclaurin formula is a formula for the difference between an integral and a closely related sum. It can be used to approximate integrals by finite sums, or conversely to evaluate finite sums and infinite series using integrals and the machinery of calculus. For example, many asymptotic expansions are derived from the formula, and Faulhaber's formula for the sum of powers is an immediate consequence.

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

<span class="mw-page-title-main">Variance</span> Statistical measure of how far values spread from their average

In probability theory and statistics, variance is the expected value of the squared deviation from the mean of a random variable. The standard deviation (SD) is obtained as the square root of the variance. Variance is a measure of dispersion, meaning it is a measure of how far a set of numbers is spread out from their average value. It is the second central moment of a distribution, and the covariance of the random variable with itself, and it is often represented by , , , , or .

<span class="mw-page-title-main">Euclidean planes in three-dimensional space</span> Flat surface

In Euclidean geometry, a plane is a flat two-dimensional surface that extends indefinitely. Euclidean planes often arise as subspaces of three-dimensional space . A prototypical example is one of a room's walls, infinitely extended and assumed infinitesimal thin. While a pair of real numbers suffices to describe points on a plane, the relationship with out-of-plane points requires special consideration for their embedding in the ambient space .

<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">Composite Bézier curve</span> Geometric shape

In geometric modelling and in computer graphics, a composite Bézier curve or Bézier spline is a spline made out of Bézier curves that is at least continuous. In other words, a composite Bézier curve is a series of Bézier curves joined end to end where the last point of one curve coincides with the starting point of the next curve. Depending on the application, additional smoothness requirements may be added.

In probability theory, the multinomial distribution is a generalization of the binomial distribution. For example, it models the probability of counts for each side of a k-sided dice rolled n times. For n independent trials each of which leads to a success for exactly one of k categories, with each category having a given fixed success probability, the multinomial distribution gives the probability of any particular combination of numbers of successes for the various categories.

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 geometry, the circumscribed circle or circumcircle of a triangle is a circle that passes through all three vertices. The center of this circle is called the circumcenter of the triangle, and its radius is called the circumradius. The circumcenter is the point of intersection between the three perpendicular bisectors of the triangle's sides, and is a triangle center.

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.

<span class="mw-page-title-main">Simple linear regression</span> Linear regression model with a single explanatory variable

In statistics, simple linear regression (SLR) is a linear regression model with a single explanatory variable. That is, it concerns two-dimensional sample points with one independent variable and one dependent variable and finds a linear function that, as accurately as possible, predicts the dependent variable values as a function of the independent variable. The adjective simple refers to the fact that the outcome variable is related to a single predictor.

In linear algebra, geometry, and trigonometry, the Cayley–Menger determinant is a formula for the content, i.e. the higher-dimensional volume, of a -dimensional simplex in terms of the squares of all of the distances between pairs of its vertices. The determinant is named after Arthur Cayley and Karl Menger.

<span class="mw-page-title-main">Møller scattering</span> Electron-electron scattering

Møller scattering is the name given to electron-electron scattering in quantum field theory, named after the Danish physicist Christian Møller. The electron interaction that is idealized in Møller scattering forms the theoretical basis of many familiar phenomena such as the repulsion of electrons in the helium atom. While formerly many particle colliders were designed specifically for electron-electron collisions, more recently electron-positron colliders have become more common. Nevertheless, Møller scattering remains a paradigmatic process within the theory of particle interactions.

In geometry, calculating the area of a triangle is an elementary problem encountered often in many different situations. The best known and simplest formula is where b is the length of the base of the triangle, and h is the height or altitude of the triangle. The term "base" denotes any side, and "height" denotes the length of a perpendicular from the vertex opposite the base onto the line containing the base. Euclid proved that the area of a triangle is half that of a parallelogram with the same base and height in his book Elements in 300 BCE. In 499 CE Aryabhata, used this illustrated method in the Aryabhatiya.

In mathematics, specifically in commutative algebra, the power sum symmetric polynomials are a type of basic building block for symmetric polynomials, in the sense that every symmetric polynomial with rational coefficients can be expressed as a sum and difference of products of power sum symmetric polynomials with rational coefficients. However, not every symmetric polynomial with integral coefficients is generated by integral combinations of products of power-sum polynomials: they are a generating set over the rationals, but not over the integers.

In statistics, the generalized Dirichlet distribution (GD) is a generalization of the Dirichlet distribution with a more general covariance structure and almost twice the number of parameters. Random vectors with a GD distribution are completely neutral.

In mathematics, the Jacobi curve is a representation of an elliptic curve different from the usual one defined by the Weierstrass equation. Sometimes it is used in cryptography instead of the Weierstrass form because it can provide a defence against simple and differential power analysis style (SPA) attacks; it is possible, indeed, to use the general addition formula also for doubling a point on an elliptic curve of this form: in this way the two operations become indistinguishable from some side-channel information. The Jacobi curve also offers faster arithmetic compared to the Weierstrass curve.

In mathematics, the Bloch group is a cohomology group of the Bloch–Suslin complex, named after Spencer Bloch and Andrei Suslin. It is closely related to polylogarithm, hyperbolic geometry and algebraic K-theory.

The trigonometry of a tetrahedron explains the relationships between the lengths and various types of angles of a general tetrahedron.

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.