You can put this solution on YOUR website! Every two vertices determines a line.
A polygon of n sides has n vertices.
There are nC2=[n(n-1)]/2 lines determined.
But n of the lines are sides of the polygon.
So there are nC2 - n diagonals in an n-sided polygon.
Example:
A pentagon has 5 vertices; it has 5C2 - 5 = [5*4]/2 - 5
=10-5 = 5 diagonals.
Hope this helps.
Cheers,
Stan H.