Sums of Squares and Triangular Numbers

Hershel M. Farkas Institute of Mathematics The Hebrew University Jerusalem

Submitted: July 7, 2005; Accepted: December 5, 2005; Published: May 5, 2006

Abstract

In this note we use the theory of theta functions to discover formulas for the number of representations of N as a sum of three squares and for the number of representations of N as a sum of three triangular numbers. We discover various new relations between these functions and short, motivated proofs of well known formulas of related combinatorial and number-theoretic interest.

1 Introduction

There has been lots of work on the problem of writing a non negative integer as a sum of squares. For references to the literature and background information we refer to the book [G] by E. Grosswald and the article [M] by S. Milne. One of the facts that one learns from these texts is that the problem is much harder when we wish information and the number of summands is an odd integer. In this note we consider the case of sums of 3 squares and develop some formulas for this case.

Let S_{k}(n) denote the number of ways one can write n as a sum of k squares or the number of solutions to the diophantine equation

x_{1}^{2} + x_{2}^{2} + ⋯ + x_{k}^{2} = n.

It is well known that for k = 2, 4 Jacobi gave a formula for this number in terms of the divisors of n. Jacobi’s formulae are

S_{2}(n) = 4(d_{1}(n) − d_{3}(n))
S_{4}(n) = 8σ′(n)

where d_{i}(n) is the number of divisors of n congruent to i mod 4, and σ′(n) is the sum of the divisors of n not congruent to 0 mod 4. It follows from Jacobi’s formula that

S_{2}(4k + 3) = 0, S_{2}(2k) = S_{2}(k).

These facts, of course, do not require Jacobi’s formula and can be proven in a simple way without it. If one defines T_{k}(n) to be the number of ways one can write n as a sum of k triangular numbers or the number of solutions of the diophantine equation

\frac{x_{1}^{2} + x_{1}}{2} + \frac{x_{2}^{2} + x_{2}}{2} + ⋯ + \frac{x_{k}^{2} + x_{k}}{2} = n

an additional easy fact that can be shown is that

T_{2}(n) = S_{2}(4n + 1).

Definition 1. The theta function with characteristic [ \begin{matrix}ϵ \\ ϵ′ \end{matrix} ] ∈ R^{2},

ζ ∈ ℂ, τ ∈ H is defined by

θ [ \begin{matrix}ϵ \\ ϵ′ \end{matrix} ] (ζ, τ) = ∑_{n=−∞}^{∞} exp(2πi[\frac{1}{2}(n + \frac{ϵ}{2})^{2}τ + (n + \frac{ϵ}{2})(ζ + \frac{ϵ′}{2} )])

where H is the upper half plane and ℂ is the complex plane.

The theta function satisfies many identities among them the following

θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 2τ) + θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 2τ)  (1)

θ^{2} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ) = θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 2τ) − θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 2τ)  (2)
θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, τ) = 2θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 2τ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 2τ)  (3)

The above three identities are enough for example to give the well known Jacobi quartic identity

θ^{4} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = θ^{4} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ) + θ^{4} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, τ).  (4)

In terms of the variable x = exp(πiτ) we have

θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = ∑_{n=0}^{∞} S_{2}(n)x^{n}, θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, τ) = x^{\frac{1}{4}} ∑_{n=0}^{∞} T_{2}(n)x^{2n},

so that (??) above translates to the identity

∑_{n=0}^{∞} S_{2}(n)x^{n} = ∑_{n=0}^{∞} S_{2}(n)x^{2n} + ∑_{n=0}^{∞} T_{2}(n)x^{4n+1}.

The three properties we recorded above which are satisfied by S_{2}(n) are all consequences of this quite elementary theta identity.

The purpose of this note is to find theta identities which will do for the function S_{3}(n) what equation (??) did for S_{2}(n). In addition we shall obtain some interesting formulas for S_{3}(n) which will depend on the congruence class of n mod 8. A byproduct of this investigation is the following.

It is well known that not every positive integer can be written as a sum of 3 squares. In fact it is known that those positive integers congruent to 7 mod 8 are ”not” so expressible and that these are the only ones not so expressible. On the other hand it is also known that every positive integer is expressilble as the sum of three triangular numbers. We recall that a triangular number is a number of the form \frac{k^{2}+k}{2}. Hence 3 squares do not suffice and 3 triangulars do. Here we reprove a result which seems to have been forgotten [L],[R].

