Thought Toys · Shape & space · Exhibit 128
To find the area of a shape you expect to measure something — a base, a height, a radius, and a different formula for every shape. On a pegboard you don't. Count the pegs sitting inside the band. Count the pegs the band touches. Halve the second number, add it to the first, subtract one. That is the area. Not close to it — it. Drag any corner anywhere and — so long as the band never crosses itself — the two numbers below move together, every time.
A band on a pegboard — drag a corner ● pegs inside ● pegs on the band ● pegs outside
Keyboard: focus the board, then ← → ↑ ↓ to move the ringed corner one peg at a time, and , . (or Tab-free [ ]) to ring a different corner — the same thing dragging does. A move that would make the band cross itself is refused.
—
—
The board is a grid of pegs, one unit apart. The band is a closed loop whose corners are always on pegs. Every peg is one of three things: inside the band (amber), on it (cyan), or outside (grey). The exhibit counts the first two and does one small sum.
Call the inside count I and the on-the-band count B. Then the area of the shape is I + B/2 − 1. Always. The last two boxes under the picture are that sum and the real area, worked out completely separately — the real one by the ordinary coordinate method that knows nothing about pegs. Drag a corner and watch both boxes change to the same new number.
The halving is the part worth pausing on. A peg on the edge is shared: it sits on the boundary between the inside and the outside, so it contributes half a unit rather than a whole one. The −1 is the correction for the loop closing up on itself — a shape has one outline, and one is what you take off. Those two small adjustments are the entire theorem.
Stretch the whole shape makes the point that this is not a coincidence about small numbers. At 2× every length doubles, so the area quadruples — but the pegs on the edge only double, because the edge is a length. The inside fills up much faster than the rim, and the counting rule tracks it exactly the whole way.
Let the edges cross is the honest catch. Pick's theorem asks for a simple loop: one that never crosses itself. Cross the edges and the two boxes come apart immediately — the count still produces a number, and the number is now wrong. That is worth seeing, because nothing in the picture warns you. A shape with a hole punched in it fails in the same way, and by exactly one unit per hole.
A rough answer that is genuinely the reason: the rule is additive. Glue two lattice shapes together along a shared edge and the pegs along that seam stop being boundary and become interior, which is precisely the bookkeeping that makes the two −1s collapse into one. So if the rule is true for triangles that contain no pegs at all, it is true for anything you can cut into them — and every lattice polygon can be cut into them. Each of those smallest triangles has area exactly one half, which is the number the formula gives when I = 0 and B = 3.
The rule, exactly. For a simple polygon whose every vertex is a lattice point,
A = I + B/2 − 1
with I the lattice points strictly inside and B those on the boundary
(Georg Alexander Pick, 1899). The page computes B as the sum of
gcd(|Δx|, |Δy|) over the edges, I by testing every peg in the
bounding box with a ray cast, and the true area by the shoelace determinant — three independent
routes, and the last two never consult the first. Simple is a hypothesis, not a formality: with
a hole the correct statement is I + B/2 + h − 1, and with crossing
edges neither quantity means anything.
Checked before this page was written (improve/verify/128-picks-theorem.js):
I+B/2+1, I+B−1, I+B/2 — each wrong on
599 of 599 test polygons.Also in Shape & space: Cross one line, and its territory closes →