The number of lines formed by joining the n vertices of a polygon = Number of selections of 2 points from the given n points
= nC2 = n(n - 1)/2
Out of nC2 lines, n lines are the sides of the polygon. Hence Number of diagonals = nC2 - n
= n(n - 1)/2 - n = n(n - 3)/2