Let’s fix a natural number $k$. How many ways can we decompose $n$ into $k$ squares? It’s an interesting problem and it should help me understand automorphic forms better.

Let $w_k(n)$ be the number of tuples $(n_1, \cdots, n_k)\in \mathbb{Z}^k$ such that $n_1^2+\cdots+n_k^2=n$. Let $g_k(q)$ be the generating function of $w_k(n)$, i.e., $g_k(q)=\sum_{n \in \mathbb{N}} w_k(n)q^n.$ Then, $\begin{split} g_k(q) &= \sum_{n \in \mathbb{N}} w_k(n)q^n \\ &= \sum_{n \in \mathbb{N}} \sum_{\substack{n_1, \cdots, n_k \in \mathbb{Z} \\ n_1^2+\cdots+n_k^2=n}}q^n \\ &= \sum_{n_1, \cdots, n_k \in \mathbb{Z}} q^{n_1^2+\cdots+n_k^2} \\ &= \left(\sum_{n \in \mathbb{Z}} q^{n^2}\right)^k \\ &= (g_1(q))^k. \end{split}$

Set $q=e^{\pi iz}$, where $z \in \mathcal{H}$, the upper complex plane. Let $\theta(z)=g_1(e^{\pi iz})=\sum_{n \in \mathbb{Z}} e^{\pi in^2z}.$ It’s clear that $\theta(z+2)=\theta(z)$. This means $\theta$ is invariant under $T^2=\left(\begin{array}{cc} 1 & 2 \\\\ & 1 \end{array}\right)$, where $T=\left(\begin{array}{cc} 1 & 1 \\\\ & 1 \end{array}\right)$. Let $S=\left( \begin{array}{cc} & -1 \\\\ 1 & \end{array}\right)$. Let y be a positive real number, then $\theta(iy)=\sum_{n \in \mathbb{Z}}e^{-\pi in^2y}.$

Using the following two facts:

• If $f_t(x)=e^{-\pi itx^2}$, then $\hat{f_t}=\frac{1}{\sqrt{t}}f_{1/t}$.
• Poisson summation formula.

We can get $\theta\left(-\frac{1}{iy}\right)=\sqrt{y}\theta(iy)$. By analytic continuation, the equation gives $\theta\left(-\frac{1}{z}\right)=\sqrt{-iz}\theta(z).$ If we define $f={\theta}^{8l}$ for some positive integer $l$, we have $\begin{array}{l} f(z+2)=f(z) \\ f(-1/z)=z^{4l}f(z) \end{array}$ Letting $\Gamma_{\theta}$ be generated by $T^2$ and $S$, combining the two equations above, we conclude that $f$ is a modular form of weight $4l$ for $\Gamma_{\theta}$. Up to this point, we have successfully converted a problem in number theory to a study about modular forms. I believe this is one motivation for studying modular forms.

Let $m$ be an even number larger than or equal $4$. Then the Eisenstein series $E_m \in M_m(\Gamma(1))$, where $M_m(\Gamma(1))$ is the space of all modular forms of weight $m$ for $\Gamma(1)=SL(2,\mathbb{Z})$. And, $\begin{split} E_m(z) &= \frac{1}{2}\sum_{\substack{c,d\in\mathbb{Z} \\\\ (c,d)\ne(0,0)}} (cz+d)^{-m} \\ &= \zeta(m)+\frac{(2\pi i)^m}{(m-1)!}\sum_{n=1}^{\infty} \sigma_{m-1}(n)e^{2\pi inz}, \end{split}$ where $\zeta(m)=\sum_{n=1}^{\infty}n^{-m}$ and $\sigma_{m-1}(n)=\sum_{d|n} d^{m-1}$. We can normalize the constant term of $E_m$ to be 1, defining $G_m=\zeta(m)^{-1}E_m$.

Now let $l=1$. Then $f=\theta^8$ is a modular form of weight $4$ for $\Gamma_{\theta}$. It’s would be a guess that $f$ might be a multiple of $G_4=1+240\sum_{n=1}^{\infty}\sigma_3(n)e^{2\pi inz}$. But it’s not. However, $f$ relates to $G_4$ by the following equation, whose proof can be found in Chapter VII in Freitag and Busam’s book Complex Analysis: $\begin{equation}f(z)=\frac{1}{15}\left(16G_4(z)-G_4\left(\frac{z+1}{2}\right)\right). \label{eq} \end{equation}$

Note that $f=\theta^8=g_8$, so $\eqref{eq}$ solves the 8 squares problem: $w_8(n)=\left\{ \begin{array}{ll} 16\sigma_3(n), &\text{ if } n \text{ is odd,} \\ 256\sigma_3\left(\frac{n}{2}\right)-16\sigma_3(n), &\text{ if } n \text{ is even.} \end{array} \right.$