I found this problem in the book Analysis 1 by Otto Forster (Problem 8.3), the book is in german, so I will restate the problem in english, it is to prove that the following statement is true: For any $x\in\mathbb{R}$ with $|x|<1$ we have the following equality:
$$\left(\sum_{n=0}^{\infty} x^{n^2} \right)^2 = \sum_{n=0}^{\infty} x^{n}A(n) $$
with the function $$A(n)=|\{ (k,l)\in\mathbb{N}\times\mathbb{N}\mid n=k^2+l^2 \}|$$I tried to prove this statement using the formula of Cauchy for product of two infinite series, but to no avail. I still don't get the idea how to tie down $A(n)$ with the $x$. For example, by Cauchy:
$$\left(\sum_{n=0}^{\infty} x^{n^2}\right)^2 = \sum_{n=0}^{\infty}\sum_{k=0}^{n} x^{k^2}x^{(n-k)^2} = \sum_{n=0}^{\infty}x^{n}\sum_{k=0}^{n} x^{k^2-n}x^{(n-k)^2}$$
Now what's left to to is to show that
$(2)$ $$\sum_{k=0}^{n} x^{k^2-n}x^{(n-k)^2}= A(n)$$
But I don't think this is the case, since if we were to plug in $n=3$, we would get the result of the LHS being unequal to zero whereas the RHS equals zero, so this shows that although the statement holds, (2) does not necessarily be true, so I wonder if there is another approach to this problem starting from the construction of $A(n)$ itself. I tried to construct it but didn't see the connection of $A(n)$ and $x$, since for example,
$$A(n)=\sum_{0 \leq k,l\leq n} [n=k^2+l^2]=\sum_{0 \leq k\leq n} \left(\left \lfloor{\sqrt{n-k^2}}\right \rfloor-\left \lceil{\sqrt{n-k^2}}\right \rceil +1 \right)=\sum_{0 \leq k\leq n} \left \lfloor\frac{\left \lfloor n-k^2 \right \rfloor}{n-k^2}\right \rfloor $$
But still there isn't any $x$ involved. I would really appreciate it if you can give me a clue before the proper answer. Thanks!
The Cauchy product is $$\left(\sum_{i=0}^\infty a_i x^i \right)\left(\sum_{i=0}^\infty b_i x^i \right) = \sum_{n=0}^\infty \sum_{i=0}^n a_i b_{n-i} x^n.$$
In the case of $$\left(\sum_{n=0}^\infty x^{n^2} \right)^2,$$ we take $a_i = b_i = 1$ if $i$ is a perfect square, otherwise $a_i=b_i=0$. So
$$a_i b_{n-i} = 1$$ if both $i$ and $n-i$ are perfect squares, otherwise $0$. Therefore $$\sum_{i=0}^n a_i b_{n-i} = \cdots$$
Edit: Or more directly, \begin{align*} \left(\sum_{n=0}^\infty x^{n^2}\right)^2 &= \left(\sum_{i=0}^\infty x^{i^2}\right)\left(\sum_{j=0}^\infty x^{j^2}\right) \\ &= \sum_{i=0}^\infty \sum_{j=0}^\infty x^{i^2+j^2} \\ &= \sum_{n=0}^\infty \sum_{0 \leq i,j < \infty, i^2 +j^2 = n} x^{i^2+j^2}\\ &= \sum_{n=0}^\infty x^n \sum_{0 \leq i,j < \infty, i^2 +j^2 = n} 1\\ \end{align*}