Theorem 1. Every positive integer can be written as the sum of two squares plus one triangular number and every positive integer can be written as the sum of two triangular numbers plus one square.

2 Theta constant identities

In this section we record some theta constant identities which we will need in the sequel. A reference for this section is the book [FK] where the reader can find the proofs of the statements not proved here. A rather simple identity is the following

θ [ \begin{matrix}ϵ \\ ϵ′ \end{matrix} ] (ζ, τ) = ∑_{l=0}^{k−1} θ [ kϵ′^{\frac{ϵ+2l}{k}} ] (kζ, k^{2}τ).  (5)

There are several simple consequences of this general identity. We list 4 instances of it corresponding to k = 2, 3.

θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)  (6)

θ [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ) = θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) − θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)  (7)

θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, τ) = 2θ [ 0^{\frac{1}{3}} ] (0, 9τ) + θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 9τ).  (8)

In the above we have used the fact that θ [ 0^{\frac{1}{3}} ] (0, 9τ) = θ [ 0^{\frac{5}{3}} ] (0, 9τ). Our last instance

is the identity

θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = 2θ [ 0^{\frac{2}{3}} ] (0, 9τ) + θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 9τ).  (9)

In the last identity we have used θ [ 0^{\frac{4}{3}} ] (0, 9τ) = θ [ 0^{\frac{2}{3}} ] (0, 9τ). We now begin to use these

elementary identities to prove

Lemma 1. For all τ in the upper half plane it is true that

θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) + θ^{3} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ) =

2θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + 6θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ)θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)

θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) − θ^{3} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ) =

2θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ) + 6θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)

Proof. Cubing equation (??), gives

θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + 3θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)+  (10)

3θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ).

Cubing equation (??) gives a similar expression only with alternating signs and the equations of the lemma are obtained by adding and subtracting the expressions obtained by the cubing process.

We now make the elementary observation that in the variable x = exp(πiτ), the left hand sides of the identities in the lemma are simply

2 ∑_{n=0}^{∞} S_{3}(2n)x^{2n}, 2 ∑_{n=0}^{∞} S_{3}(2n + 1)x^{2n+1}.

This follows from the elementary fact that in the variable x, if we set θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = f(x),

then θ [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ) = f(−x). With this in hand we have

Corollary 1. The function S_{3}(n) satisfies the following equations.

S_{3}(4k) = S_{3}(k), S_{3}(8k + 7) = 0, S_{3}(8k + 3) = T_{3}(k)

Proof. Writing the equations of the lemma in the variable x we have

2 ∑_{n=0}^{∞} S_{3}(2n)x^{2n} = 2 ∑_{n=0}^{∞} S_{3}(n)x^{4n} + 6x^{2} ∑_{n=−∞}^{∞} x^{4n^{2}} ∑_{n=0}^{∞} T_{2}(n)x^{8n}  (11)

2 ∑_{n=0}^{∞} S_{3}(2n + 1)x^{2n+1} = 2x^{3} ∑_{n=0}^{∞} T_{3}(n)x^{8n} + 6x ∑_{n=−∞}^{∞} x^{8 \frac{n^{2}+n}{2}} ∑_{n=0}^{∞} S_{2}(n)x^{4n}.  (12)

The first statement of the corollary follows from equation (??), while the second and third statements follow from equation (??).

Remark 1. The results of the corollary are well known and not hard to prove. Our objective was getting them all as a consequence of a theta identity. We now will show that once we have the identity things that we may not have thought of before become obvious and lend themselves to a natural process of discovery. The third statement for example which is due to Gauss and which does have a very elementary proof could have been missed by a lesser person. Here it calls attention to itself.

3 Sums of triangulars

The above was deduced from the identity which followed from equation (??). Let us now see what we can get from equation (??). Cubing equation (??) we have

θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, τ) = 8θ^{3} [ 0^{\frac{1}{3}} ] (0, 9τ) + 12θ^{2} [ 0^{\frac{1}{3}} ] (0, 9τ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 9τ)+  (13)

6θ [ 0^{\frac{1}{3}} ] (0, 9τ)θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 9τ) + θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 9τ).

