# Area of a Polygon

When calculating problems involving coordinate geometry, you will often come across problems that require the use of the distance formula to calculate the distance between two points, the formula to calculate the midpoint of a line segment, or even a more complex formula, the section formula. But, have you ever considered what happens if you try to make or construct a polygon on a Cartesian plane?

A polygon is an area enclosed by multiple straight lines, with a minimum of three straight lines, called a triangle, to a limitless maximum of straight lines. Calculating the perimeter and area of a polygon is an often-discussed topic in geometry and is the essence and soul of geometry, with the exception of circles or curved lines.

Through the articles above, we have become accustomed to calculating the distance between two points, but have we stopped to consider calculating the area of a polygon, given the coordinates of the polygon? In this article, we will show you how to calculate the area of a polygon on a Cartesian plane, which is widely used in fields such as architecture, engineering, and design.

#### Contents

## Shoelace Formula

The **shoelace formula**, also known as the **shoelace algorithm**, **Gauss's area formula**, and the **surveyor's formula**, is all that's required to calculate the area of a polygon.

The area of a polygon, given the coordinates of its vertices, is given by the formula

$A = \frac{1}{2} \begin{vmatrix} x_1 & x_2 & x_3 & ... & x_n & x_1 \\ y_1 & y_2 & y_3 & ... & y_n & y_1 \end{vmatrix},$

where each pair of coordinates from $(x_1, y_1)$ to $(x_n, y_n)$ represents the coordinates of a vertex of a polygon with $n$ vertices.

Upon expansion of the above formula, we get the formula

$A = \frac{1}{2}\Big\lvert(x_1y_2+x_2y_3+\cdots+x_{n-1}y_n+x_ny_1) - (x_2y_1+x_3y_2+\cdots+y_{n-1}x_n+x_1y_n)\Big\rvert.$

It may look like a very hard formula to recall or write down, but in actuality, it is very simple to memorize when to add and when to subtract the coordinate values. Use the following image as an example:

