Skip to main content
Proceedings of the National Academy of Sciences of the United States of America logoLink to Proceedings of the National Academy of Sciences of the United States of America
. 2019 Sep 9;116(39):19374–19379. doi: 10.1073/pnas.1906632116

Interesting identities involving weighted representations of integers as sums of arbitrarily many squares

Min-Joo Jang a,1, Ben Kane a,1,2, Winfried Kohnen b,1, Siu Hang Man c,1
PMCID: PMC6765249  PMID: 31501318

Significance

There are many links between the areas of combinatorics (counting problems), number theory, and complex analysis. We apply a technique to study combinatorial problems via product formulas for their generating functions. We apply these to a certain class of functions for which the product formulas are particularly nice, but the approach may be applied to the study of other combinatorial problems whose generating functions are modular forms, and we believe that these may lead to a number of interesting identities in the future.

Keywords: representations of integers, weighted representations, polygonal numbers, Jacobi triple product identity, modular forms

Abstract

We consider the number of ways to write an integer as a sum of squares, a problem with a long history going back at least to Fermat. The previous studies in this area generally fix the number of squares which may occur and then either use algebraic techniques or connect these to coefficients of certain complex analytic functions with many symmetries known as modular forms, from which one may use techniques in complex and real analysis to study these numbers. In this paper, we consider sums with arbitrarily many squares, but give a certain natural weighting to each representation. Although there are a very large number of such representations of each integer, we see that the weighting induces massive cancellation, and we furthermore prove that these weighted sums are again coefficients of modular forms, giving precise formulas for them in terms of sums of divisors of the integer being represented.

1. Introduction and Statement of Results

There are many papers involving representations of integers as sums of a fixed number of squares and their relations with modular forms. In this paper, we consider representations of integers as the sum of arbitrarily many squares and relate this to quasimodular forms by weighting the representations in a certain way. To state the result, for a positive integer n, let re(n) [respectively (resp.), ro(n)] denote the number of ways to write n as the sum of an even (resp., odd) number of nonzero squares [taking re(0)1 and ro(0)0 by convention because we include empty representations of n=0 in our count throughout the paper]. We next see that the difference of these—namely, reo(n)re(n)ro(n)—has an interesting relationship with certain sums of divisor functions which naturally arise as Fourier coefficients of weight two (quasi-)modular forms.

Theorem 1

For every nN, we have

mZm2reonm2=dndcd,

where

cn=2ifn1(mod2),3ifn2(mod4),1ifn0(mod4).

Equivalently, writing n=2tn with 2n, we have

mZm2reo(nm2)=26δt>0dnd4dn4d.

Remark:

Enumerating the representations of n as a sum of arbitrarily many squares in the shape (for some 0 and mjZ)

n=m2+j=1mj2,

one can interpret the sum occurring on the left-hand side of Theorem 1 as a sum over all such representations weighted by (1)m2, where m2 is a “distinguished” square occurring in the representation (note that every distinct mj2 plays the role of the “distinguished” square as we run through all m).

