A Polygon's Diagonals Are a Full Mesh Minus the Perimeter
Published 10/20/2026 · 3 min read · Everyday calculators
Daniel Okonkwo — Front-end developer and tech writer at OneKitly
Web performance · File formats
Checked against 2 sources
Join every pair of n corners and you draw n(n−1)/2 lines. Some of those are the sides of the polygon, exactly n of them, so the diagonals number n(n−1)/2 − n, which tidies up to n(n−3)/2: nine for a hexagon, 170 for a twenty-sided figure, 4,850 for one with a hundred sides. The first half of that derivation is the handshake count, and it is the same quantity that sizes a full-mesh network — 20 machines connected to each other directly need 190 links, and 100 need 4,950. A polygon's diagonals are that mesh with the perimeter removed, which is why the two formulas differ only by n.
A hexagon has 9 diagonals, a twenty-sided figure has 170 and a hundred-sided one has 4,850. The same counting gives the link count of a full-mesh network: 190 links for 20 nodes, 4,950 for 100.
Why full-mesh topologies stop at small numbers
The count grows with the square of the node count, so every machine added costs more than the last one did. Going from ten nodes to twenty multiplies the links from 45 to 190, and going to a hundred takes it to 4,950 — a hundredfold rise in links for a tenfold rise in machines. That is why full meshes survive only among a handful of core routers or in a small cluster, and why everything larger routes through hubs, spines or brokers instead. The same arithmetic explains why a meeting of twelve people has sixty-six possible side conversations, and why coordination costs in a team rise faster than headcount.
The other two outputs are simpler than they look
Any polygon of n sides cuts into n−2 triangles by drawing diagonals from a single corner, and since each triangle carries 180 degrees the interior angles sum to (n−2) × 180: 720 for a hexagon, 3,240 for a twenty-sided figure. That result holds for irregular polygons as well as regular ones, and it does not care whether the shape is convex — a dented outline has the same angle sum as a tidy one with the same number of corners. It is the fastest available check on a surveyed outline: add the measured interior angles and see whether they land on the number they must.
| Sides | Diagonals | Full-mesh links | Interior angles |
|---|---|---|---|
| 3 | 0 | 3 | 180° |
| 6 | 9 | 15 | 720° |
| 20 | 170 | 190 | 3,240° |
| 100 | 4,850 | 4,950 | 17,640° |
Worked with our own calculator
Polygon diagonals calculator
Given
- Number of sides (n)
- 3
Result
- Number of diagonals
- 0
- Triangles (n−2)
- 1
- Sum of interior angles
- 180 °
These figures are produced by the calculator below, not typed in by hand — they are recomputed whenever the tool changes.
Run it on your own figures →Frequently asked questions
- Do the diagonals all cross inside?
- Only in a convex polygon. Put a dent in the outline and some diagonals leave the shape entirely, passing through the notch and back in — they are still diagonals by the definition used here, which counts pairs of non-adjacent corners regardless of where the line goes. The count therefore stays n(n−3)/2 whatever the shape, while the number of crossings inside does not: in a convex polygon with no three diagonals meeting at a point, the interior crossings are the number of ways to choose four corners, since each set of four gives exactly one crossing.
- Why does a triangle have none?
- Because every corner is adjacent to every other one, so there is no non-adjacent pair left to join. The formula agrees without special handling: 3 × 0 ÷ 2 is zero, and a quadrilateral's 4 × 1 ÷ 2 gives the two diagonals anyone can draw. That the expression handles the smallest cases correctly is a small but real reassurance about it — a counting formula that needed an exception at n = 3 would be a sign the derivation had gone wrong somewhere, rather than a quirk of triangles.
Articles you may find interesting
All guides →Related tools
Sources
Spotted a mistake in this article?