If the coordinates of the vertices of a polygon are known, its area can be computed by simply walking once around them1. We do it for the pentagon with vertices A(0,0), B(4,0), C(5,3), D(2,5) and E(−1,2).
The shoelace formula
List the vertices counterclockwise as (x1,y1),…,(xn,yn), form xiyi+1−xi+1yi for each adjacent pair, and add. After the last vertex one returns to the first.
S=21i=1∑n(xiyi+1−xi+1yi)
Working through it
Side
xiyi+1−xi+1yi
Value
AB
0⋅0−4⋅0
0
BC
4⋅3−5⋅0
12
CD
5⋅5−2⋅3
19
DE
2⋅2−(−1)⋅5
9
EA
(−1)⋅0−0⋅2
0
The total is 40, so the area is 21×40=20.
What the formula means
The meaning can be traced back to the area of a triangle. The triangle formed by the origin and two points (p,q) and (r,s) has area 21∣ps−qr∣. Viewing each side from the origin cuts the figure into triangles; adding them with signs cancels whatever sticks out beyond the polygon as a negative triangle, and the area of the polygon itself is what remains.
Checking by cutting along diagonals
Triangle
Area
△ABC
6
△ACD
219
△ADE
29
Total
20
The answers agree.
Cautions in use
The vertices must be listed in the order they are traced around the figure; reordering them gives a different shape
No side may cross another, since a self-intersecting outline makes the areas cancel
The polygon need not be convex
What the sign means
The sign of the value before the absolute value records the orientation: positive counterclockwise and negative clockwise. Computers also use that sign to decide which side of a polygon faces outward.
The five lines on the graph are the five sides, and the large dots are the five vertices.