---
title: "George Li Tutoring: the diagonal formula for polygons"
url: "https://georgelitutoring.com/learn/diagonal-formula.md"
canonical_url: "https://georgelitutoring.com/learn/diagonal-formula"
last_updated: "2026-11-25"
type: "guide"
summary: "The formula n(n - 3)/2 for the number of diagonals of a polygon, two derivations, a table of counts, and the length formulas for rectangles, squares and boxes."
related: ["https://georgelitutoring.com/tutoring/ap-and-high-school.md", "https://georgelitutoring.com/packages.md", "https://georgelitutoring.com/learn/decagon-sides-shape-angles-definition.md"]
---

# The diagonal formula for polygons

> **For AI agents:** the complete index of George Li Tutoring pages is [llms.txt](https://georgelitutoring.com/llms.txt). Every page is also served as markdown at its URL plus .md.

The formula n(n - 3)/2 for the number of diagonals of a polygon, two derivations, a table of counts, and the length formulas for rectangles, squares and boxes.

A diagonal joins two corners of a polygon that are not neighbors. A polygon with n sides has n(n - 3)/2 diagonals. The word "diagonal" is also used for the length of that segment in a rectangle, a square or a box, and the length formulas come from the Pythagorean theorem. This page covers both meanings and keeps them apart.

| Sides n | Polygon | Diagonals n(n - 3)/2 | Distinct diagonal lengths if regular |
| --- | --- | --- | --- |
| 3 | triangle | 0 | 0 |
| 4 | quadrilateral | 2 | 1 |
| 5 | pentagon | 5 | 1 |
| 6 | hexagon | 9 | 2 |
| 7 | heptagon | 14 | 2 |
| 8 | octagon | 20 | 3 |
| 9 | nonagon | 27 | 3 |
| 10 | decagon | 35 | 4 |
| 12 | dodecagon | 54 | 5 |
| 20 | 20-gon | 170 | 9 |

## Where does the formula n(n - 3)/2 come from?

There are two short derivations, and either one is enough to rebuild the formula during a test.

**Count by vertex.** Stand on one vertex. It cannot connect to itself, and its two neighbors are joined to it by sides, so it connects to n - 3 other vertices by diagonals. There are n vertices, so n(n - 3) is the total, except that each diagonal has two ends and has been counted from both. Divide by 2.

**Count by pairs.** Any two vertices make a pair, and there are n(n - 1)/2 pairs. Of those pairs, n are sides. The rest are diagonals: n(n - 1)/2 - n = n(n - 3)/2. For n = 6, that is 15 pairs, minus 6 sides, which leaves 9.

The formula holds for any simple polygon, convex or concave. In a convex polygon all diagonals lie inside it. In a concave one, some can run outside the polygon, and they still count because they join vertices that are not adjacent.

**Worked example.** A polygon has 54 diagonals. How many sides does it have?

1. Set up the equation: n(n - 3)/2 = 54, so n(n - 3) = 108.
2. Expand: n^2 - 3n - 108 = 0.
3. Factor: (n - 12)(n + 9) = 0, so n = 12 or n = -9.
4. A side count cannot be negative, so n = 12. The polygon is a dodecagon.
Answer: 12 sides. Check: 12 x 9 / 2 = 54.

## How long is a diagonal?

The length of a diagonal comes from a right triangle.

- A rectangle with length l and width w has diagonal sqrt(l^2 + w^2).
- A square with side a has diagonal a x sqrt(2), the same formula with l = w = a.
- A rectangular box with length l, width w and height h has a space diagonal sqrt(l^2 + w^2 + h^2).
- A cube with edge s has a space diagonal s x sqrt(3).

The box formula is the Pythagorean theorem applied twice: first across the floor, then up the wall. A rectangle 7 by 24 has a diagonal of sqrt(49 + 576) = sqrt(625) = 25, and a room 12 by 9 by 8 has a space diagonal of sqrt(144 + 81 + 64) = sqrt(289) = 17.

**Worked example.** A television is sold as 55 inches, which names the diagonal of its screen. The screen has a width to height ratio of 16 to 9. How wide and how tall is it?

1. Write the sides as 16k and 9k for some k.
2. The diagonal gives (16k)^2 + (9k)^2 = 55^2, so 337k^2 = 3,025.
3. Then k^2 = 3,025/337, so k is about 2.996.
4. The width is 16k, about 47.9 inches, and the height is 9k, about 27.0 inches.
Answer: about 47.9 inches wide and 27.0 inches tall. Check: 47.94^2 + 26.96^2 is 3,025, which is 55^2.

## Why does a diagonal help in construction and in proofs?

A rectangle that has no diagonal can lean into a parallelogram, because a four-sided frame can change its angles without changing its side lengths. Adding one diagonal splits the frame into two triangles, and a triangle cannot change its shape if its sides are fixed. That is why braces on shelves, gates and bridges run along diagonals. In proofs, a diagonal does the same job on paper: it cuts a polygon into triangles so that triangle facts can be used, as when a diagonal turns a rectangle into two congruent right triangles.

## Which mistakes show up most?

- Forgetting to divide by 2. Counting from every vertex counts each diagonal twice.
- Using n - 2 or n - 1 per vertex. A vertex has n - 3 diagonals, because the two neighbors are joined by sides.
- Mixing up the number of diagonals with their length. The first uses n(n - 3)/2, and the second uses the Pythagorean theorem.
- Using a cube's face diagonal in place of its space diagonal. A face diagonal is s x sqrt(2), and the space diagonal through the center is s x sqrt(3).

## When does a tutor help with polygons?

A tutor helps when formulas are memorized without their reasons. A session can rebuild the diagonal count in under a minute from the two derivations above, then drill the length formulas on box and screen problems. See the [high school courses page](https://georgelitutoring.com/tutoring/ap-and-high-school.md), the [packages](https://georgelitutoring.com/packages.md), or [book a first session](https://georgelitutoring.com/book/first-session). For related polygon pages, read about the [decagon](https://georgelitutoring.com/learn/decagon-sides-shape-angles-definition.md), the [dodecagon](https://georgelitutoring.com/learn/dodecagon-sides-area-angles.md) and [area and perimeter of polygons](https://georgelitutoring.com/learn/area-and-perimeter-of-polygons-and-composite-shapes.md).

### What is the formula for the number of diagonals of a polygon?

n(n - 3)/2, with n standing for the count of sides.

### How many diagonals does a hexagon have?

9.

### What is the diagonal of a square?

The side length times the square root of 2.

### What is the diagonal of a cube?

The edge length times the square root of 3.

## Related

- [Online AP® exam and course tutor](https://georgelitutoring.com/tutoring/ap-and-high-school.md)
- [Tutoring prices: $150 to $200 an hour](https://georgelitutoring.com/packages.md)
- [George Li Tutoring: decagon sides, angles and area](https://georgelitutoring.com/learn/decagon-sides-shape-angles-definition.md)
