Perimeter and Area
Perimeter is the length around a shape; area is the amount of surface inside it. This lesson collects the formulas in one table, shows how to handle composite shapes, explains why area grows with the square of the scale, and estimates areas the way a computer screen does, by counting pixels.
Units
Perimeter is a length, measured in cm, m or pixels. Area is measured in square units: , , . Converting square units squares the conversion factor: , so .
The formula sheet
| Shape | Perimeter | Area |
|---|---|---|
| square, side | ||
| rectangle | ||
| parallelogram, sides , height on | ||
| triangle, sides , height on | ||
| trapezoid, bases , legs | ||
| rhombus or kite, diagonals | sum of sides | |
| regular -gon, side , apothem | ||
| circle, radius | ||
| sector, angle | ||
| any polygon from coordinates | sum of side lengths | shoelace formula (Polygons) |
Composite shapes
Split a complicated shape into simple pieces, then add (or subtract, for holes). The perimeter only counts the outside edge, so inner joins between pieces are left out.
A running track is a rectangle with a semicircle on each short end:
import math
length, width = 100, 60
r = width / 2
perimeter = 2 * length + 2 * math.pi * r # two straights + two half circles (= one full circle)
area = length * width + math.pi * r**2 # rectangle + one full circle
print(f"perimeter: {perimeter:.2f} m")
print(f"area: {area:.2f} m²")
print(f"area with a 20 m × 10 m pond removed: {area - 20 * 10:.2f} m²")perimeter: 388.50 m
area: 8827.43 m²
area with a 20 m × 10 m pond removed: 8627.43 m²
The two half circles together make one full circle of radius 30, so they contribute to the perimeter and to the area. The 60 m ends of the rectangle are inside the shape and are not part of the perimeter.
Scaling
Enlarge a shape by a factor (every length multiplied by ). Then:
Double the side of a square and you need twice the fence but four times the paint. This is why a 4K screen () has 4 times the pixels of a 1080p screen (): both dimensions doubled. The same rule for similar figures returns in Congruence and Similarity.
Area by counting pixels
A screen cannot draw a perfect circle; it lights up the pixels whose centres fall inside it. Counting those pixels estimates the area, and finer grids get closer to :
import numpy as np
for n in [10, 100, 1000]: # n × n pixels covering the square [−1, 1]²
centres = (np.arange(n) + 0.5) * (2 / n) - 1
X, Y = np.meshgrid(centres, centres)
count = int(np.count_nonzero(X**2 + Y**2 <= 1))
print(f"{n:5} × {n:<5} pixels inside: {count:7} area ≈ {count * (2 / n)**2:.5f}")
print("exact π =", round(np.pi, 5)) 10 × 10 pixels inside: 80 area ≈ 3.20000
100 × 100 pixels inside: 7860 area ≈ 3.14400
1000 × 1000 pixels inside: 785456 area ≈ 3.14182
exact π = 3.14159
Each pixel has area . This idea, cutting a region into tiny pieces and adding them up, is exactly how the integral is defined in A First Look at the Integral.
Pick's theorem
For a polygon whose corners all sit on whole-number grid points, there is a surprising shortcut. If is the number of grid points strictly inside and the number on the boundary:
The number of grid points on an edge from to , not counting its starting point, is :
from math import gcd
def shoelace(p):
return abs(sum(p[i][0] * p[(i + 1) % len(p)][1] - p[(i + 1) % len(p)][0] * p[i][1] for i in range(len(p)))) / 2
def boundary_points(p):
return sum(gcd(abs(p[(i + 1) % len(p)][0] - p[i][0]), abs(p[(i + 1) % len(p)][1] - p[i][1])) for i in range(len(p)))
L_shape = [(0, 0), (5, 0), (5, 2), (2, 2), (2, 4), (0, 4)]
A, B = shoelace(L_shape), boundary_points(L_shape)
print("area:", A, " boundary points:", B, " interior points:", int(A - B / 2 + 1))area: 14.0 boundary points: 18 interior points: 6
You can count the six interior points by hand: .
In software
- Rendering cost scales with area: doubling a window's width and height means 4× the pixels to shade.
- Memory: a texture of pixels at 4 bytes each takes bytes, so a 2× larger texture needs 4× the memory.
- Layout engines compute element areas and perimeters (borders) all the time; map software measures regions with shoelace.
Exercises
Exercise 1: A rectangle
Find the perimeter and area of a room.
Answer
Perimeter 23 m, area .
Solution
Exercise 2: A plate with a hole
A metal plate has a circular hole of radius 2 cm. What area of metal is left?
Answer
Solution
Exercise 3: Map scale
On a map, a park covers . What is its real area in ?
Answer
Solution
Exercise 4: Pick on a triangle
The triangle , , has area 12. Use Pick's theorem to find how many grid points lie strictly inside.
Answer
7
Solution
A brute-force count agrees: interior points satisfy , and .
print(sum(1 for x in range(1, 4) for y in range(1, 6) if 3 * x + 2 * y < 12))7
Exercise 5: Same fence, more field
With 40 m of fence, which encloses more area: a square or a circle? Compute both.
Answer
The circle: about against .
Solution
Of all shapes with a given perimeter, the circle encloses the most area.
import math
r = 40 / (2 * math.pi)
print(10 * 10, round(math.pi * r * r, 2))100 127.32
Test yourself
A photo is enlarged so every length is 3 times as long. How does its area change?
- 3 times as large
- 6 times as large
- 27 times as large
- 9 times as large
How many are in ?
- 100
- 10,000
- 1,000
- 1,000,000
A lattice polygon has 10 interior grid points and 8 boundary points. What is its area by Pick's theorem?
- 13
- 14
- 18
- 17