Cotangent sums, quantum modular forms, and the generalized Riemann hypothesis

We show that an asymptotic property of the determinants of certain matrices whose entries are finite sums of cotangents with rational arguments is equivalent to the GRH for odd Dirichlet characters. This is then connected to the existence of certain quantum modular forms related to Maass Eisenstein series.


Introduction and main results
To answer immediately a question that the reader may be asking, we should say from the outset that the generalized Riemann hypothesis (henceforth, just GRH) of the title refers only to the L-series associated to odd real Dirichlet characters and that we do not aim to prove it, but merely to show its equivalence to an asymptotic statement about the determinants of certain matrices whose entries c m,n are given by finite sums of cotangents of rational multiples of π. To answer a second natural question, since it may seem unusual for an author to contribute to the proceedings volume of a conference partly intended to celebrate his own birthday, we should also say a few words about the genesis of this joint paper. Both the definition of the cotangent sums considered and their relation to GRH were found by the first author and presented in his talk at the conference in question. In the course of that talk he mentioned the homogeneity property c m, n = c m,n , leading the second author to ask whether the function C : Q → R defined by C(m/n) = c m,n /n might be related to a quantum modular form in the sense of [16]. The answer to this question turned out to be positive. Furthermore, and unexpectedly, this quantum modular aspect turned out also to be related to the earlier joint work of the authors [13] on the analogues of classical period polynomials for Maass wave forms. A glance at the title of the final section of this paper will show why it seemed natural, and even irresistible, to publish both parts of the story in these proceedings.
We now describe the main results of the paper in more detail. We denote by χ(n) = (−1) (n−1)/2 if n is odd, 0 if n is even, the primitive Dirichlet character of conductor 4 and its associated L-series. (In Section 5 we will describe the generalization to other odd primitive real Dirichlet characters.) For positive integers m and n we define a real number c m,n by c m,n := 4 π j, k>0 where the conditionally convergent sum is to be interpreted as the limit for N → ∞ of the sum over the rectangle 1 ≤ j ≤ mN , 1 ≤ k ≤ nN . These numbers are studied in more detail in §2, where we will see that they are algebraic numbers (in fact, algebraic integers) that can be expressed as finite sums of cotangents of odd multiples of π/4m or π/4n, a typical example being which we will show later are positive definite, and define a function R : N → R by The first main result of this paper is then the following. The L-series L(s) has no zeros in the half-plane σ := (s) > 1 2 (GRH). The proof of this theorem will be given in §3. The direction (a) ⇒ (b) is fairly elementary, while the reverse direction uses functional analysis and techniques coming from old work of Beurling. The result that we actually prove (Theorem 3 in §3) is in fact stronger than Theorem 1 in both directions: if GRH holds, then R(N ) is not merely unbounded, but actually tends to infinity as N → ∞, and if L(s) has a zero ρ with (ρ) > 1 2 , then the function R(N ) is bounded by a number depending explicitly on ρ. Of course we believe that the two statements in Theorem 1 are both true rather than both false, the evidence being on the one hand the generally held belief in the validity of (b) and on the other hand the following plot of the function R(N ) for N ≤ 100000, which suggests that R(N ) tends to infinity and perhaps even grows roughly linearly with log N . (The straight-line fit shown in the picture is the graph of the function 5.18 log N .) On the other hand, by splitting the sums in (2) or (5) into two pieces depending on which of its two arguments realizes the "max" or "min", we obtain the decompositions where the function H : Q >0 → R and numbers h m,n ∈ R are defined by (Here and later an asterisk on a summation sign means that terms with equality-in this case, those with j = kx-are to be counted with multiplicity 1/2.) We will show in Section 2 that h m,n (or its sum with 1/2 if mn is odd) is a sum of cotangents of odd multiples of π/4n and hence is an algebraic integer, refining the corresponding properties for c m,n given above.
We can now come to the quantum modular form property mentioned in the opening paragraph. The graph of the function H on Q looks as follows:  This graph suggests that the function H is only naturally defined on Q and is not wellbehaved as a function on R, having a possibly dense set of discontinuities and certainly not differentiable at generic points. The graph of the function C shown in Figure 3, on the other hand, suggest that it is everywhere continuous and possibly even differentiable except at rational points with odd numerator and denominator, where it seems to be left and right differentiable but with a discontinuous derivative. Our second main result, proved in Section 4, refutes the last of these statements and confirms the others. Theorem 2. The function H(x) is discontinuous at all rational points x with odd numerator and denominator, and is continuous but not left or right differentiable at other rational points. The function C(x) is continuous everywhere, is not left or right differentiable at rational points with odd numerator and denominator, but is differentiable at all other rational points.
The similarity between the continuity and differentiability statements for the two functions H(x) and C(x) in this theorem is not coincidental, since we will see in Section 4 that the derivative of C(x) is equal to H(1/x).
We now discuss the "quantum modular form" aspect of Theorem 2. Note first that the function H is periodic of period 4 and hence extends to a periodic function on all of Q. This function is even, so we could also extend H from Q >0 to Q by H(x) := H(|x|). One might then think of extending C to negative values of the arguments by setting C(x) = H(x) + xH(1/x) for all x = 0, but if we did that then C(x) for x < 0 would exhibit oscillatory behavior of the same sort as H(x). Instead, we extend C to all of Q as an even function, i.e., we set C(x) = C(|x|) for x = 0 and extend this by continuity to C(0) = 0. Then the relationship between C and H becomes On the other hand, the 4-periodicity property of H(x) can be strengthened to the statement saying that up to sign and up to a constant H actually has period 2. Also, since H is even, we can replace the term H(1/x) in (8)  modulo 2 (this is the so-called "theta group," under which the Jacobi theta function ϑ(z) = n e πin 2 z transforms like a modular form of weight 1/2), so equations (8) and (9) can be combined to the following statement: Corollary. The function H : Q → R satisfies the transformation property is the homomorphism sending both generators 1 2 0 1 and 0 −1 This corollary tells us precisely that the function H is a quantum modular form in the sense of [16] (except that there is an absolute value sign here that was not present there). Recall that a "quantum modular form" is by definition a function on Q that does not extend nicely to R but which modulo (the restriction from R to Q of) better-behaved (here, continuous) functions on R transforms like a modular form with respect to some subgroup of finite index of SL(2, Z) (here the theta group Γ ϑ ) with some weight (here −1) and character (here ε). In Section 6 of this paper we will show that the quantum modularity property of H is related to an actual modular form (specifically, a Maass Eisenstein series of eigenvalue 1/4) on the group Γ ϑ .
The authors would like to thank Steven Johnson (MIT) and Alexander Weisse (MPI) for invaluable help with the numerical aspects of this paper.

