Deriving formulas for the polygonal numbers

For the entirety of this article, let \(s\) be the number of sides, for the polygonal number, and \(n\) the number of points per edge.

$$P(s, n) = (s - 2)\dfrac{n(n + 1)}{2} - (s - 3)n$$
$$P(s, n) = (s - 2)\dfrac{n(n - 1)}{2} + n$$

Note that each of these formulas can be derived from the other by elementary algebra.