When we write equation (??) in the variable x = exp(πiτ), make the obvious simplifications and replace x by x^{\frac{1}{2}} , we obtain

( ∑_{n=−∞}^{∞} x^{\frac{n^{2}+n}{2}} )^{3} = 8( ∑_{n=−∞}^{∞} x^{3 \frac{3n^{2}+n}{2}} )^{3} + 12x( ∑_{n=−∞}^{∞} x^{3 \frac{3n^{2}+n}{2}} )^{2} ∑_{n=−∞}^{∞} x^{9 \frac{n^{2}+n}{2}} +  (14)

6x^{2} ∑_{n=−∞}^{∞} x^{3 \frac{3n^{2}+n}{2}} ( ∑_{n=−∞}^{∞} x^{9 \frac{n^{2}+n}{2}} )^{2} + x^{3}( ∑_{n=−∞}^{∞} x^{9 \frac{n^{2}+n}{2}} )^{3}.

Definition 2. Let P_{k}(n) denote the number of solutions of the diophantine equation

\frac{3x_{1}^{2} + x_{1}}{2} + ⋯ + \frac{3x_{k}^{2} + x_{k}}{2} = n.

Clearly P_{k}(n) is the number of ways n can be written as a sum of k generalized pentagonal numbers. We recall that a pentagonal number is a number of the form \frac{3k^{2}−k}{2} with k non negative. We now can write equation (??) as

∑_{n=0}^{∞} T_{3}(n)x^{n} = 8 ∑_{n=0}^{∞} P_{3}(n)x^{3n} + 12x ∑_{n=0}^{∞} P_{2}(n)x^{3n} ∑_{n=−∞}^{∞} x^{9 \frac{n^{2}+n}{2}} +  (15)

6x^{2} ∑_{n=0}^{∞} T_{2}(n)x^{9n} ∑_{n=−∞}^{∞} x^{3 \frac{3n^{2}+n}{2}} + x^{3} ∑_{n=0}^{∞} T_{3}(n)x^{9n}.

As a consequence of equation (??) we obtain

Corollary 2. For all integers k we have

T_{3}(3k) = 8P_{3}(k) + T_{3}(\frac{k − 1}{3})

where T_{k} is defined to be 0 whenever the variable is not a non negative integer. Hence T_{3}(3k) = 8P_{3}(k) unless k ≡ 1 mod 3.

Remark 2. The result of the corollary is of course immediate from equation (??). The result is also proveable without the identity. It is really a consequence of the fact that a number congruent to 0 mod 3 can be written as the sum of 3 triangular numbers in two ways. Either as a sum of triangular numbers each one congruent to 0 mod three or as a sum of 3 triangular numbers each congruent to 1 mod 3. We leave the details to the reader. Our point once again is that using theta identities gives the identity automatically.

Continuing in this vein we also from equation (??) immediately obtain

Corollary 3. For all integers k we have

T_{3}(3k + 2) = 6 ∑_{l∈Z} T_{2}(\frac{k − \frac{3l^{2}+l}{2}}{3} )

and in particular T_{3}(3k + 2) is congruent to 0 mod 24. Every non negative integer can be written as a sum of 2 numbers congruent to 0 mod 3 and a generalized pentagonal number where the numbers congruent to 0 mod 3 are 3 times a triangular number.

Proof. The exponents in the power series given by the left hand side of equation (??) which are congruent to 2 mod 3 all come from the expression 6x^{2} ∑_{n=−∞}^{∞} x^{3 \frac{3n^{2}+n}{2}} ∑_{n=0}^{∞} T_{2}(n)x^{9n}.

This can be written as 6x^{2} ∑_{n=−∞}^{∞} x^{3 \frac{3n^{2}+n}{2}} ∑_{n=0}^{∞} T_{2}(n/9)x^{n} and the Cauchy product of these

power series gives the coefficient of 3N + 2 as 6 ∑_{k∈Z} T_{2}(^{\frac{3N−3 \frac{3k^{2}+k}{2}}{9}} ) = 6 ∑_{k∈Z} T_{2}(^{\frac{N− \frac{3k^{2}+k}{2}}{3}} ) . This is the first statement in the corollary. The second statement follows since T_{2}(n) is always congruent to 0 mod 4.

