I am trying to understand the following proof of the fact that the number of ways to write a positive integer $n$ as a sum of two squares (call it $s_n$) is given by $$s_n = 4\sum_{d|n} \chi_{-4}(d),$$ where $\chi_{-4}$ is the Dirichlet character defined by $$ \chi_{-4}(m) = \begin{cases} 1, & m\equiv 1 \mod 4 \\ -1, &m \equiv 3 \mod 4\\ 0, &m \equiv 0,2 \mod 4.\end{cases}$$

The key observation is the following. Let

$$\theta(z) := \sum_{n \in \Bbb{Z}} q^{n^2} = 1+2q + 2q^2 +\ldots$$ be the Jacobi theta series where as usual $q = e^{2\pi i z}$. Then we have:

  1. $s_n$ is the $n$-th coefficient of $\theta(z)^2$

  2. $ \theta(z)^2$ is a modular form of weight $1$ for the congruence subgroup $\Gamma_0(4) \subseteq \text{SL}_2(\Bbb{Z})$

  3. The space $M_1(\Gamma_0(4))$ is one dimensional.

Of course, we are not done yet. We need to take advantage of 3 as follows. Defined the Eisenstein series $G_{1,\chi_{-4}}(z) $ (with respect to the Dirichlet character above) as

$$G_{1,\chi_{-4}}(z) = \frac{1}{4} + \sum_{n \geq 1}\left( \sum_{d |n} \chi_{-4}(d)\right) q^n .$$

My question is: I know that $G_{1, \chi_{-4}}$ satisfies the relation $$G_{1, \chi_{-4}}(\gamma\cdot z) = \chi_{-4}(a) (cz+d)^{-1} G_{1, \chi_{-4}}(z)$$ for a matrix $$\gamma = \left(\begin{array}{cc} a & b \\ c& d\end{array}\right) \in \Gamma_0(4).$$ I want to say from here that $G_{1,\chi_{-4}}(z)$ is actually a modular form of weight $1$ w.r.t. $\Gamma_0(4)$. The problem here is that the quantity $\chi_{-4}(a)$ is not always equal to $1$! How do we get around this?

  • $\begingroup$ do you know the space $M_k(\Gamma_0(N),\chi)$ which is the set of holomorphic functions such that $f|_k\gamma(z) = \chi(d) f(z)$ for every $\gamma \in \Gamma$, with $f|_k\gamma(z) = (cz+d)^{-k} f(\gamma . z)$ $\endgroup$
    – reuns
    Nov 3, 2016 at 7:32

1 Answer 1


Here, I will assume the familiarity with the definition of modular forms. If one has trouble with this, please add a comment.

By the appearance of $\chi_{-4}$ in the modular transformations law, the modular form $G_{1,\chi_{-4}}$ is not a modular form of weight 1 with respect to $\Gamma_{0}(4)$. But if we restrict the group to $$\Gamma_{1}(4)=\left\{\left(\begin{array}{cc} a & b \\ c & d \end{array}\right)\in SL_{2}(\mathbb{Z}):a\equiv d\equiv1\pmod{4},b\equiv c\equiv 0\pmod{4}\right\},$$ then we don't need care about $\chi_{-4}$ because $\chi_{-4}(a)=1$ for all $a\equiv 1\pmod{4}$. In other words, $G_{1,\chi_{-4}}$ is a modular form of weight 1 with respect to $\Gamma_{1}(4)$.

On the other hand, since $\Gamma_{1}(4)\subset\Gamma_{0}(4)$, $M_{1}(\Gamma_{0}(4))\subset M_{1}(\Gamma_{1}(4))$, where $M_{k}(\Gamma)$ denotes the space of modular forms of weight $k$ with respect to $\Gamma$. Thus, $\theta^{2}$ is can be considered as a modular form of weight 1 with respect to $\Gamma_{1}(4)$.

It is known that $\dim_{\mathbb{C}}(M_{1}(\Gamma_{1}(4)))=1$. So by working with $\Gamma_{1}(4)$ instead of $\Gamma_{0}(4)$ we can use the strategy described in the question to prove the desired formula.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .