Diagonal of a Polygon — Definition, Formula & Examples
Diagonal of a Polygon
A line segment connecting non-adjacent vertices of a polygon. Note: An n-gon has
diagonals.

Key Formula
D=2n(n−3)
Where:
- D = Total number of diagonals in the polygon
- n = Number of sides (or equivalently, number of vertices) of the polygon
Worked Example
Problem: How many diagonals does a hexagon (6-sided polygon) have?
Step 1: Identify the number of sides. A hexagon has 6 sides, so n = 6.
n=6
Step 2: Substitute n = 6 into the diagonal formula.
D=26(6−3)
Step 3: Simplify the expression inside the parentheses: 6 − 3 = 3.
D=26×3
Step 4: Multiply and divide to get the final result.
D=218=9
Answer: A hexagon has 9 diagonals.
Another Example
This example works the formula in reverse — given the number of diagonals, you find the number of sides by solving a quadratic equation.
Problem: A polygon has exactly 20 diagonals. How many sides does it have?
Step 1: Set the diagonal formula equal to 20 and solve for n.
2n(n−3)=20
Step 2: Multiply both sides by 2 to clear the fraction.
n(n−3)=40
Step 3: Expand and rearrange into a standard quadratic equation.
n2−3n−40=0
Step 4: Factor the quadratic. You need two numbers that multiply to −40 and add to −3. Those are −8 and 5.
(n−8)(n+5)=0
Step 5: Solve for n. Since n must be a positive integer, discard the negative solution.
n=8(rejecting n=−5)
Answer: The polygon has 8 sides (it is an octagon).
Frequently Asked Questions
Why does a triangle have zero diagonals?
A triangle has 3 vertices, and every vertex is adjacent to both of the other vertices. Since a diagonal must connect non-adjacent vertices, there are no possible diagonals. You can verify this with the formula: D = 3(3 − 3)/2 = 0.
How do you derive the diagonal formula n(n − 3)/2?
From any single vertex of an n-gon, you can draw a line segment to n − 1 other vertices. However, 2 of those are adjacent vertices (connected by a side), so each vertex contributes n − 3 diagonals. With n vertices, that gives n(n − 3) counted segments, but each diagonal has been counted twice (once from each endpoint), so you divide by 2 to get n(n − 3)/2.
What is the difference between a diagonal and a side of a polygon?
A side connects two adjacent (neighboring) vertices, forming part of the polygon's boundary. A diagonal connects two non-adjacent vertices and lies in the interior of a convex polygon. Every n-gon has exactly n sides but n(n − 3)/2 diagonals.
Diagonal of a Polygon vs. Side of a Polygon
| Diagonal of a Polygon | Side of a Polygon | |
|---|---|---|
| Definition | Line segment connecting two non-adjacent vertices | Line segment connecting two adjacent vertices |
| Count in an n-gon | n(n − 3)/2 | n |
| Position | Passes through the interior (in convex polygons) | Forms the boundary of the polygon |
| Exists in a triangle? | No (0 diagonals) | Yes (3 sides) |
Why It Matters
Counting diagonals is a classic problem in combinatorics and geometry courses, often used to introduce quadratic formulas and systematic counting techniques. Diagonals also play a practical role: drawing all diagonals from one vertex of a polygon divides it into triangles, which is the basis of polygon triangulation — a key technique for computing area and used extensively in computer graphics. You will encounter diagonals again when studying interior angle sums, since an n-gon splits into n − 2 triangles using non-crossing diagonals from a single vertex.
Common Mistakes
Mistake: Using n(n − 1)/2 instead of n(n − 3)/2.
Correction: The expression n(n − 1)/2 counts all line segments between n vertices (including the n sides). You must subtract the n sides to get only diagonals: n(n − 1)/2 − n = n(n − 3)/2. Always use (n − 3) in the numerator, not (n − 1).
Mistake: Forgetting to divide by 2 and writing n(n − 3) as the answer.
Correction: Each diagonal has two endpoints, so it gets counted once from each end. You must divide by 2 to avoid double-counting. For example, in a pentagon: 5 × 2 = 10 is wrong; the correct count is 5 × 2 / 2 = 5 diagonals.
Related Terms
- Line Segment — A diagonal is a specific type of line segment
- Non-Adjacent — Diagonals connect non-adjacent vertices
- Vertex — Endpoints of every diagonal
- Polygon — The shape in which diagonals are drawn
- n-gon — General polygon with n sides used in the formula
- Convex Polygon — All diagonals lie inside a convex polygon
- Triangulation — Diagonals divide polygons into triangles
- Combination — Diagonal count uses combinatorial reasoning
