Sub topic 9
Areas of Triangles and Polygons from Coordinates
This chapter assumes you can compute distances between points, find slopes, and test for collinearity (earlier chapters). You also need basic arithmetic with signed numbers and absolute values. By the end you should be able to find the area of any triangle or polygon from its vertices, use the area to test collinearity, and pick a faster method when the figure has special structure.
Why coordinates give areas directly
If you know the side lengths of a triangle, you can use Heron's formula. If you know a base and a height, you can use half of base times height. With coordinates, you often know neither. The vertices are given, and the sides are slanted, so the height is awkward to find.
The shoelace formula skips both steps. It takes the vertex coordinates and produces the area using only multiplication, subtraction, and one absolute value. It is exact, it works for any simple polygon, and it avoids square roots.
The triangle formula
For a triangle with vertices A(x1, y1), B(x2, y2), C(x3, y3):
Area = (1/2) |x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2)|
Here is where it comes from. Drop perpendiculars from A, B, and C to the x-axis. This gives three trapezoids. The area of the triangle is the sum of two of them minus the third, and that algebra simplifies to the expression above. The absolute value is needed because the signed result is positive or negative depending on the direction in which you list the vertices.
Worked example
Find the area of the triangle with vertices (1, 2), (5, 3), (3, 8).
- Substitute: 1(3 − 8) + 5(8 − 2) + 3(2 − 3).
- Evaluate: −5 + 30 − 3 = 22.
- Area = 22 / 2 = 11 square units.
The shoelace formula for polygons
For a polygon with n vertices listed in order around its boundary, (x1, y1), (x2, y2), ..., (xn, yn):
Area = (1/2) |Σ (xi · yi+1 − xi+1 · yi)|
The last vertex wraps around to the first, so xn+1 = x1 and yn+1 = y1.
The name comes from the way you write it by hand. List the points in a column, repeat the first point at the bottom, then multiply along the diagonals like the criss-cross of a shoelace.
Worked example with four vertices
Find the area of the quadrilateral with vertices (0, 0), (4, 0), (5, 3), (1, 4), listed counterclockwise.
| Step | xi · yi+1 | xi+1 · yi |
|---|---|---|
| (0,0) to (4,0) | 0·0 = 0 | 4·0 = 0 |
| (4,0) to (5,3) | 4·3 = 12 | 5·0 = 0 |
| (5,3) to (1,4) | 5·4 = 20 | 1·3 = 3 |
| (1,4) to (0,0) | 1·0 = 0 | 0·4 = 0 |
| Total | 32 | 3 |
Difference: 32 − 3 = 29. Area = 29 / 2 = 14.5 square units.
The same calculation in code
The function below follows the formula directly. It is useful for checking hand calculations.
def polygon_area(points):
# shoelace formula; points are listed in order around the polygon
total = 0
for i in range(len(points)):
x1, y1 = points[i]
x2, y2 = points[(i + 1) % len(points)]
total += x1 * y2 - x2 * y1
return abs(total) / 2
print(polygon_area([(0, 0), (4, 0), (0, 3)]))
print(polygon_area([(0, 0), (4, 0), (5, 3), (1, 4)]))The first call prints 6.0, the right triangle with legs 4 and 3. The second prints 14.5, matching the table.
Order of vertices matters
The vertices must be listed in the order you meet them walking around the boundary, either clockwise or counterclockwise. Both directions give the same area after the absolute value.
If you list them out of order, the formula still returns a number, but it describes a self-crossing shape. Take the square (0,0), (2,0), (2,2), (0,2). Listed as (0,0), (2,0), (0,2), (2,2), the path crosses itself in a bow-tie. The signed contributions of the two loops cancel, and the formula returns 0.
Collinearity as zero area
Three points are collinear exactly when the triangle they form has zero area. So the test is:
x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2) = 0
This is often faster than comparing slopes, because it avoids fractions and handles vertical lines without special cases.
Worked example: finding an unknown
For what value of k are (1, 2), (3, k), (5, 6) collinear?
- Set the expression to zero: 1(k − 6) + 3(6 − 2) + 5(2 − k) = 0.
- Expand: k − 6 + 12 + 10 − 5k = 0.
- Simplify: 16 − 4k = 0, so k = 4.
Check by slope. From (1, 2) to (5, 6) the slope is 1. From (1, 2) to (3, 4) the slope is also 1. Correct.
The code version reports 0 for collinear points:
def triangle_area(a, b, c):
return abs(a[0] * (b[1] - c[1])
+ b[0] * (c[1] - a[1])
+ c[0] * (a[1] - b[1])) / 2
print(triangle_area((1, 2), (3, 4), (5, 6)))
print(triangle_area((1, 2), (5, 3), (3, 8)))The output is 0.0 and 11.0.
Shortcuts when the shoelace is too slow
The shoelace formula always works, but CAT questions reward speed. Check for structure first.
One vertex at the origin
If one vertex is (0, 0), the triangle formula collapses. For vertices (0, 0), (x2, y2), (x3, y3):
Area = (1/2) |x2 · y3 − x3 · y2|
Translating the figure so a vertex sits at the origin is legal, because shifting every point by the same amount does not change areas. Subtract one vertex from the other two, then use this short form.
For example, take (3, 4), (7, 6), (5, 10). Subtract (3, 4) from each to get (0, 0), (4, 2), (2, 6). Area = (1/2)|4·6 − 2·2| = (1/2)(20) = 10.
A side parallel to an axis
If two vertices share a y-coordinate, that side is horizontal. Use it as the base. The base length is the difference of the x-values, and the height is the vertical distance from the third vertex to that line.
For (1, 2), (7, 2), (4, 9): base = 6, height = 7, area = (1/2)(6)(7) = 21.
Rectangle enclosure
For a triangle with no axis-parallel side, enclose it in the smallest axis-aligned rectangle. Subtract the corner right triangles from the rectangle.
For (0, 0), (6, 2), (3, 5), the bounding rectangle is 6 by 5 = 30. The leftover pieces are:
- Corner triangle under the side from (0,0) to (6,2): (1/2)(6)(2) = 6.
- Corner triangle on the right between (6,2) and (3,5): (1/2)(3)(3) = 4.5.
- Corner triangle on the left between (0,0) and (3,5): (1/2)(3)(5) = 7.5.
Area = 30 − 6 − 4.5 − 7.5 = 12. Check with the origin shortcut: (1/2)|6·5 − 3·2| = (1/2)(24) = 12.
Splitting a polygon
For a polygon with a clear shape, such as a trapezoid or a kite, split it into triangles and rectangles. For a general polygon, pick one vertex and draw diagonals to all others, then add the triangle areas. This is correct only for convex polygons. For a non-convex polygon, the shoelace formula is safer because it needs no choice of diagonals.
Common errors
| Error | Result | Fix |
|---|---|---|
| Forgetting the factor 1/2 | Answer is double | Divide by 2 at the end, once |
| Dropping the absolute value | Negative area | Take the absolute value of the whole sum, not of each term |
| Not closing the polygon | Missing last term | Always add the term from the last vertex back to the first |
| Vertices out of order | Wrong or zero area | Sketch and list around the boundary |
| Sign slip in (y2 − y3) | Wrong value | Write the three differences before multiplying |
| Taking the absolute value of each term | Overcounted area | Sum signed terms first |
Area as a tool for other problems
Area connects to several other topics in this tutorial.
- Unknown coordinates. If a question gives the area and one unknown coordinate, set the signed expression equal to plus or minus twice the area. This gives two possible values, and both can be valid. For a triangle with vertices (0, 0), (4, 0), (2, k) and area 10, the formula gives (1/2)|4k| = 10, so k = 5 or k = −5.
- Area ratios from section points. If D divides BC in the ratio m:n, triangles ABD and ADC share the same height from A. Their areas are therefore in the ratio m:n.
- Median. A median splits a triangle into two triangles of equal area, because it divides the opposite side in the ratio 1:1.
- Centroid. The three triangles formed by the centroid and each pair of vertices have equal area, each one third of the whole.
- Height from a vertex. Given the area and a side length from the distance formula, the height onto that side is 2 × area / base. This is another route to a point-to-line distance.
Choosing a method in an exam
Time matters, so a quick sketch is worth the ten seconds. It reveals axis-parallel sides, gives the vertex order, and lets you sanity check the answer. An area larger than the bounding rectangle, or negative, signals an error.
Exercises
Exercise
Find the area of the triangle with vertices (2, 1), (6, 3), (4, 7).
Show answer
Using the formula: 2(3 − 7) + 6(7 − 1) + 4(1 − 3) = −8 + 36 − 8 = 20. Area = 20 / 2 = 10 square units.
Exercise
The points (a, 0), (0, 3) and (2, 2) are collinear. Find a.
Show answer
Set the area expression to zero: a(3 − 2) + 0(2 − 0) + 2(0 − 3) = a − 6 = 0, so a = 6. Check: the slope from (0, 3) to (2, 2) is −1/2, and from (6, 0) to (0, 3) it is −1/2. They agree.
Exercise
Find the area of the pentagon with vertices (0, 0), (4, 0), (5, 2), (2, 5), (0, 3), listed in order.
Show answer
Products xi·yi+1: 0·0 = 0, 4·2 = 8, 5·5 = 25, 2·3 = 6, 0·0 = 0, total 39. Products xi+1·yi: 4·0 = 0, 5·0 = 0, 2·2 = 4, 0·5 = 0, 0·3 = 0, total 4. Difference 35, so area = 17.5 square units.
Exercise
A triangle has vertices (0, 0), (6, 0), (3, k) with k > 0, and its area is 12. Find k, then find the area of the triangle formed by the centroid and the two vertices (0, 0) and (6, 0).
Show answer
The base is 6 and the height is k, so (1/2)(6)(k) = 12 and k = 4. The centroid splits the triangle into three equal-area triangles, so the required area is 12 / 3 = 4 square units. Check: the centroid is (3, 4/3), so the height over the base is 4/3, and (1/2)(6)(4/3) = 4.