Polygon Diagonal Count Calculator ā How Many Diagonals Does a Polygon Have?
A diagonal of a polygon is a line segment that connects two non-adjacent vertices. Unlike sides, which connect neighboring vertices, diagonals cut through the interior of the shape. Counting diagonals is a classic combinatorics problem with a clean, closed-form solution that applies to any convex polygon.
The Diagonal Count Formula
For a polygon with n sides (and therefore n vertices), the total number of diagonals is:
D(n) = n Ć (n ā 3) / 2
The formula is derived from combinatorics. There are C(n, 2) = n(n ā 1) / 2 ways to choose any two vertices and draw a line segment between them. Of these, exactly n segments are sides of the polygon (connecting adjacent vertices). Subtracting the sides gives:
D(n) = n(n ā 1)/2 ā n = n(n ā 3)/2
Results for Common Polygons
Applying the formula to the most commonly encountered shapes produces a rapidly growing sequence:
- Triangle (n = 3): D = 3 Ć 0 / 2 = 0 diagonals
- Quadrilateral (n = 4): D = 4 Ć 1 / 2 = 2 diagonals
- Pentagon (n = 5): D = 5 Ć 2 / 2 = 5 diagonals
- Hexagon (n = 6): D = 6 Ć 3 / 2 = 9 diagonals
- Octagon (n = 8): D = 8 Ć 5 / 2 = 20 diagonals
- Decagon (n = 10): D = 10 Ć 7 / 2 = 35 diagonals
- Dodecagon (n = 12): D = 12 Ć 9 / 2 = 54 diagonals
Notice that diagonals grow roughly as n² / 2 ā adding one more side always increases the diagonal count by n ā 2. This quadratic growth means a 20-sided polygon has 170 diagonals and a 100-sided polygon has 4,850.
Why Does a Triangle Have Zero Diagonals?
In a triangle, every vertex is adjacent to both of the other vertices. There are no non-adjacent pairs, so there are no diagonals. Plugging n = 3 into the formula gives 3 Ć (3 ā 3) / 2 = 0, confirming this geometrically obvious result.
Practical Applications
Structural Engineering
Engineers use cross-bracing in trusses, bridges, and building frames to add rigidity. Each brace corresponds to a diagonal of the polygon formed by the structural nodes. Knowing how many diagonals a frame has helps estimate material requirements for cross-bracing plans.
Network Design
In a fully-connected network (where every node communicates directly with every other node), the number of links equals C(n, 2) = n(n ā 1)/2. If you arrange the nodes as polygon vertices, the diagonals plus the n sides give you the total link count. This is useful in mesh networking, social graph analysis, and telecommunications topology design.
Combinatorics and Discrete Mathematics
The diagonal count appears in graph theory as the number of edges in a complete graph Kn minus the n edges of the cycle Cn. It also underlies problems involving polygon triangulation, where a convex n-gon can be divided into exactly n ā 2 triangles using n ā 3 non-crossing diagonals.
Puzzle and Game Design
Puzzles that involve connecting dots, logic grids, or polygonal paths often rely on counting diagonals. Game boards shaped as regular polygons use diagonal counts to determine movement options, line-of-sight rules, or the number of possible straight-line paths.
Regular vs. Irregular Polygons
The formula D = n(n ā 3)/2 depends only on the number of vertices, not on the specific shape of the polygon. Whether you have a perfectly regular hexagon or a wildly irregular one with six sides of different lengths, the diagonal count is the same: nine. The only assumption is that no three vertices are collinear (which would make a diagonal coincide with a side or degenerate to a point).
Using This Calculator
Enter any integer from 3 to 1,000 in the input field, or tap one of the preset buttons for common shapes. The calculator instantly shows:
- The total diagonal count with a step-by-step arithmetic breakdown
- An interactive SVG diagram of the polygon with all diagonals drawn
- A comparison between n sides and n + 1 sides to illustrate how quickly the count grows
- A scrollable sequence table from the triangle up to your entered n (capped at 50 rows)
Use the Copy Result button to copy the diagonal count as a plain integer, or Export CSV to download the full sequence table for use in spreadsheets or reports.