2.
Properties of the numbers c m,n and h m,n In this section we give an integral representation for the numbers c m,n that will be used later both to extend the function C(x) continuously from Q to R and as the key to the proof in Section 3 of the relation between the numbers c m,n and the zeros of the Dirichlet L-series L(s). We will also prove the formulas for c m,n and h m,n as algebraic numbers (finite sums of cotangents).
The first step is to rewrite the definition of H given in (7) more compactly in the form where S(x) is the function defined on R >0 by The function S, like H itself, is periodic of period 4, and we can use this property to extend it to all of R. (Equivalently, we can extend it by S(−x) = S(x) and S(0) = 0, or by observing that the summation condition in (11) can be replaced by J < j ≤ x for any integer J < x divisible by 4, which works for all real x.) The function S is then the step function given by as pictured in Figure 4. Note that the sum in (10) converges (conditionally) for x ∈ Q by summation by parts, because the function χ(k)S(kx) is then an odd periodic function of k and hence has average value zero, so that the sums K k=1 χ(k)S(kx) are bounded. We use the bounded periodic function S to prove the following formula for the c m,n : The numbers c m,n defined by (2) have the integral representation Proof. From the definition of S we find and since the second sum is identically zero for N divisible by 4, equation (13) follows by letting N tend to infinity in 4Z. Our next result expresses c m,n as a finite sum of algebraic cotangent values indexed by lattice points in the rectangle [0, m/2] × [0, n/2] satisfying a certain "selection rule." Proposition 2. Let m and n be positive integers. Then the number defined by (2) is given as the following integral linear combination of cotangents of rational multiples of π: Corollary. The numbers c m,n are algebraic integers for all m, n > 0.
Using this proposition we can calculate any c m,n in closed form as an algebraic number. For example, the first 4 × 4 matrix of values (cf. equation (3)) is given by Proof. Since S(x) is even and periodic of period 4, we can use Euler's formula k∈Z (k+t) −2 = π 2 / sin 2 (πt) to rewrite the integral representation (13) as But from the definition of S(4mx) and S(4nx) as characteristic functions, it follows that the restriction of S(4mx)S(4nx) to [0, 1 2 ] is the characteristic function of the union of all intervals [a, b] with a < b as given in the proposition. This proves the proposition because π b a csc 2 (πx) dx = cot(πa) − cot(πb). The corollary then follows because by elementary algebraic number theory the number cot(πα) is an algebraic integer for every rational number α having an even denominator.
We next give the corresponding formula for the numbers h m,n , which is in fact simpler.
Proposition 3. Let m and n be positive integers. Then the number defined by (7) is given as the following half-integral linear combination of cotangents of odd multiples of π/4n: Proof. Since the summand in (10) is an even function of k, we can rewrite the sum as a sum over all non-zero integral values of k, and then use the periodicity (with period at most 4n) of the factor χ(k)S(km/n) together with Euler's formula n∈Z (x + n) −1 = π cot(πx) (with the sum being interpreted as a Cauchy principal value) to get as claimed.
Remark. One can also deduce the formula for c m,n in Proposition 2 from (14); this is left as an exercise to the reader. We also observe that the terms on the right-hand side of (14) (assuming, as we can, that m and n are coprime) are integral multiples of cotangents of odd multiples of π/4n, and hence are algebraic integers (in some cyclotomic field), except for the k = n term if m and n are odd, which is half-integral because then S(km/n) = 1 2 and cot(πk/4n) = 1. Hence h m,n is an algebraic integer unless both m and n are odd, in which case it equals an algebraic integer plus 1/2, and the sum c m,n = h m,n + h n,m is always an algebraic integer.

