You can put this solution on YOUR website! I would make that polygon a convex polygon,
like this: so all diagonals will be inside the polygon, and no triangles will overlap.
The answer may be the same for a concave polygon, like this , but it is harder to visualize with concave polygons.
I believe the answer is
A polygon with sides has vertices.
From one of the n vertices, you can draw diagonals to all other vertices except the adjacent ones.
(The lines connecting to the adjacent vertices are sides of the polygon, and we cannot call them diagonals).
To one side of each diagonal is a triangle, and you count of those:
one to that side of the first diagonal,
a second one to that side of the second diagonal, and so on.
You count triangles that way.
There is more triangle to the other side of the last of those diagonals.