The last statement follows from the fact that every non negative integer is expressible as a sum of 3 triangular numbers. This means that T_{3}(3N + 2) is always positive. This means

that for at least one k, T_{2}(^{\frac{N− \frac{3k^{2}+k}{2}}{3}} ) is positive. This of course says that for this k we have

\frac{N− \frac{3k^{2}+k}{2}}{3} = t_{1} + t_{2} where t_{i} are triangular numbers. Hence we have N = 3t_{1} + 3t_{2} + \frac{3k^{2}+k}{2} which is the final statement.

4 Sums of squares

In this section we continue our investigations of the function S_{3}(n). We remind the reader that it is well known that every number is a sum of 3 triangulars but not a sum of 3 squares. We shall show however that 2 squares and a triangular suffice and that 2 triangulars and a square also suffice.

We return to equation (??) and observe that by using equation (??) it can be rewritten as

θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)+  (16)

3θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ).

Using now equation (??) we can rewrite equation (??) as

θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)+  (17)

\frac{3}{2}θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ)θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 2τ).

This is our main identity in this paper from which the rest of the results will flow. As is usual by now, replacing τ with the variable x = exp(πiτ) equation (??) becomes

∑_{n=0}^{∞} S_{3}(n)x^{n} = ∑_{n=0}^{∞} S_{3}(n)x^{4n} + x^{3} ∑_{n=0}^{∞} T_{3}(n)x^{8n}+  (18)

\frac{3}{2}x ∑_{n=−∞}^{∞} x^{n^{2}} ∑_{n=0}^{∞} T_{2}(n)x^{4n}.

We notice immediately that equation (??) repeats the information we already knew namely that

S_{3}(4n) = S_{3}(n), S_{3}(8n + 7) = 0, S_{3}(8n + 3) = T_{3}(n)

but there is more imbedded in the remaining term

\frac{3}{2}x ∑_{n=−∞}^{∞} x^{n^{2}} ∑_{n=0}^{∞} T_{2}(n)x^{4n}.

In order to extract the information we rewrite the last term in equation (??) in the following way.

\frac{3}{2}x(1 + 2 ∑_{n=1}^{∞} x^{(2n)^{2}} + 2 ∑_{n=0}^{∞} x^{(2n+1)^{2}})(∑_{n=0}^{∞} T_{2}(n)x^{4n})

This has given us a sum

\frac{3}{2}x(1 + ∑_{n=1}^{∞} 2x^{(2n)^{2}})(∑_{n=0}^{∞} T_{2}(n/4)x^{n}) + 3/2x(∑_{n=0}^{∞} 2x^{(2n+1)^{2}})(∑_{n=0}^{∞} T_{2}(n/4)x^{n}).

In the above the first power series contains all the exponents congruent to 1 mod 4 while the second contains all the exponents congruent to 2 mod 4.

Theorem 2.

S_{3}(4N + 1) = \frac{3}{2}(∑_{k=1}^{∞} 2T_{2}(N − k^{2}) + T_{2}(N))