The connection with the generalized Riemann hypothesis
In the first subsection of this section we outline the basic strategy for proving Theorem 1. The easier direction (a) ⇒ (b) of this theorem is then proved in Subsection 3.2 and the more difficult converse direction in Subsection 3.3, using ideas from two classical papers by A. Beurling. As already stated in the introduction, we will actually prove the following stronger result: Theorem 3. Let L(s) be the L-series defined in (1) and R(N ) be the function defined in (4).
(a) If L(s) has no zeros with (s) > 1 2 , then R(N ) tends to infinity as N tends to infinity.
3.1. The square-wave function G and its multiplicative shifts. Set L 2 = L 2 (0, 1) and let ξ be the characteristic function of the interval (0, 1] and G : R >0 → R the function (and G(x) = 1/2 if 1/x is an odd integer, but we are working in L 2 ). Clearly both ξ and G belong to L 2 , since they are bounded with support in the interval (0, 1]. On the other hand, if we identify L 2 with the space of square-integrable functions on R >0 that vanish on (1, ∞), then we have bounded operators τ a on L 2 defined by We set G a = τ a G and for any D ⊆ R and N ∈ N define subspaces V D and V N of L 2 by where S denotes the linear span of a subset S of a linear space. Finally, we denote by The key connection is then given by the following proposition.
The proof of this, which is a straightforward computation, will be given in §3.2 below. On the other hand, a quite elementary argument, also given in §3.2, proves the following Together these two results prove statement (b) of Theorem 3. The harder statement (a) follows from the two following results, proved in §3.2 and §3.3 respectively.
The whole argument is summarized by the following diagram, where the flow of the double arrows shows that the six boxed statements are mutually equivalent.
Prop. 4 Prop. 6 trivial trivial (The implications labelled "Prop. 4" follow in one direction because each V N is contained in V Q and in the other because if R(N ) were bounded for some infinite sequence of integers {N i } then the set ∪ i V N i would be dense in V R but have a non-zero distance from ξ.)

