You can put this solution on YOUR website! A polygon has n sides and n vertices.
A diagonal is obtained by joining two vertices.
Total number = nC2 = n*(n-1)/2
But this includes the n sides also.
So the number of diagonals = n*(n-1)/2 -n
=[n*(n-1)-2n]/2
= n*(n-1-2)
= n(n-3)/2