A regular polygon has some number of sides (n), and its sides and diagonals form a certain number of triangles (t).
For a triangle, n=3 and t=1.
For a square, n=4. There are four triangles congruent to the one shown in orange, and four more like the one shown in light blue, so adding these gives t=8.
For a pentagon, with n=5, there are five of the purple triangles, five of the green triangles, five of the red triangles, and five of the yellow triangles, for a total of t=20.
For a hexagon, there are two of the orange triangles, six of the yellow ones, twelve of the red ones, six of the light blue ones, twelve of the purple ones, twenty-four of the green ones, twelve of the dark blue ones, six of the grey ones, six of the black ones, twelve of the pink ones, and six of the brown ones. That’s 2+6+12+6+12+24+12+6+6+12+6 = t = 104.
Three yields one, four yields eight, five yields 20, and six yields 104. At the moment, I don’t have the patience to count the triangles in a heptagon, but it would clearly be, well, quite a few.
There may or may not be a formula for this; any pattern eludes me, so far. I am reminded of the alkane series in chemistry: one isomer each of methane, ethane, and propane, two of butane, three of pentane, and so on to 75 for decane, and beyond. All efforts to find a formula for the number of isomers, in terms of the number of carbon atoms, have failed (to date). For now, these are both filed under “unsolved problems.”
UPDATE: A friend of mine has shown me that this polygon problem has, in fact, been solved, and he provided this link: http://oeis.org/A006600 — apparently I missed some of the triangles in the pentagon (the red and yellow combined, for example), as well as the hexagon. The correct numbers for those two polygons are 35 and 110, respectively. Aside from this update, I’m not changing the rest, for I need reminders of my own fallibility. This will do nicely.