3.2.
Proof of Propositions 4, 5 and 6. Recall from linear algebra that the distance Gram matrix with (m, n)-entry v m , v n (scalar product of the basis elements v m and v n ) and G the augmented (N + 1) × (N + 1) matrix obtained from G by adding a row and column with entries v, v n and a diagonal entry v, v . We apply this to the vector v = ξ ∈ L 2 and the space V N defined as above as the span of the vectors G n/N ∈ L 2 (n = 1, . . . , N ).
(Here we mean the real rather than the complex span, i.e., we work in the real Hilbert space of real-valued square-integrable functions on (0, 1).) We also denote by V N the span of V N and ξ. We will show in a moment that the vectors G n/N and ξ are linearly independent, so dim V N = dim V N + 1 = N + 1. We can then compute the entries of the Gram matrices as (the first is trivial and the second a special case of equation (21) below) and (25) and (5)). Proposition 4 follows.
To find the connection with the L-series L(s) and its complex zeros, we next consider the "complex monomial functions" p s on (0, 1] defined by Note the key fact that p s ∈ L 2 if and only if σ > 1 2 , and also that for f ∈ L 2 and σ > 1 (Here we are again identifying L 2 = L 2 (0, 1) with the space of functions L 2 (R >0 ) supported on (0, 1].) Then obviously and the Mellin transform of G a is almost equally easy to calculate using (12): the calculation being valid for all s in (s) > 0 since the integral then converges absolutely. One consequence of this is that the functions G a (0 < a ≤ 1) are all linearly independent, since if some (finite) linear combination of them vanished then the vanishing of its Mellin transform would imply that the product of L(s) with a finite Dirichlet series vanished identically (first for (s) > 0, and then for all s by analytic continuation). In particular, the space V N has dimension exactly N . In fact, almost the same argument also shows that the functions G a and ξ are linearly independent, since a linear relation among them would imply that the product of L(s) with a finite Dirichlet series was constant, which is obviously impossible. It follows that the extended space V N spanned by the functions G n/N (1 ≤ n ≤ N ) and ξ has dimension N + 1, as claimed above. The proof of the direction (a) ⇒ (b) of Theorem 1 now follows easily. If there exists ρ with Re (ρ) > 1 2 and L(ρ) = 0 then by (21) we have p ρ ⊥ V N for all N . Since V N is finitedimensional, the infimum in equation (18) is attained, so that R(N ) is unbounded (and hence d(ξ, V N ) has lim inf equal to 0) if and only if there is a sequence of functions h N ∈ V N converging in L 2 to ξ; and this would contradict This argument actually proves the stronger statement given in Proposition 5 and in part (b) of Theorem 3. Indeed, if ρ is a zero of L(s) with (ρ) > 1 2 , then on the one hand p ρ belongs to L 2 as already noted, with L 2 norm and on the other hand p ρ , f = 0 for any f ∈ V N by virtue of (21). We apply this to the function f = f N ∈ V N attaining the minimum distance to ξ. Then applying the Cauchy-Schwarz inequality to the scalar product p ρ , ξ − f N we get (using (20)) 1 and (15) now follows immediately from (19). Finally, we prove the Proposition 6 ("density lemma"). We first note that the L 2 norm G a − G b tends to 0 as a tends to b, since by the calculation G a , G b = aC(a/b) given above (for rational numbers, but true in general by the same argument) we have which tends to 0 as b → a because C(x) is a continuous function. It follows immediately that if D is dense in (0, 1) then the vector G a ∈ L 2 for any a < 1 lies in the closure of V D , and since V R is spanned by such vectors, this shows that V R = V D as claimed.
3.3. Proof of Proposition 7. It remains to show that GRH implies that V R = L 2 . Let H 2 = H 2 (R) denote the Hardy space of the right half-plane R = {s | (s) > 1 2 }, that is, the space of all holomorphic functions F (s) on R that are square-integrable on the lines (s) = c for all c > 1 2 and with these L 2 norms c bounded in c, and then equipped with the Hilbert space norm F = sup{ F c | c > 1 2 }. We quote some results from the standard analysis of these spaces, citing as we go the relevant sections in the books by Hoffman [11] and Garnett [8] for the details.
The Paley-Wiener theorem ( [11] pp. 131-132) gives the fact that the Mellin transform is (up to scalar multiple) an isometry between the spaces L 2 and H 2 . Applying this to the function G implies that its Mellin transform G(s) = L(s)/s lies in the space H 2 , a fact which is also easy to see directly from the definition of H 2 . Next, we note that if we assume that GRH holds, so that G(s) has no zeros in R, then the factorization theorem for functions in the space H 2 ( [11] pp. 132-133) applied to the function G(s) gives the implication L(s) has no zeros in σ > 1 2 =⇒ G(s) is an outer function.
Indeed, the factorization theorem represents any element F of H 2 as the product of a "Blaschke product," a "singular function," and an "outer function." Here we can omit the definitions of all three of these since the Blaschke product is defined as a product over the zeros of F in R and hence is equal to 1 if F has no such zeros, and the singular function factor is also constant because G(s) both continues across the line (s) = 1 2 and has slow rate of convergence to zero as s → ∞ on the positive reals (cf. 3.14 in [1] and Chapter II, Theorem 6.3, of [8]). This leaves only the outer function factor of G(s), and here we can apply a corollary of a theorem of Beurling on shift-invariant subspaces in H 2 ([4], [11] pp. 99-101), which tells us that a function F ∈ H 2 is outer if and only if the space It follows that GRH implies that W( G) is dense in H 2 . We can now apply the inverse Mellin transform from H 2 to L 2 to obtain the isometrically equivalent picture in L 2 . An easy calculation shows that s −1 f (s) is the Mellin transform of If for any f ∈ L 2 , where and hence that the space W( f ) is the Mellin transform of the space It is not actually obvious that I preserves the space L 2 , but this follows from the Paley-Wiener theorem together with the fact just shown that multiplication by s −1 preserves H 2 . A more direct argument is that the operator I is the adjoint A * of the averaging operator as is easily checked, and since A is a bounded operator on L 2 (0, ∞) (cf. [10], Example 5.4, p. 23), its adjoint I is also bounded on L 2 (0, ∞). But I also preserves the condition of having support in (0,1), so it is a bounded operator on L 2 . As a consequence the implication (22) translates on the L 2 side to the statement Proposition 7 is then obtained by applying to f = G the following lemma, in which V(f ) for any f ∈ L 2 denotes the span of the multiplicative translates τ a f (0 < a ≤ 1).
Proof. We first note that it suffices just to show that If ∈ V(f ) for all f ∈ L 2 , because then I n f ∈ V(f ) for all n ≥ 1 by induction and the remark that g ∈ V(f ) =⇒ V(g) ⊆ V(f ). Since (W ⊥ ) ⊥ = W for all subspaces W , we need to show that h, τ a f = 0 for all a ∈ (0, 1] =⇒ If, h = 0. But since aτ a −1 is the adjoint of τ a and A is the adjoint of I, this statement just says that any function that is orthogonal to all h(ax) with 0 < a ≤ 1 is also orthogonal to Ah, and this is obvious because Ah(x) = 1 0 h(ax) da .