The phenomenon observed in Theorem 1 is not an isolated one. A similar result holds for representations of n as a sum of arbitrarily many triangular numbers. Let te,+(n) (resp., to,+(n) denote the number of representations of n as a sum

n=j=1Txj,

with even (resp., odd) where Txx(x+1)2, with xN, denotes the x-th triangular number; throughout this paper, we assume for triangular numbers that xN in order to remove ambiguity in the representations coming from the fact that T1=T0=0. Analogously to the case of squares, we set teo,+(n)te,+(n)to,+(n) to be the excess of the number of such representations with an even number of triangular numbers. Here and throughout, we use “+” in a superscript to indicate that we only take elements in N instead of Z\{0}.

Theorem 2

For every nN, we have

m0(2m+1)28teo,+nTm=dn(1)d+1d.

Moreover, the phenomenon is not restricted to squares or triangular numbers, but occurs for arbitrary representations of integers as sums of generalized polygonal numbers. For kN and mZ, let

pk(m)(k2)m2(k4)m2,

be the m-th generalized k-gonal number. Following the definitions in the previous 2 cases, we define Pkeo(n)Pke(n)Pko(n) with Pke(n) (Pko(n), resp.) being the number of ways to write n as a sum of an even (odd, resp.) number of nonzero generalized k-gonal numbers.

Theorem 3

For k>4, we have

mZpk(m)+(k4)28(k2)Pkeonpk(m)=dnded,

where

en=1ifn±(k3)(modk2).1ifn0,(k2),±2(k3)(mod2(k2)).0otherwise.

Remark:

Although the formulas in Theorem 3 do not hold for k=4 and k=3, it is worth noting that one can interpret the formulas in Theorems 1, 2, and 3 uniformly by counting the instances of the congruences occurring in Theorem 3 with multiplicity.

By completing the square, one may interpret the statements in Theorems 1, 2, and 3 as statements about representations of integers as sums of squares with certain congruence conditions. Indeed, these formulas hold for representations of integers as sums of squares with arbitrary congruence conditions. Define rh,Ne(n) (resp., rh,No(n)) for NN and hZ satisfying |h|<N2 by

#(s1,s2,,s)Z\{0},even(resp. odd)j=1sj2N2+2sjhN=n. [1]

We then denote rh,Neo(n)rh,Ne(n)rh,No(n) as before.

Theorem 4

Suppose N±2h and h0. We have

mh(modN)m2rh,Neonm2+h2=dnded,

where

en=1ifn±(N2+2hN)(mod2N2),1ifn0,2N2,±(2N2+4hN)(mod4N2).0otherwise.

We write mh(modN), mh(modN), and mh(modN)+ to mean the sums over the underlying sets mZ, mZ\{h}, and mN, respectively.

Remark:

In the case N=±2h, a modified version of Theorem 4 (see the proof of Theorem 2) holds where rh,Neo(n) is replaced with rh,Neo,+(n), where as in the definition of teo,+(n), the + indicates that we only take sjN in the definition Eq. 1. For h=0, one may consider Theorem 4 to hold if one interprets n2N2(mod4N2) to occur with multiplicity 3 and nN2(mod2N2) to occur with multiplicity 2 in the congruences in the definition of en.

The proofs of the above theorems make use of product formulas for the unary theta functions (writing qe2πiτ)

𝜗h,N(τ)nh(modN)qn2.

Indeed, the cn appearing in Theorem 1 are closely related to the well-known identity

θ(τ)=n11q2n51q4n21qn2=n1(1qn)cn,

for the standard theta function

θ(τ)nZqn2.

Product formulas such as these naturally appeared in work of Bruinier, Kohnen, and Ono (1) while investigating divisors of modular forms. A detailed investigation of these product formulas was then carried by Kohnen and Mason (2). Mason and W.K. obtained a recursive identity involving multinomial coefficients and the Fourier coefficients of the original modular form. Namely,

cn=2a(n)ν1+2ν2++(n1)νn1=nν1,ν2,,νn10(1)ν1+ν2++νn1c1ν1c2ν2cn1νn1,

where a(n) is the n-th Fourier coefficient. It would be interesting to see if one can use the representation from ref. 2 in order to directly prove the identities, such as the one in Theorem 1. Conversely, it may be interesting to further investigate whether the 2 different representations yield new identities between different combinatorial objects.

Theorem 1 implies that the sum giving cn in ref. 2 exhibits massive cancellation, as one can see that there are exponentially many terms (as a function of n) in the sum, but the value is a constant depending only on n modulo 4. This cancellation is very delicate and relies on the fact that the theta functions 𝜗h,N do not vanish in the upper half-plane. Even slightly modifying the theta function will yield a function for which the series defining cn does not exhibit this behavior. One such family of functions occurs by twisting the coefficients by a character χ, defining

θχ(τ)nZχ(n)qn2.

However, Lemke Oliver (3) proved that there are only finitely many characters χ for which θχ may be written as an η-quotient.

Since this cancellation is governed by the fact that 𝜗h,N vanishes only at the cusps (i.e., it does not have a root in the upper half-plane), from this perspective, it is natural to wonder whether one can directly prove that 𝜗h,N only vanishes at the cusps. An amusing calculation involving the full modularity properties of 𝜗h,N as given in ref. 4 together with the valence formula and a careful evaluation of the resulting Gauss sums leads to such a proof (at least in the case when N is the power of an odd prime).

2. Proof of the Theorems

Theorems 1, 2, 3, and 4 are all essentially corollaries of one proposition. To state the proposition, for a given h,N with |h|N2, we define an=an(h,N) as follows. If h0 and N±2h, then we have

anen=1ifn±(N2+2hN)(mod2N2),1ifn0,2N2,±(2N2+4hN)(mod4N2).0otherwise. [2]

Similarly, for h=0

ancn=2ifnN2(mod2N2),3ifn2N2(mod4N2),1ifn0(mod4N2),0otherwise, [3]

while for N=±2h

anfn=1ifn8h2(mod16h2),1ifn0(mod16h2),0otherwise. [4]

Proposition 5

Let h,N be given with |h|N2.

  • i)

    If |h|<N2, then we have

