How this calculation works
Each vertex reaches n−3 nonadjacent vertices. Dividing by two removes the double count from the two endpoints.
n(n−3)/2A worked example
An octagon has 8 × 5 ÷ 2 = 20 diagonals.
Good to know
The same count applies to any simple polygon with n distinct vertices.
Reference: OpenStax Algebra and Trigonometry, Trigonometric Applications (opens in a new tab) ↗
Count nonadjacent vertex pairs exactly once
From each vertex of an n-sided polygon, exclude the vertex itself and its two neighbours. That leaves n − 3 diagonal endpoints. Multiplying by n counts every diagonal twice, once from each end, so the total is n(n − 3)/2.
For an octagon, this gives 8 × 5/2 = 20 diagonals. The SVG highlights the five diagonals from one chosen vertex. Repeating that count at all eight vertices gives forty endpoint counts, which must be divided by two.
Distinguish diagonal counts from intersections and regions
Another derivation starts with all unordered vertex pairs, n(n − 1)/2, and subtracts the n sides. This again leaves n(n − 3)/2. A triangle has zero diagonals, a quadrilateral two and a pentagon five. Adding one vertex increases the total by n − 1 when n denotes the previous vertex count.
The formula counts segments joining nonadjacent vertices. It does not count crossing points or the regions those segments create. For a concave polygon, some counted diagonals can lie partly outside its interior. Equal sides and angles are unnecessary for this combinatorial count. The Regular polygon sides from interior angle calculator requires regularity because it infers n from one angle. Enter a whole number of at least three distinct vertices, and keep the intended polygon boundary fixed when deciding which vertices are adjacent.
A few questions, answered
Does a diameter count as a diagonal?
If it joins nonadjacent vertices, yes. In an even-sided regular polygon, opposite-vertex diameters are included.
Does the size of the polygon matter?
No. Scaling or distorting the polygon preserves the number of nonadjacent vertex pairs.