Analytic properties of C(x) and H(x)
In this section we study the analytic properties of C(x) and H(x), discussing in particular the question of their extendability from Q to R (which we answer completely only in the case of C(x)) and describing the asymptotic properties in neighborhoods of rational points needed to establish Theorem 2 and its corollary (quantum modularity). We also discuss the relation of these two functions to the Dirichlet series L(s). It should be mentioned in passing that much of the material in this section is similar in spirit to the papers [2] and [3] of Bettin and Conrey, with χ replaced by the trivial character and L(s) by the Riemann zeta function.
4.1. Sum and integral representations of C(x) and H(x). Proposition 8 below gives a number of formulas for these two functions. However, the word "function" has a slighly different meaning in the two cases. We have already defined them both as functions on Q. Part (i) of the proposition says that C extends continuously to R, and parts (iv) and (v) give further properties of that function. But in the case of H we do not know to what extent it can be defined as a function on R (this question is discussed in Subsection 4.2, though not in great detail since this is not our main interest). However, it can certainly be defined as a distribution on R, in fact even as the derivative of a continuous function, since by integrating (10) we get the absolutely convergent sum representation for its integral, where A is the periodic continuous function on R defined by A(n+ ) = (−1) n for n ∈ Z and | | ≤ 1 2 . Parts (ii) and (iii) of the proposition are then to be interepreted in the sense of distributions, one giving the Fourier expansion of the even periodic distribution H and the other its relation, already mentioned in the introduction, with the derivative of C.

Proposition 8. (i)
The function C(x) extends continuously from Q to R via the formula (ii) The distribution H has the Fourier expansion where d(n) denotes the number of positive divisors of n.
(iii) The function C(x) and the distribution H(x) are related by the equation (iv) The function C(x) is also given by the sum where J(x) denotes the modified cosine integral (v) The Mellin transform of C(x) is given by where L(s) is the analytic continuation of the L-series defined in (1).
Proof. Formula (25) for x ∈ Q >0 is precisely the statement of Proposition 1 after an obvious change of variables, and the convergence and continuity of the integral for all x ∈ R >0 are easy consequences of the facts that S is supported on [1, ∞) and is locally constant and bounded. To prove (ii), we insert the (standard) Fourier expansion of the even periodic function S(x) into the sum (10), combine the double sum into a single one, and use Leibniz's formula L(1) = π/4. For (iii), we insert (11) into (25) to get from which equation (27) follows immediately by differentiating and using (10). (The easy justification of these steps in the sense of distributions by integrating against smooth test functions is left to the reader.) Finally, to prove (iv) we combine (27) and (6) to get and then insert the Fourier development (26) and integrate term-by-term. This gives (28) up to an additive term λx that can be eliminated by noting that C is bounded. Note that the sum in (28)  We can then use this to give a second derivation of (28), not making use of the distribution H, by first applying the Mellin inversion formula to write C(x) as an integral over a vertical line σ = c with −1 < c < 0 and then shifting the path of integration to the right, picking up the term π/8 in (28) from the residue at s = 0 and permitting us to use the convergent Dirichlet series representation L(s) 2 = ∞ n=1 χ(n)d(n)n −s for σ > 1. (We omit the details of this calculation.)

4.2.
The function H on the real line. In this subsection we give two one-parameter generalizations of H(x) and discuss possible ways to define this function at irrational arguments.
We first generalize the definitions of H(x) and C(x) and the assertions of Proposition 8 to families depending on a complex parameter s. Specifically, we can generalize (10) to which now converges absolutely. The same calculation as for H(x) then gives the Fourier expansion where L(s) is the Dirichlet L-function defined in (1) and σ ν is the sum-of-divisors function σ ν (n) = k|n,k>0 k ν . Similarly, we define C s (x) = x s C s (1/x) for all s ∈ C with σ > 0 by where the equality of the two expressions is proved by the same calculation as for the proof of (25). Then C s (x) and H s (x) are related by by the same calculations as in the special case s = 1 and one has an expansion like (28) but with J(x) replaced by − ∞ x t −s−1 cos(t) dt. As long as σ > 1 all of the sums and integrals involved are absolutely convergent and all steps are justified.
A different possible way to regularize H(x) for x ∈ R is to define Using the identity n>0 d(n) n x n = k>0 1 k log 1 1 − x k and standard trigonometric identities, we find after a short calculation that Both this series and the original one defining T converge exponentially fast for any positive ε, giving us another possible approach to the analytic properties of the limiting function H. Summarizing this discussion, we have at least five potential definitions of H(x) for x ∈ R: Definition 1: Define H(x) by the series (10), if this sum converges. Definition 2: Define H(x) by the Fourier series (26), if this series converges. Definition 3: Define H(x) as the limit for s 1 of the series (33), if this limit exists. Definition 4: Define H(x) as the limit in (36), if this limit exists. Definition 5: Define H(x) as the limit of H(x ) as x ∈ Q tends to x, if this limit exists. We can then ask-but have not been able to answer-the question whether any or all of these definitions converge for irrational values of x or, if they do, whether they give the same value. The last definition is in the sense the strongest one, since any definition of H on R or a subset of R that agrees with the original definition on Q must coincide with the value in Definition 5 at any argument x at which this function is continuous. In any case, we pose the explicit question: Question: Are the five definitions given above convergent and equal to one another for all irrational values of x, or for all x belonging to some explicit set of measure 1 ? It seems reasonable to expect the answer to the second question to be affirmative with the set of measure 1 being the complement of some set of irrational numbers having extremely good rational approximations, like the well-known "Brjuno numbers" in dynamics.

