How to prove $\lim \limits_{x \to 1^-} \sum\limits_{n=0}^\infty (-1)^nx^{n²} = \frac{1}{2} \ $?

EDITED. Here is yet another answer based on my recent answer. Indeed, if $P$ is a non-constant polynomial with coefficients in $\mathbb{R}$ such that $P(n) \to +\infty$ as $n \to +\infty$, one immediately deduces from the result in the link that

$$ \lim_{x \uparrow 1^-} \sum_{n=0}^{\infty} (-1)^n x^{P(n)} = \lim_{s \to 0^+} \sum_{n=0}^{\infty} (-1)^n e^{-P(n)s} = \frac{1}{2}, $$

which entails OP's question as a special case with $P(n) = n^2$.


Here is an elementary derivation. First, let $g : (0,\infty) \times (0, 1) \to \mathbb{R}$ by

$$ g(a,x) = \frac{1 - x^{a}}{1 - x^{2a+2}}. $$

We make the following observations on $g$.

Observation. $g$ is increasing in $a$ and non-increasing in $x$.

Its proof is more of less calculus computations, so we leave it to the end. To see how this function is related to our problem, notice that

$$ f(x) = \sum_{n=0}^{\infty} (-1)^n x^{n^2} = \sum_{n=0}^{\infty} \left( x^{4n^2} - x^{4(n+1)^2} \right) g(4n+1, x). $$

We prove that liminf and limsup of $f(x)$ as $x \uparrow 1$ are both $\frac{1}{2}$.

Liminf. An immediate consequence is that $g(4n+1, x) \geq \lim_{r\uparrow 1}g(4n+1, r) = \frac{4n+1}{8n+4}$. So for each fixed $N \geq 1$, we can bound $f(x)$ below first by truncating first $N$ terms and then by utilizing the aforementioned lower bound of $g(4n+1, x)$:

\begin{align*} f(x) &\geq \sum_{n=N}^{\infty} \left( x^{4n^2} - x^{4(n+1)^2} \right) \frac{4n+1}{8n+4} \\ &\geq \frac{4N+1}{8N+4} \sum_{n=N}^{\infty} \left( x^{4n^2} - x^{4(n+1)^2} \right) = \frac{4N+1}{8N+4} x^{4N^2}. \end{align*}

So it follows that

$$ \liminf_{x\uparrow 1}f(x) \geq \frac{4N+1}{8N+1} \xrightarrow[\quad N\to\infty \quad]{} \frac{1}{2}. $$

Limsup. For the other direction, fix $\epsilon > 0$ and define $N = N(\epsilon, x) = \lfloor \epsilon / \log(1/x) \rfloor$. Then for $x$ close to $1$, the sum of first $N$ terms can be bounded by using $g(4n+1, x) \leq g(4N-3, x)$:

\begin{align*} \sum_{n=0}^{N-1} \left( x^{4n^2} - x^{4(n+1)^2} \right) g(4n+1, x) &\leq \sum_{n=0}^{N-1} \left( x^{4n^2} - x^{4(n+1)^2} \right) g(4N-3,x) \\ &\leq g(4N-3,x) = \frac{1 - e^{(4N-3)\log x}}{1 - e^{(8N-4)\log x}} \\ &\to \frac{1-e^{-4\epsilon}}{1-e^{-8\epsilon}} \quad \text{as } N \to \infty. \end{align*}

For the remaining terms, we may utilize $g(4n+1, x) \leq g(\infty,x) = 1$ to obtain

\begin{align*} \sum_{n=N}^{\infty} \left( x^{4n^2} - x^{4(n+1)^2} \right) g(4n+1, x) &\leq \sum_{n=N}^{\infty} \left( x^{4n^2} - x^{4(n+1)^2} \right) \\ &= x^{4N^2} = e^{4N^2 \log x} \to 0 \quad \text{as } N \to \infty. \end{align*}

So it follows that

$$ \limsup_{x\uparrow 1}f(x) \leq \frac{1-e^{-4\epsilon}}{1-e^{-8\epsilon}} \xrightarrow[\quad \epsilon \downarrow 0 \quad]{} \frac{1}{2}. $$


Here is the proof of the observation:

  • We notice that

    $$ \frac{\partial g}{\partial a}(a,x) = \frac{x^a \log (1/x)}{(1-x^{2a+2})^2} \left(x^{2a+2}-2 x^{a+2}+1\right) > 0 $$

    since $x^{2a+2}-2 x^{a+2}+1 = x^2(x^a - 1)^2 + (1-x^2) > 0$. So $g$ is increasing in $a$ for any $x \in (0, 1)$.

  • Similarly, we find that

    $$ \frac{\partial g}{\partial x}(a,x) = - \frac{x^{a-1}}{(1-x^{2a+2})^2} \left( (a+2)x^{2a+2} + a - (2a+2) x^{a+2} \right). $$

    By the AM-GM inequality, we have

    $$ \frac{a+2}{2a+2} \cdot x^{2a+2} + \frac{a}{2a+2} \cdot 1 \geq x^{a+2} $$

    and hence $g$ is non-increasing in $x$ for any $a \in (0, \infty)$.


The function under limit is $(1+\vartheta_{4}(x))/2$ where $\vartheta_{4}(x)$ is one of Jacobi's theta functions. And theta functions satisfy various transformation formulas like $$\sqrt{s} \vartheta_{4}(e^{-\pi s}) =\vartheta_{2}(e^{-\pi/s}),\,s>0\tag{1}$$ where $$\vartheta_{2}(x)=2x^{1/4}\sum_{n=0}^{\infty}x^{n(n+1)}\tag{2}$$ is another Jacobi theta function. Therefore $$\vartheta_{4}(e^{-\pi s}) =2s^{-1/2}e^{-\pi/4s}\sum_{n=0}^{\infty}e^{-\pi n(n+1)/s}$$ and letting $s\to 0^{+}$ we get the desired result that $\vartheta_{4}(x)\to 0$ as $x\to 1^{-}$.


If you look here as pisco commented, you will read that "one important such use of Poisson summation concerns theta functions" and $$\sum_{n=0}^\infty (-1)^nx^{n^2}=\frac{1}{2} (1+\vartheta _4(0,x))$$ and $\vartheta _4(0,x)$ varies extremely fast as shown in the table below $$\left( \begin{array}{cc} 0.50 & 0.121124 \\ 0.55 & 0.073941 \\ 0.60 & 0.039603 \\ 0.65 & 0.017578 \\ 0.70 & 0.005876 \\ 0.75 & 0.001245 \\ 0.80 & 0.000118 \\ 0.85 & 0.000002 \end{array} \right)$$