Find the number of distinct diagonals of a convex octagon.

Consider the octagon ABCDEFGH. A diagonal is a segment drawn from a vertex to another, nonadjacent, vertex. Thus from vertex A there are 5 possible diagonals as the segment drawn from A to B, and A to H are sides of the octagon. Also, you cannot draw a segment from A to A.

Simarly there are 5 diagonals from B, 5 from C, etc... Thus there are 5(8)=40 diagonals. However, we counted AC and CA as diagonals, while they are the same segment. So we need to divide the total number by 2 as every diagonal has been counted twice.

**There are `(5*8)/2=20` distinct diagonals in a convex octagon.**

We can use the thought process used to find the general case -- the number of distinct diagonals in a convex n-gon is `d=(n(n-3))/2` for `n>=3` . A triangle has no diagonals, a quadrilateral has `(4*1)/2=2` diagonals, etc...