mh(modN)m2rh,Neonm2+h2=dndad. [5]
  • i)

    If N=±2h, then we have

+mh(modN)m2rh,Neo,+nm2+h2=dndad. [6]

Proof:

Applying the Jacobi triple-product identity gives that

𝜗h,N(τ)=qh2n11+q(2n1)N2+2hN1+q(2n1)N22hN1q2nN2=1+δN=±2hqh2n1(1qn)an. [7]

Taking the logarithmic derivative of Eq. 7, we obtain

12πi𝜗h,N(τ)𝜗h,N(τ)=h2+n1nanqn1qn=h2+n1m1nanqmn=h2+n1dndadqn. [8]

1) Under the assumption that |h|<N2, we write

𝜗h,N(τ)=qh211qh2𝜗h,N(τ)=qh21nh(modN)qn2h2,

and note that

12πi𝜗h,N(τ)=nh(modN)n2qn2.
12πi𝜗h,N(τ)𝜗h,N(τ)=qh22πi𝜗h,N(τ)1(1qh2𝜗h,N(τ))=qh2nh(modN)n2qn20nh(modN)qn2h2=qh2nh(modN)n2qn2m00(1)r~h,N,m+h2qm, [9]

where

r~h,N,(m+h2)#(k1,k2,,k)NZ\{0}+hj=1kj2=m+h2. [10]

Writing kj=sjN+h with sjZ\{0} yields that

j=1kj2=m+h2j=1sj2N2+2sjhN=m.

Therefore, with notation as above, we may write Eq. 9 as

12πi𝜗h,N(τ)𝜗h,N(τ)=n0mh(modN)m2rh,Neonm2+h2qn. [11]

Comparing Fourier coefficients of Eq. 8 with Eq. 11, we obtain Eq. 5.2) When N=±2h, we note that h and h are both minimal elements in terms of absolute value in nh(modN). It is hence natural to quotient out by the symmetry, and we modify the definition of r~h,N, in this case by defining r~h,N,+(m+h2) to be the number of elements in Eq. 10 with kjNN+h for every 1j. To factor out by the symmetry, we rewrite 𝜗h,2|h|(τ) as

𝜗h,2|h|(τ)=nh(mod2|h|)qn2=2+nh(mod2|h|)qn2=2+noddqh2n2,

and, expanding the geometric series after accounting for the 2 minimal elements,

