Geometry & Trigonometry
Intermediate

Number of Diagonals

Count of diagonals in an n-sided polygon.

Formula

D=n(n−3)2D = \frac{n(n-3)}{2}

Live Calculator

Members

Variables

nSides

Example

Hexagon has 9 diagonals

How it works

A polygon with n vertices has a diagonal joining any two non-adjacent vertices. From each vertex, you can connect to n - 3 other vertices by diagonals, because you cannot connect to itself or its two neighbors; this gives n(n - 3) connections if counted from every vertex. But each diagonal is counted twice, once from each end, so dividing by 2 gives D = n(n - 3)/2.

When to use it

Use this formula when you need to find how many diagonals a polygon has without drawing them all. It is common in geometry problems, pattern spotting, and combinatorics questions involving polygons.

Worked example, step by step

Find the number of diagonals in an octagon. Use the formula D = n(n - 3)/2 Substitute n = 8: D = 8(8 - 3)/2 Simplify inside the brackets: D = 8 × 5 / 2 Calculate: D = 40 / 2 Final answer: D = 20 diagonals

Common mistakes to avoid

  • Forgetting to divide by 2 and counting each diagonal twice
  • Using the formula for the number of sides instead of the number of diagonals
  • Including the sides of the polygon as diagonals

Did You Know?

A polygon with n sides has n(n−3)/2 diagonals, so a humble decagon already hides 35 of them.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026