S_{3}(4N + 2) = 3(∑_{k=0}^{∞} T_{2}(N − (k^{2} + k))

so that S_{3}(4N + 1) is congruent to 0 mod 6 and S_{3}(4N + 2) is congruent to 0 mod 12. Moreover, every non negative integer is expressible as a sum of 2 triangular numbers plus a square.

Proof. The first two statements follow from computing the Cauchy product and obtaining

S_{3}(4N + 1) = 3/2(∑_{k=1}^{∞} 2T_{2}(\frac{4N − 4k^{2}}{4} ) + T_{2}(N))

which is clearly the same as the first statement. Similarly the second statement is obtained by writing the Cauchy product

S_{3}(4N + 2) = 3/2(∑_{k=0}^{∞} 2T_{2}(\frac{4N − (4k^{2} + 4k)}{4}).

Since T_{2}(n) is congruent to 0 mod 4 we get also the congruence statements. Finally since S_{3}(4N + 1) is positive it means the right hand side is positive. This means that at least for one k we have T_{2}(N −k^{2}) is positive. This of course says that for this k, N −k^{2} = \frac{x^{2}+x}{2} + \frac{y^{2}+y}{2} which is the last statement.

Remark 3. Note that the last statement of the theorem is already half of Theorem ??. We now return to equation (??) and rewrite it as

∑_{n=0}^{∞} S_{3}(2n + 1)x^{2n+1} = x^{3} ∑_{n=0}^{∞} T_{3}(n)x^{8n} + 6x ∑_{n=0}^{∞} S_{2}(n/4)x^{n} ∑_{n=0}^{∞} x^{8 \frac{n^{2}+n}{2}}

and conclude from this that Theorem 3. For all non negative k we have

S_{3}(4N + 1) = 6 ∑_{k=0}^{∞} S_{2}(\frac{4N − 4(k^{2} + k)}{4}) = 6 ∑_{k=0}^{∞} S_{2}(N − (k^{2} + k)).

In particular we therefore have

S_{3}(8N + 1) = 6 ∑_{k=0}^{∞} S_{2}(N − \frac{k^{2} + k}{2} ).

Proof. The proof of the first statement is just computing the coefficient of 4N + 1 in the Cauchy product of the power series for the rewritten equation (??). The second statement follows by letting M=2N in the first statement so that

S_{3}(8N + 1) = 6 ∑_{k=0}^{∞} S_{2}(2M − (k^{2} + k)) = 6 ∑_{k=0}^{∞} S_{2}(M − \frac{k^{2} + k}{2} ),

the last equality being a consequence of the fact that S_{2}(2M) = S_{2}(M).

Remark 4. We note that the last statement is the proof of the second half of Theorem ?? so that we have now completed the proof of that Theorem.

5 Some further identities

In this section we show how to obtain some further identities involving S_{3}(N). We shall show how equation(??) leads to an identity connecting S_{3}(N) with L_{3}(N) where L_{3}(N) is defined as

Definition 3. L_{k}(N) will denote the number of solutions to the diophantine equation N = 3x_{1}(3x_{1} + 2) + ⋯ + 3x_{k}(3x_{k} + 2).

Theorem 4. If N is not congruent to 0 mod 3 then

S_{3}(3N) = 8L_{3}(3(N − 1)).

If N is congruent to 0 mod 3 then

S_{3}(3N) = 8L_{3}(3(N − 1)) + S_{3}(N/3).

Proof. We use equation (??) to obtain

θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) = 8θ^{3} [ 0^{\frac{2}{3}} ] (0, 9τ) + 12θ^{2} [ 0^{\frac{2}{3}} ] (0, 9τ)θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 9τ)+

6θ [ 0^{\frac{2}{3}} ] (0, 9τ)θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 9τ) + θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 9τ).

In the variable x = exp(πiτ) we have

θ [ 0^{\frac{2}{3}} ] (0, 9τ) = x ∑_{n=−∞}^{∞} x^{9n^{2}+6n}

so that our identity above can be rewritten as

∑_{n=−∞}^{∞} S_{3}(n)x^{n} = 8 ∑_{n=0}^{∞} L_{3}(3n)x^{3n+3} + ∑_{n=0}^{∞} S_{3}(n)x^{9n}+

12x^{2} ∑_{n=0}^{n=∞} L_{2}(3n)x^{3n} ∑_{n=−∞}^{∞} x^{9n^{2}} + 6x ∑_{n=−∞}^{∞} x^{9n^{2}+6n} ∑_{n=0}^{∞} S_{2}(n)x^{9n}.

The proof of the Theorem is now immediate from the the first two terms in the above identity.

We could of course also compute S_{3}(3n + 1), S_{3}(3n + 2) from the above identity and congruence relations for them but leave this to the reader.

6 Averaging

Our objective was to show how from a suitable theta constant identity we could obtain information about S_{3}(N). The idea was to start with zero knowlege and see what we would get. We obtained Corollaries 1-3 and Theorems 2 and 3. We however do have some advance information and know that the function S_{3}(N) should in some way depend on the congruence class of N mod 8. We could therefore, had we wished, adopted a more direct approach which we now briefly describe.

For m a positive integer, 1 ≤ m ≤ 7 consider the average

∑_{l=0}^{7} exp[(πiτ)(m + \frac{l}{4})]θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ + \frac{l}{4}).

Using the elementary fact, see [FK], that

θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ + 1) = θ [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ)

the above average can be rewritten as

