Math · 93 calculators
Number Of Diagonals In A Polygon Calculator
Counting diagonals is a compact lesson in avoiding double counting. From any vertex of a convex polygon you can join every other vertex except the vertex itself and its two neighbours, and dividing by two then gives the total. The answer depends only on the number of sides and grows quadratically, so doubling the sides produces far more than twice as many diagonals.
Last updated
Total diagonals
20
- Diagonals from one vertex
- 5
- Diagonals at twice the sides
- 104
- Triangles from one vertex
- 6
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
The formula this calculator uses
D = n(n - 3) / 2
- n
- Number of sides, equal to the number of vertices
- n - 3
- Diagonals that can be drawn from a single vertex
- D
- Total number of distinct diagonals in the polygon
How to check the result by hand
- 1
Count the vertices
Write down n, the number of sides, which equals the number of vertices for any simple polygon. Confusing sides with corners is rare here because they match exactly, but counting the vertices of a drawn shape by eye is a common source of an off-by-one error.
- 2
Subtract three for the per-vertex count
From one corner you cannot draw a diagonal to itself or to either neighbour, so the available destinations number n - 3. For an octagon that is 8 - 3 = 5. This is the only subtraction in the method, and it is easy to check by listing the reachable corners on a sketch.
- 3
Multiply by the number of vertices
Compute n x (n - 3), which totals the diagonals as seen from every corner. For the octagon this is 8 x 5 = 40. The product is deliberately too large, because every segment has been encountered at each of its two ends.
- 4
Divide by two to remove the double count
Halve the product to obtain D = n(n - 3) / 2. The octagon gives 40 / 2 = 20. The result is always a whole number: if n is even then n is even, and if n is odd then n - 3 is even.
- 5
Check against a known case and note the growth
Compare with the anchors: 0 for a triangle, 2 for a quadrilateral, 5 for a pentagon and 9 for a hexagon. Then remember the scaling — going from 8 sides to 16 raises the count from 20 to 104, a factor of 5.2, because the formula is quadratic rather than proportional.
Common Questions
How does the Number Of Diagonals In A Polygon Calculator work?
From each of the n vertices you can draw n - 3 diagonals, because a vertex cannot join to itself or to either adjacent neighbour. Multiplying n by n - 3 counts every diagonal from both ends, so divide by two. An octagon has 8 x 5 / 2 = 20 diagonals, while doubling the sides to sixteen gives 104.
What do I need to enter in the Number Of Diagonals In A Polygon Calculator?
It takes 1 inputs: Number of sides. Fields that expect a unit say so next to the label.
Where does Total diagonals come from?
It comes from D = n(n - 3) / 2 — each vertex offers n - 3 diagonals, and multiplying by n counts each one twice, so the product is halved.
What is the most common mistake with the Number Of Diagonals In A Polygon Calculator?
Forgetting to divide by two. Reporting n(n - 3) directly doubles the answer: 40 instead of 20 for an octagon. Each diagonal joins two vertices and is therefore encountered twice when you walk around the corners.
For worked examples, common mistakes and the limits of this formula, read the full How To Calculate The Number Of Diagonals In A Polygon page.
