TITLE: closed form for $d(4)=2$, $d(n+1)=d(n)+n-1$?
QUESTION [6 upvotes]: I am helping a friend in his last year of high school with his math class. They are studying recurrences and proof by inference. One of the exercises was simply "How many diagonals does a regular $n$-polygon have?".
We quickly found a direct answer to that question: $d(n) = \frac{(n-3)n}2$, but since they are studying recurrences, we didn't stop, and found the recurrence $d(n+1)=d(n)+n-1$. We proceeded to prove by induction that the closed form we initially found is indeed a solution for the recurrence.
But then he asked me a question I couldn't answer: we found the closed form because the question gives us an obvious mapping to an easy to solve geometry problem, but is there a way to find a closed form using the recurrence only?

REPLY [3 votes]: As has been pointed out, $d(n+1)-d(n)=n-1$, or equivalently, $d(n)-d(n-1)=n-2$. The inverse of the finite difference operator is summation, just like the inverse of the derivative is integration. To be precise:
$$
\begin{align}
d(n)&=d(4)+\sum_{k=5}^n\;(d(k)-d(k-1))\\
&=2+\sum_{k=5}^n\;(k-2)\tag{1}
\end{align}
$$
There are many approaches to computing the summation in $(1)$. One of the simplest, commonly attributed to Gauss as a child, is:
$$
\begin{array}{lc@{+}c@{+}c@{+}c@{+}c}
\text{sum forward}&3&4&5&\dots&(n-2)\\
\text{sum backward}&(n-2)&(n-3)&(n-4)&\dots&3\\
\text{sum of sums}&(n+1)&(n+1)&(n+1)&\dots&(n+1)
\end{array}
$$
there are $n-4$ colums, so twice the sum is $(n-4)(n+1)$. Therefore,
$$
\begin{align}
d(n)&=2+\frac{(n-4)(n+1)}{2}\\
&=\frac{n^2-3n}{2}
\end{align}
$$