show/hide this revision's text 3 added 352 characters in body

Let $r_2(n)$ be the number of representations of $n$ as a sum of two squares, and let $l(n)$ be the number of ways to write $n$ as $x^2+xy+y^2$. Then as you mentioned we have that $$\sum_{y,x\in \mathbb{Z}} q^{x^2+y^2}=\sum_{n=0}^\infty r_2(n) q^n \ \text{and} \ \sum_{y,x\in \mathbb{Z}} q^{x^2+xy+y^2}=\sum_{n=0}^\infty l(n) q^n.$$

Exact number of representations: We can evaluate explicitely write down $r_2(n)$ and r_2(n)$, the number of representations of $l(n)$ explicitly using some ideas already mentioned. (We need n$ as a Theorem sum of Fermat and a theorem two squares. See Sum of Jacobi regarding which primes can be represented.)

However Squares Function.

Also, in a similar manner we can explicitely write down $l(n)$, the number of representations of $n$ as $x^2+xy+y^2$. See the answer on this math stack exchange post.

Theta Functions: We can evaluate the infinite series in terms of Jacobi theta functions without much difficulty. To deal with the sum of squares, notice that

$$\sum_{y,x\in \mathbb{Z}} q^{x^2+y^2} =\left( \sum_{n=-\infty}^\infty q^{n^2}\right)^2= \vartheta_3(q)^2.$$ Next, we can transform $x^2 +xy+y^2$ into $\frac{n^2+3m^2}{4}$ where $m,n$ must have the same parity. Then $$\sum_{x,y}q^{x^{2}+xy+y^{2}}=\sum_{\begin{array}{c} x,y\ both\ odd \end{array}}q^{\frac{x^{2}+3y^{2}}{4}}+\sum_{\begin{array}{c} x,y\ both\ even \end{array}}q^{\frac{x^{2}+3y^{2}}{4}} $$

$$=q\sum_{n,m\in\mathbb{Z}}q^{n(n+1)+3m(m+1)}+\sum_{n,m\in\mathbb{Z}}q^{n^{2}+3m^{2}}.$$This can be rewritten in terms of the jacobi theta functions as $$\vartheta_2(q)\vartheta_2(q^3)+\vartheta_3(q)\vartheta_3(q^3).$$

Hope that helps,

show/hide this revision's text 2 deleted 37 characters in body

Let $r_2(n)$ be the number of representations of $n$ as a sum of two squares, and let $l(n)$ be the number of ways to write $n$ as $x^2+xy+y^2$. Then as you mentioned we have that $$\sum_{y,x\in \mathbb{Z}} q^{x^2+y^2}=\sum_{n=0}^\infty r_2(n) q^n \ \text{and} \ \sum_{y,x\in \mathbb{Z}} q^{x^2+xy+y^2}=\sum_{n=0}^\infty l(n) q^n.$$ We can evaluate $r_2(n)$ and $l(n)$ explicitly using some ideas already mentioned. (We need a Theorem of Fermat and a theorem of Jacobi regarding which primes can be represented.)

However we can evaluate the infinite series in terms of Jacobi theta functions without much difficulty, and without using any number theory. To deal with the sum of squares, notice that

$$\sum_{y,x\in \mathbb{Z}} q^{x^2+y^2} =\left( \sum_{n=-\infty}^\infty q^{n^2}\right)^2= \vartheta_3(q)^2.$$ Next, we can transform $x^2 +xy+y^2$ into $\frac{n^2+3m^2}{4}$ where $m,n$ must have the same parity. Then $$\sum_{x,y}q^{x^{2}+xy+y^{2}}=\sum_{\begin{array}{c} x,y\ both\ odd \end{array}}q^{\frac{x^{2}+3y^{2}}{4}}+\sum_{\begin{array}{c} x,y\ both\ even \end{array}}q^{\frac{x^{2}+3y^{2}}{4}} $$

$$=q\sum_{n,m\in\mathbb{Z}}q^{n(n+1)+3m(m+1)}+\sum_{n,m\in\mathbb{Z}}q^{n^{2}+3m^{2}}.$$This can be rewritten in terms of the jacobi theta functions as $$\vartheta_2(q)\vartheta_2(q^3)+\vartheta_3(q)\vartheta_3(q^3).$$

Hope that helps,

show/hide this revision's text 1

Let $r_2(n)$ be the number of representations of $n$ as a sum of two squares, and let $l(n)$ be the number of ways to write $n$ as $x^2+xy+y^2$. Then as you mentioned we have that $$\sum_{y,x\in \mathbb{Z}} q^{x^2+y^2}=\sum_{n=0}^\infty r_2(n) q^n \ \text{and} \ \sum_{y,x\in \mathbb{Z}} q^{x^2+xy+y^2}=\sum_{n=0}^\infty l(n) q^n.$$ We can evaluate $r_2(n)$ and $l(n)$ explicitly using some ideas already mentioned. (We need a Theorem of Fermat and a theorem of Jacobi regarding which primes can be represented.)

However we can evaluate the infinite series in terms of Jacobi theta functions without much difficulty, and without using any number theory. To deal with the sum of squares, notice that

$$\sum_{y,x\in \mathbb{Z}} q^{x^2+y^2} =\left( \sum_{n=-\infty}^\infty q^{n^2}\right)^2= \vartheta_3(q)^2.$$ Next, we can transform $x^2 +xy+y^2$ into $\frac{n^2+3m^2}{4}$ where $m,n$ must have the same parity. Then $$\sum_{x,y}q^{x^{2}+xy+y^{2}}=\sum_{\begin{array}{c} x,y\ both\ odd \end{array}}q^{\frac{x^{2}+3y^{2}}{4}}+\sum_{\begin{array}{c} x,y\ both\ even \end{array}}q^{\frac{x^{2}+3y^{2}}{4}} $$

$$=q\sum_{n,m\in\mathbb{Z}}q^{n(n+1)+3m(m+1)}+\sum_{n,m\in\mathbb{Z}}q^{n^{2}+3m^{2}}.$$This can be rewritten in terms of the jacobi theta functions as $$\vartheta_2(q)\vartheta_2(q^3)+\vartheta_3(q)\vartheta_3(q^3).$$

Hope that helps,