12πi𝜗h,2|h|(τ)𝜗h,2|h|(τ)=qh24πi𝜗h,N(τ)11qh2𝜗h,N(τ)2=qh2+noddn2qh2n2m00(1)r~h,2|h|,+m+h2qm=qh2+noddn2qh2n2m0rh,2|h|eo,+mqm=n0m0h2(2m+1)2rh,2|h|eo,+n4h2(m2+m)qn. [12]

Comparing Fourier coefficients of Eq. 12 with Eq. 8 together with Eq. 4 yields Eq. 6.

Theorem 4 now follows immediately from Proposition 5 (1).

Proof of Theorem 4:

When h0 and N±2h, plugging Eq. 2 into Eq. 5 yields Theorem 4.

We next move on to the special case of sums of k-gonal numbers in Theorems 1, 2, and 3, which are essentially nice ways to rewrite Proposition 5. We begin with the general case.

Proof of Theorem 3:

Setting N=2(k2),h=4k and n8(k2)n in Eq. 5 and noting that

r4k,2(k2)eo(8(k2)n)=Pkeo(n),

we have

m4k(mod2(k2))m2r4k,2(k2)eo8(k2)nm2+(k4)2=mZ8(k2)pk(m)+(k4)28(k2)Pkeonpk(m)=d8(k2)nded, [13]

where

en=1ifn±8(k2)(k3)(mod8(k2)2),1ifn0,8(k2)2,±16(k2)(k3)(mod16(k2)2),0otherwise.

Notice that en=0 unless 8(k2)n. Making the change of variables d8(k2)d in Eq. 13 and dividing both sides by 8(k2), we complete the proof of Theorem 3.

The h=0 case of Proposition 5 (1) corresponds to the case of squares.

Proof of Theorem 1:

For h=0, we rewrite Eq. 5 using Eq. 3 as

mNZm2r0,Neonm2=dndcd.

Replacing n by N2n, and noting that

r0,Neo(N2n)=reo(n),

we obtain

mZN2m2r0,NeoN2nN2m2=mZN2m2reonm2=dN2ndcd.

Moreover, since cd=0 if N2d, the sum on the right-hand side equals

dN2ndcd=dnN2dcd,

where

cn=2ifnodd,3ifn2(mod4),1if4n.

Dividing both sides by N2 gives Theorem 1.

Finally, we obtain the claim for sums of triangular numbers by using Proposition 5 (2).

Proof of Theorem 2:

Note that

rh,2|h|eo,+(8h2n4h2(m2+m))=r1,2eo,+(8n4(m2+m))=teo,+nTm.

Using this and replacing n by 8h2n in Eq. 6 yields that

m0h2(2m+1)2teo,+nTm=d8h2ndfd=dn8h2dfd,

where

fn=1ifnodd,1ifneven.

The last equality is valid because fd=0 unless 8h2d. Dividing both sides by 8h2, we have

m0(2m+1)28teo,+nTm=dndfd=dn(1)d+1d,

as claimed in Theorem 2.

Acknowledgments

We thank the anonymous referee for their careful reading and helpful comments on the earlier version of this paper. B.K. was supported by Research Grants Council of the Hong Kong SAR, China Projects HKU 17302515, 17316416, 17301317, and 17303618.

Footnotes

The authors declare no conflict of interest.

This article is a PNAS Direct Submission.

References

  • 1.Bruinier J. H., Kohnen W., Ono K., The arithmetic of the values of modular functions and the divisors of modular forms. Compos. Math. 140, 552–566 (2004). [Google Scholar]
  • 2.Kohnen W., Mason G., On generalized modular forms and their applications. Nagoya Math. J. 192, 119–136 (2008). [Google Scholar]
  • 3.Oliver R. J. L., Eta-quotients and theta functions. Adv. Math. 241, 1–17 (2013). [Google Scholar]
  • 4.Shimura G., On modular forms of half integral weight. Ann. Math. 97, 440–481 (1973). [Google Scholar]

Articles from Proceedings of the National Academy of Sciences of the United States of America are provided here courtesy of National Academy of Sciences

RESOURCES