For all the $\textcolor{#D61F06}{\textsf{red}}$ arrows, multiply the two coordinates connected by the $\textcolor{#D61F06}{\textsf{red}}$ arrows together and then add all other products with the $\textcolor{#D61F06}{\textsf{red}}$ arrow. For the $\textcolor{#3D99F6}{\textsf{blue}}$ arrows, multiply the two coordinates connected by the $\textcolor{#3D99F6}{\textsf{blue}}$ arrows together and then add all other products with the $\textcolor{#3D99F6}{\textsf{blue}}$ arrow. Then subtract the sum of the $\textcolor{#3D99F6}{\textsf{blue}}$ arrows from the sum of the $\textcolor{#D61F06}{\textsf{red}}$ arrows and modulus the value. Finally, halve the modulus value to get the area of a polygon with $n$ sides.

Through this proof, we will demonstrate how the formula is derived from a basic quadrilateral on a Cartesian plane.

Referring to the figure, let $\mathbf{A}$ be the area of the triangle with the vertices of coordinates $(x_1, y_1)$, $(x_2, y_2)$, and $(x_3, y_3)$. Then, draw a quadrilateral such that the vertices touch the sides of the quadrilateral exactly and that its sides are parallel to the $x$- and $y$-axes. Drawing the quadrilateral will form the triangles $\mathbf{C}$, $\mathbf{D}$, and $\mathbf{E}$. Then, let the area of the quadrilateral be $\mathbf{Q}$. Then the equation describing the relationship between the area of $\mathbf{A}$ in terms of $\mathbf{Q}$, $\mathbf{C}$, $\mathbf{D}$, and $\mathbf{E}$ is $\mathbf{A}=\mathbf{Q} - \mathbf{C} - \mathbf{D} - \mathbf{E}.$ Using concepts from the distance formula and the formula for the area of a triangle $A=\frac{1}{2}bh$, we get that $\begin{aligned} \mathbf{R}&=(x_3-x_2)(y_1-y_3)=(x_3y_1+x_2y_3)-(x_3y_3+x_2y_1)\\ -\mathbf{C}&=-\frac{1}{2}(x_3-x_2)(y_2-y_3)=\frac{1}{2}(-x_3y_2-x_2y_3)+\frac{1}{2}(x_3y_3+x_2y_2)\\ -\mathbf{D}&=-\frac{1}{2}(x_3-x_1)(y_1-y_3)=\frac{1}{2}(-x_3y_1-x_1y_3)+\frac{1}{2}(x_3y_3+x_1y_1)\\ -\mathbf{E}&=-\frac{1}{2}(x_1-x_2)(y_1-y_2)=\frac{1}{2}(-x_1y_1-x_2y_2)+\frac{1}{2}(x_1y_2+x_2y_1). \end{aligned}$ Collecting the terms and rearranging, it gives us $\mathbf{A}=\frac{1}{2}\big((x_2y_3-x_3y_2)-(x_1y_3-x_3y_1)+(x_1y_2-x_2y_1)\big),$ which can be rewritten as a determinant $\mathbf{A}=\frac{1}{2}\begin{vmatrix} 1 & 1 & 1 \\ x_1 & x_2 & x_3 \\ y_1 & y_2 & y_3 \end{vmatrix}.$ And if the coordinates are written in a clockwise order, the value of the determinant will be $-\mathbf{A}$.

As area can never be negative, in order to accommodate the possibility of a 'negative' area from the determinant, we have to add an absolute sign to the formula. So, we then get $\mathbf{A}=\frac{1}{2}\Big\lvert x_1y_2+x_2y_3+x_3y_1-(x_2y_1+x_3y_2+x_1y_3)\Big\rvert,$ which (somewhat) matches the formula $A = \frac{1}{2}\Big\lvert(x_1y_2+x_2y_3+\cdots+x_{n-1}y_n+x_ny_1) - (x_2y_1+x_3y_2+\cdots+y_{n-1}x_n+x_1y_n)\Big\rvert$ given above if and only if $n=3$. $_\square$

This next proof is a secondary proof showing that the shoelace formula does not only apply to triangles but can also be applied to other polygons such as quadrilaterals.

The diagram above shows a quadrilateral with the vertices of coordinates $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$, and $(x_4, y_4)$. The quadrilateral is then divided into 2 triangles by a straight line connecting the points $(x_1, y_1)$ and $(x_3, y_3)$ with the areas of $\mathbf{A}$ and $\mathbf{B}$. Using the triangle formula we proved above, we get $\begin{aligned} \mathbf{A}&=\frac{1}{2}(x_1y_2+x_2y_3+x_3y_1-x_2y_1-x_3y_2-x_1y_3)\\ \mathbf{B}&=\frac{1}{2}(x_1y_3+x_3y_4+x_4y_1-x_3y_1-x_4y_3-x_1y_4). \end{aligned}$ As both the areas of the triangles were traced using the coordinates in a counterclockwise direction, both areas are positive and we can get the area of the quadrilateral $\mathbf{A_{quad}}$ by adding the two areas $\mathbf{A}$ and $\mathbf{B}$. As you may have noticed, the terms $x_3y_1$ and $x_1y_3$ are present in both areas $\mathbf{A}$ and $\mathbf{B}$ and conveniently cancel each other out, giving us the formula $\mathbf{A_{quad}}=\frac{1}{2}(x_1y_2+x_2y_3+x_3y_4+x_4y_1-x_2y_1-x_3y_2-x_4y_3-x_1y_4),$ where the absolute sign can also be applied to avoid 'negative' areas as in $\mathbf{A_{quad}}=\frac{1}{2}\Big\lvert(x_1y_2+x_2y_3+x_3y_4+x_4y_1-x_2y_1-x_3y_2-x_4y_3-x_1y_4)\Big\rvert,$ which matches the formula $A = \frac{1}{2}\Big\lvert(x_1y_2+x_2y_3+\cdots+x_{n-1}y_n+x_ny_1) - (x_2y_1+x_3y_2+\cdots+y_{n-1}x_n+x_1y_n)\Big\rvert$ if and only if $n=4$.

Therefore, we have also indirectly proven that any polygon can be calculated using the shoelace formula as any polygon can be divided into multiple smaller triangles with its three vertices having a coordinate assigned to it. $_\square$

Find the area of the $\Delta ABC$ whose vertices are $A=(0, 3)$, $B=(-2, 2)$, and $C=(-5, -3)$.

Using the formula $A = \frac{1}{2} \begin{vmatrix} x_1 & x_2 & x_3 & ... & x_n & x_1 \\ y_1 & y_2 & y_3 & ... & y_n & y_1 \end{vmatrix},$ substitute all the variables in the formula with the known coordinates in the question to get $A=\frac{1}{2} \begin{vmatrix} 0 & -5 & -2 & 0 \\ 3 & -3 & 2 & 3 \end{vmatrix}.$ Using the shoelace algorithm, we get $\begin{aligned} A &=\frac{1}{2} \Big\lvert(0-10-6)-(-15+6+0)\Big\rvert \\ &=\frac{1}{2} \lvert -16+9 \rvert \\ &=\frac{1}{2} \lvert -7 \rvert \\ &=\frac{1}{2}(7) \\ &=3.5. \end{aligned}$ So, the area of the triangle is 3.5. $_\square$

## Problem Solving

**Cite as:**Area of a Polygon.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/area-of-a-polygon/