# Closed form of a generating function $\sum _{n=1}^\infty x^{n^2}$

I am looking for a closed form of the expression

$$F(x) = \sum _{n=1}^\infty x^{n^2}$$

The question arose when I attempted to prove Lagrange's four square theorem via generating functions. It doesn't seem the closed form exists, but I couldnt find any confirmation in the literature.

• Look up Jacobi theta function – Leg Dec 24 '15 at 15:46
• That's very helpful, thank you very much :) – Milen Ivanov Dec 24 '15 at 15:52
• – Martin Sleziak Jul 3 '18 at 7:48

Using parity to extend the summation to all integers, one can recognize in the resulting expression Jacobi theta function $\vartheta_3(z,q)=\sum_{n\in\mathbb Z}q^{n^2} e^{2ni z}$. More precisely, we have $$\sum_{n=1}^{\infty}x^{n^2}=\frac{\vartheta_3(0,x)-1}{2}.$$