Your Equation

Library / Geometry, coordinates, surveying and trigonometry / GEO-05

Geometry, coordinates, surveying and trigonometry

Number of diagonals in a polygon

Count of diagonals of a convex polygon with n vertices: the pairs of non-adjacent vertices.

Ref
GEO-05
Rev
v1
Field
Geometry, coordinates, surveying and trigonometry
Result
D

A convex polygon with n vertices has n(n − 3)/2 diagonals. From each vertex you can draw n − 3 diagonals (not to itself or its two neighbours), and dividing by 2 stops each diagonal being counted from both ends. A triangle has none and a quadrilateral has two.

Count of diagonals of a convex polygon with n vertices: the pairs of non-adjacent vertices. A triangle has none.

Calculator

Solve for
340
  • Number of sides8
  • Number of diagonals from one vertex, n − 35
  • Total number of lines between vertices, n(n − 1)/228

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Number of diagonals () current value 20
nNumber of verticesKey driver
0740
  • A polygon with 8 vertices has 20 diagonals, out of 28 possible lines between pairs of vertices.
  • The 8 sides account for the remaining 8 lines between vertices, which is why D = n(n − 1)/2 − n.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing ()Local stepChange in result
n Number of vertices3 to 40 0740740+1 +35 %

Sweep of Number of vertices

Number of verticesNumber of diagonals
30
7.62517.63
12.2556.66
16.88117.1
21.5198.9
26.13302.1
30.75426.7
35.38572.6
40740

Sweep one variable

Number of diagonals ()Hover, touch, or use the arrow keys on the chart
0200400600 5152535 Number of vertices now 20

Variables and how each one contributes

D

Number of diagonals

Result ·

What the equation gives you. Everything else feeds it.

n

Number of vertices

· typical 3 to 40

The number of vertices (corners), a whole number from 3. The count grows with the square of n, so it rises much faster than the number of sides. Raising it by 1 (to 9) moves the result by +35 %, from 20 to 27.

Worked example with the values above

  1. Number of vertices: n = 8.
  2. Diagonals from one vertex: n − 3 = 5, so 8 × 5 = 40 counted from both ends.
  3. D = 40 / 2 = 20.

Assumptions and limits

  • A convex polygon, so that every diagonal lies inside it.
  • n is a whole number of at least 3.

Common mistakes

  • Counting each diagonal twice by not dividing by 2.
  • Counting the sides as diagonals, which gives n(n − 1)/2 instead.
  • Using n sides in place of n vertices for a shape with a gap or a re-entrant corner.

Statistics and uncertainty

This is an exact count, so there is no measurement uncertainty. The count grows with the square of n, so a miscount of vertices is magnified.

Where it is used

  • Plate, panel and gasket areas from simple drawings.
  • Checking the size of regular flanges, hex bars and tiles.

Maths you need

  • Area: the flat space inside a shape, in square units
  • Perpendicular: at a right angle to
  • Tangent of an angle: opposite over adjacent

Related formulas

Practise this formula