4.3.
Asymptotic behavior of H(x) and C(x) near rational points. The results of Section 4.1 prove the continuity of C(x), which is part of the statement of Theorem 2 in the Introduction. We now discuss the remaining statements there, concerning the behavior of C and H near rational points.
We begin by looking numerically at the asymptotic properties of C(x) near x = 1. Computing the values of C 1± 1 n for 1 ≤ n ≤ 1000 and using a numerical interpolation technique that is explained elsewhere (see e.g. [9]), we find empirically an expansion of the form with the first few coefficients having numerical values given by These numerics become clearer if we work with H(x) instead, where we find the simpler expansion with no odd powers of 1/n and with coefficients given numerically by which then gives the expansion (37) with c ± , and more generally c r = (−1)r 0<i<r/2 r−1 2i−1 h 2i for r > 1. Moreover, on calculating the next few values of h 2i numerically to high precision we are able to guess the closed formulas for the coefficients in (38), where γ is Euler's constant and B n the nth Bernoulli number. In fact, it is not difficult to prove (38) (and hence also (37)) with these values of h i by applying a twisted Euler-Maclaurin formula (giving the asymptotics as ε → 0 of sums over an interval of χ(n)f (nε) for a smooth function f ) to the closed formula which follows easily from (14), though we will not carry this out here.
The "log n" terms in equations (37) and (38) already show that C(x) is not differentiable at x = 1 and H(x) is not continuous at x = 1, but from these formulas one might imagine that the functions C(x) − |x − 1| log(|x − 1|)/4 and H(x) − log(|x − 1|)/4 are C ∞ to both the right and the left of this point. However, this is not the case, because both equations (37) and (38) are valid only when n is an integer and change in other cases. For instance, if n tends to infinity in N + 1 2 rather than N, then H(1 ± 1/n) has an expansion of the same form as (38) and with the same constants h ± 0 , but with h 2 = π 2 /576 replaced by −7π 2 /1152, h 4 = −49π 4 /1382400 replaced by 127π 4 /2764800, etc.) This statement, which again can be proved using an appropriate twisted version of the Euler-Maclaurin formula, is a typical phenomenon of quantum modular forms.
If we look at the asymptotics of C(x) and H(x) as x tends to any rational number α with odd numerator and denominator, then we find a similar behavior, which is not surprising since any such α is Γ ϑ -equivalent to 1 and both H and C have transformation properties, modulo functions with better smoothness properties, under the action of Γ ϑ . More precisely, if we write α = a/c with a and c > 0 odd and coprime and complete a c to a matrix a b c d ∈ SL(2, Z), then we find asymptotic expansions as n → ±∞ with n ∈ Z, and similar expansions with other coefficients h ± i,α,β and c ± i,α,β if n → ±∞ with n ∈ Z + β for some fixed rational number β.
Similar statements hold for x tending to rational numbers α with an even numerator or denominator, but now without the log term, the simplest case being where A k is the number of "up-down" permutations of {1, . . . , k} (permutations π where π(i) − π(i − 1) has sign (−1) i for all i), which is also equal to the coefficient of x k /k! in tan x + sec x. (Note that A k−1 = (4 k − 2 k )|B k |/k for k even, so that the coefficients here are closely related to those in (39).) The difference between the two cases is due to the fact that the action of Γ ϑ on P 1 (Q) has two orbits (cusps), and comes from the relation that we will see in the final section between the quantum modularity properties of C and H and a specific Maass modular form on Γ ϑ that is exponentially small at the cusp ∞ but has logarithmic growth at the cusp 1 .