exp(πimτ) ∑_{l=0}^{3} exp(\frac{πilm}{4})(θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ + \frac{l}{4}) + (−1)^{m}θ^{3} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, τ + \frac{l}{4})).

We now use the identity we derived in Lemma 1.

Assuming m is odd we get

exp((πimτ) ∑_{l=0}^{3} exp(\frac{πilm}{4})(2θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ + l) + 6θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (04τ + l)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ + l)),

while if m is even we obtain

exp((πimτ) ∑_{l=0}^{3} exp(\frac{πilm}{4})(2θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ + l) + 6θ^{2} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ + l)θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ + l).

We now require another elementary fact and that is that

θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, τ + 1) = exp(\frac{πi}{4})θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, τ).

We now note that θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ + l) is either equal to θ [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) when l is even or equal

to θ [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, 4τ) when l is odd. We thus see that the average we have can be written for m odd as

exp(πimτ)[2θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ) ∑_{l=0}^{3} exp(\frac{πil(m + 3)}{4}+

6θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)(1 + exp(\frac{πi(m + 1)}{2}))+

6θ^{2} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, 4τ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)(exp(\frac{πi(m + 1)}{4}) + exp(\frac{3πi(m + 1)}{4})].

A little thought however will show the reader that what we are computing in this average in the variable x = exp(πiτ) is simply the power series expansion of θ^{3} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, τ) where only the terms with exponent congruent to 0 mod 8 appear. In other words the result of this averaging process yields

8 ∑_{n=0}^{∞} S_{3}(8n + 8 − m)x^{8n+8}.

As a consequence of the above computation we obtain Lemma 2. The result of the averaging process is as follows: For m=1 we obtain the identically zero power series. For m=3 we obtain

12exp(3πiτ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)[θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) − θ^{2} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, 4τ)].

For m=5 we obtain

8exp(5πiτ)θ^{3} [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)

and for m=7 we obtain

12exp(7πiτ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)[θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + θ^{2} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, 4τ)].

Proof. The proof is simply by substituting the value of m into the averaging process.

By the remark made prior to the statement of the lemma we have as a consequence many of the results obtained previously. We enumerate some of these. The case m=1 gives immediately that S_{3}(8n+7) = 0. The case m=5 yields immediately that S_{3}(8n+3) = T_{3}(n). The cases m=3,7 yield respectively

8 ∑_{n=0}^{∞} S_{3}(8n + 5)x^{8n+8} =

12exp(3πiτ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)[θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) − θ^{2} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, 4τ)]

and

8 ∑_{n=0}^{∞} S_{3}(8n + 1)x^{8n+8} =

12exp(7πiτ)θ [ \begin{matrix}1 \\ 0 \end{matrix} ] (0, 4τ)[θ^{2} [ \begin{matrix}0 \\ 0 \end{matrix} ] (0, 4τ) + θ^{2} [ \begin{matrix}0 \\ 1 \end{matrix} ] (0, 4τ)].

By analyzing these last two equations we can also see that we have the following formulas for S_{3}(n).

S_{3}(8n + 1) = 6 ∑_{k≥0} S_{2}(n − \frac{k^{2} + k}{2} )

a formula we already have obtained and

S_{3}(8n + 5) = 6 ∑_{k≥0} S_{2}(2(n − \frac{k^{2} + k}{2} ) + 1)

a new formula.

One can now do the same computation for the even values of m. We leave this for the reader.

References

[FK] H. M. Farkas and I. Kra, Theta Constants, Riemann Surfaces and the Modular Group,Graduate Studies in Mathematics, vol. 37, American Mathematical Society, 2001.

[G] E. Grosswald, Representation of Integers as Sums of Squares, Springer Verlag, New York 1985 .

[L] V. A. Lebesgue Questions 1059,1060,1061 (Lionnet), Nouv. Ann. Math. , pp. 516-519, 1872.

[M] S. Milne, Infinite Families of Exact Sums of Squares Formulas, Jacobi elliptic Functions, Continued Fractions, and Schur Functions, The Ramanujan Jopurnal, vol. 6, pp.7-149, 2002.

[R] M. S. Realis Scolies pour un Theoreme D’Arithmetique, Nouv. Ann. Math. pp. 212-217, 1873.