# Generating Functions To Deal With

I've been working on producing a closed-form generating function for the coefficients $a_n = \binom{n}{2}.$ I was wondering what might be a good procedure to start on this. I get that $$\sum_{n=0}^{\infty} x^n = x^0 + x^1 + x^2 + ... = \frac{1}{1-x}$$ by the convergence of geometric series. However, I'm wondering what might be the proper steps to get LHS to look like $\sum_{n=0}^{\infty} \binom{n}{2}x^n.$ Unfortunately, I have a general lack of familiarity with discrete math, so any help would be greatly appreciated.

Differentiate term-by-term twice: \begin{aligned} \frac{d}{dx} \sum_{n=0}^\infty x^n &= \sum_{n=1}^\infty n x^{n-1} \\ \frac{d^2}{dx^2} \sum_{n=0}^\infty x^n &= \sum_{n=2}^\infty n(n-1) x^{n-2}. \end{aligned} Next, since $a_n = \binom{n}{2} = \frac{n(n-1)}{2}$ and $a_0 = a_1 = 0$, we have \begin{aligned} \sum_{n=0}^\infty a_n x^n &= a_0 + a_1 x + \sum_{n=2}^\infty \frac{n (n - 1)}{2} x^n \\ &= \frac{x^2}{2} \sum_{n=2}^\infty n (n-1) x^{n-2} \\ &= \frac{x^2}{2} \frac{d^2}{dx^2} \sum_{n=0}^\infty x^n \\ &= \frac{x^2}{2} \frac{d^2}{dx^2} \frac{1}{1-x} \\ &= -\frac{x^2}{\left(1 - x\right)^3}. \end{aligned}
You know that $\dbinom{n}{2} = \dfrac{n(n-1)}{2}$.
Start with the geometric series formula: $$\displaystyle\sum_{n = 0}^{\infty}x^n = \dfrac{1}{1-x}.$$
Next, differentiate both sides with respect to $x$: $$\displaystyle\sum_{n = 1}^{\infty}nx^{n-1} = \dfrac{1}{(1-x)^2}.$$
Note that the $n = 0$ term disapears since $x^0 = 1$ is a constant. Now, you got the $n$ factor, but you still need the $n-1$ factor. So differentiate again to get: $$\displaystyle\sum_{n = 2}^{\infty}n(n-1)x^{n-2} = \dfrac{1}{(1-x)^3}.$$
This is almost what you need. Can you figure out how to manipulate both sides to get $$\displaystyle\sum_{n = 0}^{\infty}\dfrac{n(n-1)}{2}x^n = ?$$