Generalization to other odd Dirichlet characters
In this section we discuss the changes that are needed when the character defined in (1) is replaced by an arbitrary odd primitive Dirichlet character. Suppose that D < 0 is the discriminant of an imaginary quadratic field K (or equivalently, that D is either square-free and congruent to 1 mod 4 or else equal to 4 times a square-free number not congruent to 1 mod 4), and let χ = χ D = D · be the associated Dirichlet character, the case studied up to now corresponding to K = Q(i) and D = −4. The Dirichlet L-series L(s, χ) is defined as n>0 χ(n)n −s for σ > 1 and by analytic continuation otherwise, and is equal to the quotient of the Dedekind zeta function of K by the Riemann zeta function. Its value at s = 1 is well-known to be non-zero and given by where h (D) is 1/3 or 1/2 if D = −3 or D = −4 and otherwise is the class number of K. We now define S(x) by the same formula (11) as before, with χ = χ D . It is still periodic (with period |D|) and even and hence bounded, but now has average value h (D) rather than 1/2 and also no longer takes on only the values 0 and 1, as one sees in the two following pictures of the graphs of this function for D = −3 and D = −7. We define H(x) = H D (x) and C(x) = C D (x) for x ∈ Q by the same formulas (10) and (8) as before, but we define h m,n and c m,n by (7) and (5) with a factor |D|/π instead of 4/π in order to get integral linear combinations of cotangents. The Fourier expansions (31) and (26) are then replaced by and the formula corresponding to (14) now reads h m,n = 0<k<|D|n/2 by the same calculations as before. Finally we also define the matrices C N and C N exactly as we did in the special case D = −4 (except for replacing the lower right-hand entry in C N in (3) by |D|N/π), and then from the scalar product calculations which are proved exactly as before, we deduce the same connection as in Theorems 1 and 3 between the unboundedness of the function R(N ) and the Riemann hypothesis for L(s, χ). The only real difference with the case D = −4 is in the argument for quantum modularity. The function H(x) on Q is still even and periodic of period |D| (and also anti-periodic up to a constant with period |D|/2 if D is even), it again has discontinuities at infinitely many rational points by an argument similar to the one given in 4.3, and by the analog of Proposition 8 the function C : Q → R again has a continuous extension to R and is therefore much better behaved analytically than H(x), as illustrated by the following graphs of these functions for D = −3, which look qualitatively much like their D = −4 counterparts in Figures 2 and 3. The difference is that this longer suffices to prove the quantum modularity of H because the subgroup of SL(2, Z) generated by the matrices T |D| (or T |D|/2 if D is even) and S now no longer has finite index. Instead, we need a statement like the corollary to Theorem 2 with Γ ϑ replaced by the congruence subgroup Γ (D) = Γ 0 (D) ∪ SΓ 0 (D) of SL(2, Z) (or by Γ (D/2) if D is even, which is indeed Γ ϑ if D = −4). This statement is given in the following theorem.
Theorem 4. Let D < 0 and H(x) = k>0 χ D (k)S D (kx)/k be as above. Then the function This theorem is illustrated for D = −3 and a typical element of Γ (−3) in the following figure.
We will deduce Theorem 4 as a consequence of the following proposition, which is a generalization to arbitrary elements γ ∈ Γ (D) of equation (32) for D = −4 and γ = S.
To see that this implies the continuity, we note that we can rewrite the right-hand side by interchanging the summation and integration in the form (generalizing (25)) for x ≷ −d/c. The right-hand side of this formula is continuous because S(t) is piecewise continuous and bounded and has support in |t| ≥ 1, while the second factor of the integrand is piecewise continuous and bounded by a constant times t −2 , as one sees easily by partial summation. Another argument is that (44) is equivalent to the equality of distributions (generalizing (27)) and we already know that the distribution H is locally the derivative of a continuous function. For the proof of (44) we will restrict to the case when the matrix γ belongs to Γ(D), which is sufficient for the proof of Theorem 4 because γ → C γ is a cocycle and we already know the continuity of C γ (= C) for the special case γ = S representing the non-trivial coset of Γ(D) in Γ (D) . To avoid distracting case distinctions, we consider only the case x + d/c < 0 and γx > 0. The argument is the same in principle in all other cases, but we are actually working with ordered tuples of points on the 1-manifold P 1 (R), on which the group Γ (D) acts in an orientation-preserving way, and it is notationally simpler to fix the positions of the points occurring with respect to the point at infinity, so that we can work on R instead. We may also assume (by replacing γ by −γ if necessary, but then remembering that γ may be congruent to −1 2 rather than 1 2 modulo D) that c > 0. Finally, to be able to work with absolutely convergent sums and to reorder the terms freely, we will replace H(x) by the function H s (x) (s > 1) introduced in Section 4.2 and C γ by the corresponding cocycle and only set s = 1 at the end. The equation we have to prove then becomes We denote the last term (without the minus sign) by A. Since the variable t in the integral is always positive (because we are considering the case γx > 0), we can replace S(t) by its definition (11) and interchange the summation and integration to getf In the second sum we replace the vector j k by the vector −γ j k = −aj − bk −cj − dk . This does not change the product χ(j)χ(k) because γ is congruent to plus or minus the identity modulo the period |D| of χ, changes the expression cj − ak in the denominator to k, and changes the inequalities k > 0, j ≥ kγx to kx ≤ j < −kd/c (which imply k > 0). Hence completing the proof of equation (48) and hence of the proposition and theorem.

