# Generating function for $r^\binom{n}{2}$

I'm trying to find a closed form of the generating function

$$G(x) = \sum_{n \ge 0} r^\binom{n}{2} x^n$$

for a real number $0 < r < 1$. I found that $G(x) = 1 + xG(rx)$. Any hints where to go next?

Taking into account the answer by @zyx below, let

$$H(x) = \sum_{n\in\mathbb{Z}} r^\binom{n}{2} x = \prod_{m\ge1} (1-r^m)(1+r^{m-1} x)(1+r^m x^{-1}),$$

where the equality of the sum and product comes from the Jacobi triple product. Note that $H(rx) = xH(x^{-1})$.

Also, using $\binom{-n}{2} = \binom{n+1}{2}$, we can obtain $\sum_{n<0} r^\binom{n}{2} x^n = xG(x^{-1})-x-1$.

Now what?

-
I added some tags that go with the Jacobi triple product. –  zyx Mar 17 at 4:14
The last is wrong, $\binom{-n}{2} = (-1)^n \binom{n + 1}{1} = (-1)^n (n + 1)$ –  vonbrand Mar 17 at 12:28
@vonbrand: I don't follow. $\binom{-n}{2} = \frac{-n(-n-1)}{2} = \frac{n(n+1)}{2} = \binom{n+1}{2}$ –  Snowball Mar 17 at 12:48
When a theta function is $\sum_{-\infty}^\infty$, one sometimes sees the term "partial theta function" for the half-version $\sum_0^\infty$. –  GEdgar Mar 17 at 12:54
@Snowball, you're right. Confused with $\binom{-2}{n}$. Hadn't had my coffee :-( –  vonbrand Mar 17 at 13:46
The formula gives $\sum_{n=-\infty}^\infty r^\binom{n}{2} x^n = \prod_{m=1}^\infty (1 - r^m)(1 + r^{m-1} x)(1 + r^m x^{-1})$. Any suggestions on what to do about the part of the summation where $n<0$? (The g.f. I'm looking for sums over $n \ge 0$.) –  Snowball Mar 17 at 8:21