Which numbers can be written as a sum of two squares (of integers)? To narrow the problem down a little bit, which prime numbers can be written as a sum of two squares? Notice that can be written as the sum of two squares,
. Meanwhile
cannot be written as the sum of two squares; since squares are positive, we only need look at the numbers less than
and we can exhaust all possibilities. Going to
, we can see that it can once again be written as the sum of two squares,
.
This problem was solved by Fermat, and the answer is that aside from , which we have already resolved, it is precisely the prime numbers which are
mod
which can be written as the sum of two squares. More generally, for numbers which are not necessarily prime, such a number can be written as the sum of two squares if the numbers which are
mod
appear in its prime factorization with an even exponent. Fermat used the method of infinite descent to solve this problem, however, there are many other proofs, and this problem and its many variants have motivated many developments in mathematics. In this post, we will discuss a fascinating method due to Jacobi, which involves the theory of modular forms ( see also Modular Forms).
Before we start discussing the approach of Jacobi let us state another such variant of the problem. Which numbers can be written as the sum of four squares? This question was settled by Lagrange, and it turns out the answer is that all positive integers can be written as the sum of four squares! The approach of Jacobi that we will discuss turns out to solve this problem as well!
Furthermore, the method of Jacobi not only tells us whether a number is a sum of two squares or four squares, but it actually tells us how many ways such a number can be written in that form. For example, we have mentioned earlier that can be written as
. This is one way to write it as a sum of two squares – there are actually eight such ways:
In fact, this what Jacobi’s approach actually does – it gives us the number of ways to write a number
as the sum of
squares (for the classical problems we mentioned
or
). If the
is nonzero, then we know that
can be written as a sum of
squares.
Let us now discuss this method of Jacobi. We will streamline the discussion a bit using modern language that was probably not available to Jacobi. It hinges on a very special function on the upper half-plane called the theta function, defined as follows:
Here in the second equation we have just chosen to adopt the traditional notation . Re-indexing the summation we can also write the theta function as
The square of the theta function is a modular form of weight , level
, and character
(see also Modular Forms). This means that
is a holomorphic function on the upper half-plane, bounded as the imaginary part of
goes to infinity, and satisfying the transformation law
where is an element of
, the group of
integer matrices with determinant
and which become upper triangular when the entries are reduced mod
(i.e.
is divisible by
), and
is a function which takes any integer
and outputs
if
is
mod
, outputs
if
is
mod
, and outputs
if
is even (
is an example of a Dirichlet character).
(In the literature the theta function itself is referred to as a “modular form of weight
“, but we will avoid this terminology in this post to keep things less confusing.)
Now here is what relates the square of the Jacobi to sums of two squares. We can write
Expanding the square of theta function as a Fourier series (again writing ) the above equation becomes
Now the -th term of this Fourier expansion will receive a contribution from each product of
and
such that
. In other words, the coefficient
counts how many pairs
there are such that
– it counts the number of ways
can be written as a sum of two squares! Therefore, the
-th Fourier coefficient of
is just the function
we mentioned earlier that tells us how many ways there are to write
as a sum of two squares.
More generally, the same argument can be applied to other powers of the theta function. In particular, we can also look at and this will tell us about sums of four squares. More precisely, the
-th Fourier coefficient of
is the function
that tells us how many ways there are to write
as a sum of four squares.
Now we will use results from the theory of modular forms to give us proofs of the theorems of Fermat and Lagrange that we have mentioned earlier.
Modular forms of a certain weight and level form a complex vector space, and the dimension of this vector space can be computed via dimension formulas. In particular, the vector space of modular forms of weight and level
has dimension
, which means they are all just complex multiples of each other.
There is another modular form of weight and level
which is well-studied, called the Eisenstein series of weight
, level
, and character
. It is defined as follows:
From the fact that modular forms of weight and level
form a vector space of dimension
, we know that the square of the theta function and this Eisenstein series are just multiples of each other. In fact, from a comparison of the leading terms, we can see that
Therefore, comparing the Fourier expansions, we see that . Specializing to when
is a prime, the only divisors of
are
and
, and we have
, which is
when
is
mod
, and
when
is
mod
, as follows from the definition of
. Therefore this tells us that
is a sum of two squares precisely when
is
mod
. With a little more effort, one can see that the formula
also tells us that more generally
(even when it is not prime) is a sum of two squares precisely when the prime divisors of
which are
mod
have an even power in its prime factorization.
Let us now look at and the problem of writing a number as the sum of four squares. Now
is actually a modular form of weight
and level
. This time the vector space of modular forms of weight
and level
is a vector space of dimension
. So it is not quite as easy as the case of
and sums of two squares, but we can still find two linearly independent modular forms of weight
and level
which will form a convenient basis for us to express
in terms of.
These modular forms are given by
and
where
is the Eisenstein series of weight and level
(here the symbol
denotes the sum of the positive divisors of
– note also that we are using a different normalization than in Modular Forms for convenience). It turns out that
Similar to the earlier case for the sum of two squares, one can now expand both sides in a Fourier expansion and compare Fourier coefficients. It will turn out that is equal to
times the sum of the positive divisors of
which are not divisible by
. Since there is always going to be such a divisor, this tells us that any positive integer can always be written as the sum of four squares.
We have seen, therefore, that the theory of modular forms can help us understand very classical problems in number theory. The theta function is in fact worthy of a whole entire theory itself – it is connected to many things in mathematics from representation theory to abelian varieties. We will discuss more of these aspects in future posts.
References:
Theta function on Wikipedia
Jacobi’s four-square theorem on Wikipedia
Sum of squares function on Wikipedia
Elliptic modular forms and their applications by Don Zagier
Pingback: The Theta Correspondence | Theories and Theorems