Modular forms are everywhere
As one can already see from the examples in the original article [16] where this notion was introduced, quantum modular forms are sometimes related to actual modular forms. These modular forms may be either holomorphic or Maass forms, with the quantum modular form in the latter case being related to the "periods" of Maass forms in the sense developed in [13] and [7]. The quantum modular form H(x) that we have been studying in this paper turns out to be of this latter type, with the associated Maass form being an Eisenstein series with eigenvalue 1/4 for the hyperbolic Laplace operator. In this final section we explain how this works, first for the case D = −4 studied in the first four sections of this paper. In that case the relevant modular group Γ ϑ is generated by a translation and an inversion, so that for both the period theory of the Maass form u and the quantum modularity of H one needs only the functional equation of the associated L-series. Then at the end we indicate how the quantum modularity of H for general D follows from the full theory of periods of Maass forms.
We start with the case D = −4, so that χ is the character given by (1). The relevant modular form here is the Maass Eisenstein series where H denotes the upper half-plane and K 0 the usual K-Bessel function of order 0. This is an eigenfunction with eigenvalue 1/4 with respect to the hyperbolic Laplace operator ∆ = −y 2 ∂ 2 ∂x 2 + ∂ 2 ∂y 2 and is a modular function with character ε for the group Γ ϑ defined in Section 1, meaning that u(γz) = ε(γ)u(z) for all γ ∈ Γ ϑ or, more explicitly, that To see this, we observe that u(z) is proportional to E z+1 4 , 1 2 −E z−1 4 , 1 2 , where E(z, s) is the usual non-holomorphic Eisenstein series of weight 0 and eigenvalue s(1 − s) for the Laplace operator with respect to the full modular group Γ 1 = SL(2, Z). (This follows easily from the well-known Fourier expansion of E(z, 1 2 ) as a linear combination of the three functions √ y, √ y log y, and √ y n =0 d(n)K 0 (2π|n|y)e 2πinx .) The transformation equations (50) then follow from the SL(2, Z)-invariance of E(z, 1 2 ), the first one trivially since E(z+1, s) = E(z, s) and the second by using the invariance of E(z, s) under 1 0 ∓4 1 to get We now associate to u(z) the periodic holomorphic function f on C R = H + ∪ H − (where H ± = {z ∈ C | ± (z) > 0}) having the same Fourier coefficients as u, i.e., Proposition 10. The period function ψ(z) defined by extends holomorphically from C R to C = C (−∞, 0] . Proof. We follow the proof of the corresponding result given in Chapter 1 of [13] for Maass cusp forms on the full modular group Γ 1 . (See Theorem on p. 202 of [13], which also gives a converse statement characterizing cusp forms in terms of holomorphic functions ψ on C satisfying a certain functional equation.) That proof required only the functional equation of the L-series associated to the Maass cusp form, which worked because the group Γ 1 is generated by the translation T and the inversion S, and can be applied here because Γ ϑ = S, T 2 has a similar structure. Our situation is also a little different because our function u(z) is an Eisenstein series rather than a cusp form, but since the Fourier expansion (49) of u(z) at infinity has no constant term this has no effect on the proof. The argument in [13] was first to write the L-series of the Maass form u(z) as the Mellin transform of the restriction of u (or of its normal derivative in the case of an odd cusp form) to the imaginary axis, multiplied by a suitable gamma factor, and to deduce from this relationship and the S-invariance of u a functional equation for the L-series. One then observed that the Mellin transforms of the restrictions to the positive or negative imaginary axis of both the associated periodic holomorphic function f and the associated period function ψ were also equal, up to different gamma factors, to the same L-series, and the functional equation of this L-series combined with Mellin inversion then led to a formula for ψ that applied in all C rather than just on C R. Here the first step, which would require the normal derivative since the restriction of the function (49) to iR + vanishes, can be skipped since the L-series L(u; s) = χ(n)d(n)n −s is simply the square of the Dirichlet L-series (1) and hence has a known functional equation. The Mellin transforms of the restrictions to f and ψ to the positive or negative imaginary axis are then given by for any c ∈ (0, 1), and analytic continuation from iR {0} to C R then gives the formula ψ(z) = 1 2πi (s)=c Γ(s) L(s) 2 (π/2) s cos(πs/2) z −s ds for all z ∈ C R . But the factor in square brackets is bounded by a power of s times e −π|s| for |s| → ∞ on the vertical line c + iR, so the integral on the right-hand side of this equation is absolutely convergent for all z ∈ C with | arg(z)| < π, i.e., for all z ∈ C . We now show how to connect the functions f (z) and ψ(z) to the functions H(x) and C(x), respectively, and to deduce the continuity of C -and hence the quantum modularity of H -generalize Proposition 10 to the statement that for any matrix γ = a b c d ∈ Γ (D) the function ψ γ (z) = f (z) − ε(γ) cz + d f az + b cz + d extends holomorphically from C R to C (−∞, −d/c] if c > 0 or C [−d/c, ∞) if c < 0. This statement can be proved in several ways and can be linked by a discussion similar to the one above to the continuity property of C γ (x) stated in Theorem 4. But the simplest approach is to relate the functions C γ (x) directly to the invariant distribution associated to u in the sense developed in [12], [13] and [7]. Specifically, this theory says that an eigenfunction u of ∆ with spectral parameter s and Fourier expansion u(x + iy) = √ y n =0 A n K s−1/2 (λ|n|y)e iλnx is invariant (possibly with character) under the action of a Fuchsian group Γ if and only if the associated distribution U (x) = n =0 |n| s−1/2 A n e iλnx on P 1 (R) is invariant (with the same character) with respect to the group action (U |γ)(x) = |cx + d| −2s U (γx) for γ = a b c d ∈ Γ. (Here the word "distribution" must be interpreted correctly, namely, as a functional on the space of test functions φ(x) that are smooth on R and for which |x| −2s φ(1/x) is smooth near x = 0.) In our case the distribution U associated to u is given by U (x) = ∞ n=1 χ(n)d(n) sin(2πnx/|D|) and is related to the distribution (41) by U (x) . = H (x). But that means that if we differentiate the definition (43) of C γ (x) to get then the first two terms on the right cancel and we recover equation (46).