Mathematics · Formula

Diagonals of a polygon

Counts the number of diagonals in a polygon with n sides.

Mathematics librarySymbols definedWorked example
Formula
D = n(n − 3) / 2

Counts the number of diagonals in a polygon with n sides.

What the symbols mean

  • n — the number of sides
  • D — the number of diagonals

What it means

Each of the n vertices connects to n − 3 others (excluding itself and its two neighbours), and each diagonal is counted twice, hence the division by 2.

Worked example

Example

An octagon has 8 × 5 / 2 = 20 diagonals.

Related formulas

These relationships often appear alongside the diagonals of a polygon in the same problems.

Frequently asked questions

What is the diagonals of a polygon formula?

The relationship is D = n(n − 3) / 2. Counts the number of diagonals in a polygon with n sides.

When should I use the diagonals of a polygon formula?

Each of the n vertices connects to n − 3 others (excluding itself and its two neighbours), and each diagonal is counted twice, hence the division by 2.

How do I avoid unit mistakes?

Write each quantity with its unit before substituting, convert to the units the formula expects, and check that the result's unit matches the quantity you are solving for. Angles must be in radians for calculus-based expressions unless the page says degrees.

Sources and standards

The equation form, symbols and expected units on this page are checked against the reference works below.

How these are used: sources and standards.

Reviewed November 2026 · Educational reference. See the disclaimer and methodology.