1 Introduction

Moments of L-functions are a central topic in analytic number theory, not only due to their many important applications, but also because they give insight into the behaviour of L-functions in the critical strip.

One of the most famous and best-studied examples in this regard is the fourth moment of the Riemann zeta function

$$\begin{aligned} \int _1^T \! \left| \zeta \left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^4 \, \mathrm {d}t. \end{aligned}$$
(1.1)

The first asymptotic formula for (1.1) goes back to Ingham [22], who proved that

$$\begin{aligned} \int _1^T \! \left| \zeta \left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^4 \, \mathrm {d}t = \frac{1}{2 \pi ^2} T (\log T)^4 + O\left( T (\log T)^3 \right) . \end{aligned}$$

It was not until several decades later that Heath-Brown [18] was able to improve on this estimate. His result, which marked a major advance in the subject, states that

$$\begin{aligned} \int _1^T \! \left| \zeta \left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^4 \, \mathrm {d}t = T P(\log T) + O\left( T^{\frac{7}{8} + \varepsilon } \right) , \end{aligned}$$
(1.2)

where P is a certain polynomial of degree 4. Further progress came with the development of methods originating in the spectral theory of automorphic forms, in particular the Kuznetsov formula [32]. Zavorotnyi [49] was thus able to lower the exponent in the error term in (1.2) and show that

$$\begin{aligned} \int _1^T \! \left| \zeta \left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^4 \, \mathrm {d}t = T P(\log T) + O\left( T^{\frac{2}{3} + \varepsilon } \right) . \end{aligned}$$
(1.3)

Motohashi [38, Theorem 4.2] established an explicit formula which expresses a smooth version of the fourth moment (1.1) in terms of the cubes of the central values of certain automorphic L-functions. His result is significant, as it allows a much deeper understanding of (1.1) than a mere asymptotic estimate, in addition to having many remarkable applications (see e.g. [24, 25]). The best estimate for (1.1) to date is due to Ivić and Motohashi [25, Theorem 1] who, by making use of the explicit formula, were able to replace the factor \( T^\varepsilon \) in (1.3) by a suitable power of \( \log T \).

In this article, we are interested in the analogous problem for Dirichlet L-functions. Naturally, the fourth moment can here be taken in two different ways: on the one hand, we can look at an individual Dirichlet L-function and take the average along the critical line as in (1.1). On the other hand, we can focus on the central point \( s = 1/2 \) and take the average over a suitable subset of Dirichlet characters, most typically the set of all primitive Dirichlet characters of a given modulus q.

The latter case has probably received most of the attention. The first result goes back to Heath-Brown [20], who proved an asymptotic formula for those q with not too many prime factors, which was later extended by Soundararajan [43] to all q. Young [47] achieved a major breakthrough when he proved, for q prime, an asymptotic formula with a power saving in the error term. His result states that

(1.4)

where the \( *\) on the sum indicates that the sum is restricted to primitive Dirichlet characters, where \( \varphi ^*(q) \) denotes the number of primitive characters mod q, and where P is a certain polynomial of degree 4. As in the works of Zavorotnyi [49] and Motohashi [38], his proof relies crucially on methods coming from the spectral theory of automorphic forms. The exponent 5/512 in the error term was later improved to 1/20 by Blomer, Fouvry, Kowalski, Michel and Milićević [3, 4].

A few results are also available if an additional average over t is included. Rane [42] showed that

(1.5)

where \( \omega (q) \) denotes the number of prime factors of q, and where C(q) is a certain constant depending on q. This is an asymptotic formula in certain ranges of q and T. Bui and Heath-Brown [10] sharpened the error term in (1.5), and established an asymptotic formula when q goes to infinity. Another result is due to Wang [46], who proved that, for \( q \le T \),

(1.6)

where \( P_q \) is a certain polynomial of degree 4 with coefficients depending on q.

The direct analogue of (1.1), that is the fourth moment of an individual Dirichlet L-function on the critical line

$$\begin{aligned} \int _1^T \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi \right) \right| ^4 \mathrm {d}t, \end{aligned}$$
(1.7)

has received much less attention. If \(\chi \) is considered fixed, then a simple asymptotic formula for (1.7) can be obtained by classical methods, although this has not been worked out explicitly in the literature. It is a much more difficult problem to obtain estimates uniform in \(\chi \) and comparable in strength to what can be achieved for \( \zeta (s) \). It is this latter problem which we want to address here.

Our main result is as follows.

Theorem 1.1

Let \( \varepsilon > 0 \). Let \( \chi \) mod q be a primitive Dirichlet character. Then we have, for \( T \ge 1 \),

$$\begin{aligned} \int _1^T \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi \right) \right| ^4 \mathrm {d}t = \int _1^T \! P_\chi (\log t) \, \mathrm {d}t + O\left( q^{2 - 3\theta } T^{\frac{1}{2} + \theta + \varepsilon } + q T^{\frac{2}{3} + \varepsilon } \right) , \end{aligned}$$
(1.8)

where \( P_\chi \) is a polynomial of degree 4, whose coefficients depend only on q, and where the implicit constant depends only on \(\varepsilon \).

Here \(\theta \) denotes the bound in the Ramanujan–Petersson conjecture (see Sect. 3.1 for a precise definition). By the work of Kim and Sarnak [30] it is known that \( \theta = 7/64 \) is admissible, and with this value our asymptotic formula is non-trivial in the range \( q \ll T^{ 25 / 107 - \varepsilon } \). The polynomial \( P_\chi \) appearing in the main term can be described fairly explicitly in form of a residue (see (5.11)). In particular, its leading coefficient is given by

$$\begin{aligned} \frac{1}{2\pi ^2} \frac{ \varphi (q)^2 }{q^2} \prod _{p \mid q} \left( 1 - \frac{2}{p + 1} \right) . \end{aligned}$$

This constant also appears as leading coefficient in the polynomials in (1.4) and (1.6), and is identical to the constant C(q) in (1.5). With a couple of minor technical modifications in the proof, Theorem 1.1 can be extended to all Dirichlet characters.

A similar formula holds if we replace the sharp integration bounds in (1.7) by a smooth weight function.

Theorem 1.2

Let \( \varepsilon > 0 \). Let \( w : (0, \infty ) \rightarrow {\mathbb {C}}\) be a smooth and compactly supported function. Let \( \chi \) mod q be a primitive Dirichlet character. Then we have, for \( T \ge 1 \),

$$\begin{aligned} \int \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi \right) \right| ^4 w\left( \frac{t}{T} \right) \mathrm {d}t = \int \! P_\chi (\log t) w\left( \frac{t}{T} \right) \, \mathrm {d}t + O\left( q^{2 - 3\theta } T^{\frac{1}{2} + \theta + \varepsilon } \right) , \end{aligned}$$

where \( P_\chi \) is the same polynomial as in (1.8), and where the implicit constant depends only on w and \(\varepsilon \).

An interesting generalization of (1.7) concerns the mixed moment

$$\begin{aligned} \int _1^T \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi _1 \right) \right| ^2 \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi _2 \right) \right| ^2 \mathrm {d}t, \end{aligned}$$
(1.9)

where \( \chi _1 \) and \( \chi _2 \) are two different primitive Dirichlet characters. In general, it is expected that the behaviour of the two Dirichlet L-functions \( L(s, \chi _1) \) and \( L(s, \chi _2) \) on the critical line is uncorrelated, which should also find its expression in a slightly different asymptotic behaviour of (1.9) compared with (1.7). Specifically, heuristical considerations suggest that the mixed moment (1.9) should have a leading term of the order of \( T (\log T)^2 \) instead of \( T (\log T)^4 \) (see [33] for a discussion of this phenomenon in a more general context).

This is indeed the case as our next result confirms.

Theorem 1.3

Let \( \varepsilon > 0 \). Let \( \chi _1 \) mod \(q_1\) and \( \chi _2 \) mod \(q_2\) be two different primitive Dirichlet characters, and let

$$\begin{aligned} q_1^\star := \left( q_1, {q_2}^\infty \right) / (q_1, q_2) \qquad \text {and} \qquad q_2^\star := \left( q_2, {q_1}^\infty \right) / (q_1, q_2). \end{aligned}$$
(1.10)

Then we have, for \( T \ge 1 \),

$$\begin{aligned} \begin{aligned}&\int _1^T \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi _1 \right) \right| ^2 \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi _2 \right) \right| ^2 \mathrm {d}t \\&\quad = \int _1^T \! P_{\chi _1, \chi _2}(\log t) \, \mathrm {d}t \\&\qquad + O\left( ( q_1^\star q_1 + q_2^\star q_2 )^\frac{1}{2} (q_1 q_2)^{ \frac{3}{4} - \frac{3}{2}\theta } T^{ \frac{1}{2} + \theta + \varepsilon } + ( q_1^\star q_1 + q_2^\star q_2 )^\frac{1}{3} (q_1 q_2)^\frac{1}{3} T^{ \frac{2}{3} + \varepsilon } \right) , \end{aligned} \end{aligned}$$
(1.11)

where \( P_{\chi _1, \chi _2} \) is a quadratic polynomial, whose coefficients depend only on \( \chi _1 \) and \(\chi _2\), and where the implicit constant depends only on \(\varepsilon \).

As before, the polynomial \( P_{\chi _1, \chi _2} \) appearing in the main term can be stated explicitly (see (5.12) and (5.13)). Its leading coefficient is given by

$$\begin{aligned} \frac{6}{\pi ^2} \left| L( 1, \overline{\chi _1} \chi _2 ) \right| ^2 \frac{ \varphi (q_1) \varphi (q_2) }{ \varphi (q_1 q_2) } \prod _{ p \mid q_1 q_2 } \left( 1 - \frac{1}{p + 1} \right) . \end{aligned}$$

On a side note, this result also shows that for a given primitive, non-real Dirichlet character \(\chi \) there is no correlation between the functions \( L(1/2 + \mathrm {i}t, \chi ) \) and \( L(1/2 - \mathrm {i}t, \chi ) \).

The analogue of Theorem 1.3 for the smooth moment reads as follows.

Theorem 1.4

Let \( \varepsilon > 0 \). Let \( w : (0, \infty ) \rightarrow {\mathbb {C}}\) be a smooth and compactly supported function. Let \( \chi _1 \) mod \(q_1\) and \( \chi _2 \) mod \(q_2\) be two different primitive Dirichlet characters, and let \( q_1^\star \) and \( q_2^\star \) be defined as in (1.10). Then we have, for \( T \ge 1 \),

$$\begin{aligned}&\int \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi _1 \right) \right| ^2 \left| L\left( \tfrac{1}{2} + \mathrm {i}t, \chi _2 \right) \right| ^2 w\left( \frac{t}{T} \right) \, \mathrm {d}t \\&\quad = \int \! P_{\chi _1, \chi _2}(\log t) w\left( \frac{t}{T} \right) \, \mathrm {d}t \\&\qquad + O\left( ( q_1^\star q_1 + q_2^\star q_2 )^\frac{1}{2} (q_1 q_2)^{ \frac{3}{4} - \frac{3}{2}\theta } T^{ \frac{1}{2} + \theta + \varepsilon } \right) , \end{aligned}$$

where \( P_{\chi _1, \chi _2} \) is the same polynomial as in (1.11), and where the implicit constant depends only on w and \(\varepsilon \).

A certain special case of Theorem 1.3 deserves its own mention. If K is a quadratic number field with discriminant D, then it is well-known that the Dedekind zeta function \( \zeta _K(s) \) associated to K has the form

$$\begin{aligned} \zeta _K(s) = \zeta (s) L(s, \chi _D), \end{aligned}$$

where \(\chi _D\) is a certain real primitive Dirichlet character of modulus  |D| . Hence, by applying Theorem 1.3 on this product of Dirichlet L-functions, we get the following asymptotic formula for the second moment of \( \zeta _K \) on the critical line.

Theorem 1.5

Let \( \varepsilon > 0 \). Let K be a quadratic number field with discriminant D. Then we have, for \( T \ge 1 \),

$$\begin{aligned} \int _1^T \left| \zeta _K\left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^2 \mathrm {d}t = \int _1^T \! P_K(\log t) \, \mathrm {d}t + O\left( |D|^{ \frac{5}{4} -\frac{3}{2} \theta } T^{ \frac{1}{2} + \theta + \varepsilon } + |D|^\frac{2}{3} T^{\frac{2}{3} + \varepsilon }\right) ,\nonumber \\ \end{aligned}$$
(1.12)

where \( P_K \) is a quadratic polynomial, whose coefficients depend only on the field K, and where the implicit constant depends only on \(\varepsilon \).

This improves on previous results by Motohashi [35], Hinz [21] and Müller [39]. With the current best value for \(\theta \), the asymptotic formula is non-trivial as long as \( |D| \ll T^{ 50/139 - \varepsilon } \). The leading constant of \( P_K \) is

$$\begin{aligned} \frac{6}{\pi ^2} \left| L( 1, \chi _D ) \right| ^2 \prod _{p \mid D} \left( 1 - \frac{1}{p + 1 } \right) . \end{aligned}$$

We also want to formulate the analogue of Theorem 1.5 for the smooth moment.

Theorem 1.6

Let \( \varepsilon > 0 \). Let \( w : (0, \infty ) \rightarrow {\mathbb {C}}\) be a smooth and compactly supported function. Let K be a quadratic number field with discriminant D. Then we have, for \( T \ge 1 \),

$$\begin{aligned} \int \left| \zeta _K\left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^2 w\left( \frac{t}{T} \right) \, \mathrm {d}t = \int \! P_K(\log t) w\left( \frac{t}{T} \right) \, \mathrm {d}t + O\left( |D|^{ \frac{5}{4} -\frac{3}{2} \theta } T^{ \frac{1}{2} + \theta + \varepsilon } \right) , \end{aligned}$$

where \( P_K \) is the same polynomial as in (1.12), and where the implicit constant depends only on w and \(\varepsilon \).

We did not attempt to establish explicit formulae of the type Motohashi established for \( \zeta (s) \), as this would have further complicated many of the already complicated estimations done in the proof. Nevertheless, it would certainly be interesting to develop such identites for the moments considered here, in particular for the fourth moment of Dirichlet L-functions. In fact, for the second moment of Dedekind zeta functions of quadratic number fields, an explicit formula has been worked out by Motohashi [36, 37] (see also [6, 8, 9] for other related results).

We now proceed to give an overview of the proof of our results, focusing here on Theorem 1.1. For the most part, we follow rather classical paths, taken in similar forms in many of the works cited above. By the use of a suitable approximate functional equation for the square \( L(s, \chi )^2 \), we express the quantity \( \left| L\left( 1/2 + \mathrm {i}t, \chi \right) \right| ^4 \) as a finite double Dirichlet series of roughly the form

$$\begin{aligned}&\sum _{ n_1, n_2 \ll q T } \!\!\! \frac{ \chi (n_1) {\overline{\chi }}(n_2) \tau (n_1) \tau (n_2) }{ (n_1 n_2)^\frac{1}{2} } \left( \frac{n_2}{n_1} \right) ^{\mathrm {i}t} \\&\quad + \alpha _\chi \left( \tfrac{1}{2} + \mathrm {i}t \right) \!\! \sum _{ n_1, n_2 \ll q T } \!\! \frac{ \chi (n_1) {\overline{\chi }}(n_2) \tau (n_1) \tau (n_2) }{ (n_1 n_2)^\frac{1}{2} } (n_1 n_2)^{\mathrm {i}t}, \end{aligned}$$

where \( \tau (n) \) denotes the usual divisor function and where \( \alpha _\chi (s) \) is given by

$$\begin{aligned} \alpha _\chi (s) := L(s, \chi )^2 / L(1 - s, {\overline{\chi }})^2. \end{aligned}$$

Once this is established, we simply integrate term-wise over t. This operation has a localizing effect on the sum on the left, in the sense that only those terms remain where \(n_1\) and \(n_2\) are not too far apart, all other terms becoming negligibly small due to the oscillation in t. The sum on the right effectively disappears as a whole because of oscillatory effects coming from the two factors \( \alpha _\chi (1/2 + \mathrm {i}t) \) and \( (n_1 n_2)^{\mathrm {i}t} \).

Eventually, two different sums remain which we need to estimate. On the one hand, we have the contribution coming from the diagonal terms \( n_1 = n_2 \), which takes the shape

$$\begin{aligned} \sum _{\begin{array}{c} n \ll q T \\ (n, q) = 1 \end{array}} \frac{ \tau (n)^2 }{n}, \end{aligned}$$
(1.13)

and which can be evaluated rather easily, giving rise to the first two leading terms in the final asymptotic formula (1.8). On the other hand, we have the contribution coming from the off-diagonal terms, which—ignoring here any remaining oscillatory factors—roughly look as follows,

$$\begin{aligned} \sum _{\begin{array}{c} n_1, n_2 \ll q T \\ 0 < | n_1 - n_2 | \ll T^{1/3} \end{array}} \frac{ \chi (n_1) {\overline{\chi }}(n_2) \tau (n_1) \tau (n_2) }{ (n_1 n_2)^\frac{1}{2} \log ( n_2 / n_1 ) }. \end{aligned}$$

It also contributes to the main term in the end, although only to the lower order terms. It is, however, considerably harder to analyze than (1.13), and its evaluation forms the actual core of the proof of Theorem 1.1.

After reordering the terms according to the value of \( h := n_2 - n_1 \), we arrive at the following type of sums,

$$\begin{aligned} \sum _{ n \ll qT } \chi (n) {\overline{\chi }}(n + h) \tau (n) \tau (n + h), \end{aligned}$$
(1.14)

where the parameter h can be as large as \( T^{1/3} \). This is an instance of the so-called shifted convolution problem, which comes up regularly in the study of the analytic behaviour of L-functions. Similar sums also appeared for instance in the works of Heath-Brown [18] and Young [47] cited above. In our case, it is the presence of the Dirichlet characters which complicates the analysis considerably, leading to several technical difficulties down the road, in particular with regard to the application of spectral methods.

The crucial point in the evaluation of (1.14) comes after a couple of initial transformations, when we encounter sums of Kloosterman sums of roughly the following form,

$$\begin{aligned} \sum _{a \bmod q} \chi (a) \overline{\chi }(m - a) \sum _{ (c, q) = 1 } S( {\overline{c}}^2 h, a; q ) S( {\overline{q}}^2 h, m; c ) F(c), \end{aligned}$$
(1.15)

where m is an integer and where F(c) is some weight function. Ideally, at this point one would like to estimate the sum of Kloosterman sums over c via the Kuznetsov formula, while also exploiting the cancellation in the character sum over a. However, already the first task brings serious difficulties, as it is not clear in which form—if there is any—the Kuznetsov formula might be applicable here.

The route we take to solve this problem is to write the first Kloosterman sum in terms of Dirichlet characters as follows (assuming for simplicity that h and q are coprime),

$$\begin{aligned} S( {\overline{c}}^2 h, a; q ) = \frac{1}{ \varphi (q) } \sum _{\psi \bmod q} \psi (c)^2 {\overline{\psi }}(ha) G(\psi )^2, \end{aligned}$$
(1.16)

where the sum runs over all Dirichlet characters mod q, and where \( G(\psi ) \) denotes the Gauß sum associated to \(\psi \). The idea underlying this approach goes initially back to Blomer and Milićević [7], and was used in similar forms also in other works (see [41, 45, 48]). It allows us to separate the two variables a and c in (1.15), while at the same time bringing the sum of Kloosterman sums into a form susceptible to the use of the Kuznetsov formula.

Of course taking this route comes with a cost: encoding the Kloosterman sum via Dirichlet characters introduces an additional factor of the size of \( q^{1/2} \), which we cannot get rid of afterwards and which inevitably turns up in the error term in Theorem 1.1.

We suspect that there should be a more direct way to employ the Kuznetsov formula on the sum (1.15), which avoids the rather artificial detour via (1.16) taken here. This might not only lead to an improvement of the error term in Theorem 1.1 in the q-aspect, but would also prove extremely useful when trying to establish an explicit formula of Motohashi type for the fourth moment of Dirichlet L-functions (see also the comments in [38, pp. 182–183] on this matter).

1.1 Plan

The article is organized as follows. In Sect. 2, we introduce the basic notation used throughout the article, and state some technical results related to Dirichlet L-functions. In Sect. 3, we briefly present the needed tools from the spectral theory of automorphic forms. In Sect. 4, we consider the shifted convolution problem lying at the heart of the proof of our results. Finally, in Sect. 5, we proof Theorems 1.11.6. The last two sections can be read independently of each other.

2 Background on Dirichlet L-functions

The aim of section is to introduce the basic notation used in the following, and state a couple of technical lemmas related to Dirichlet L-functions.

2.1 Notation

We will use the convention that \(\varepsilon \) denotes a positive real number which can be chosen arbitrarily small and whose value may change at each occurrence. We write \( A \asymp B \) to mean \( A \ll B \ll A \).

We denote the Gauß sum associated to the Dirichlet character \( \chi \) mod q by

$$\begin{aligned} G(\chi , h) := \sum _{a \bmod q} \chi (a) e\left( \frac{ah}{q} \right) , \end{aligned}$$

where as usual \( e(\xi ) := \exp ( 2 \pi \mathrm {i}\xi ) \). We set \( G(\chi ) := G(\chi , 1) \). Other frequently occurring exponential sums are the Ramanujan sums and Kloosterman sums, for which we will use the notations

$$\begin{aligned} r_q(h) := \sum _{\begin{array}{c} a \bmod q \\ (a, q) = 1 \end{array}} e\left( \frac{ah}{q} \right) = \sum _{ d \mid (h, q) } \mu \left( \frac{q}{d} \right) d \quad \text {and} \quad S(m, n; q) := \sum _{\begin{array}{c} a \bmod q \\ (a, q) = 1 \end{array}} e\left( \frac{ m a + n {\overline{a}} }{q} \right) , \end{aligned}$$

where \( {\overline{a}} \) indicates a solution to \( {\overline{a}} a \equiv 1 \bmod q \).

Let \( \chi _1 \) mod \(q_1\) and \( \chi _2 \) mod \(q_2\) be Dirichlet characters, which throughout the article will be assumed to be primitive. We denote the product of the two Dirichlet L-functions \( L(s, \chi _1) \) and \( L(s, \chi _2) \) by \( L_{\chi _1, \chi _2}(s) := L(s, \chi _1) L(s, \chi _2) \). For \( {\text {Re}}(s) > 1 \), this function can be written as a Dirichlet series,

$$\begin{aligned} L_{\chi _1, \chi _2}(s) = \sum _{n = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n) }{n^s} \qquad \text {with} \qquad \tau _{\chi _1, \chi _2}(n) := \sum _{d \mid n} \chi _1(d) \chi _2\left( \frac{n}{d} \right) . \end{aligned}$$

Moreover, it satisfies the following functional equation (see e.g. [28, Theorem 4.15]),

$$\begin{aligned} L_{\chi _1, \chi _2}(s) = \alpha _{\chi _1, \chi _2}(s) L_{ \overline{\chi _1}, \overline{\chi _2} }(1 - s), \end{aligned}$$

with \( \alpha _{\chi _1, \chi _2}(s) \) given by

$$\begin{aligned} \alpha _{\chi _1, \chi _2}(s) := \frac{ G(\chi _1) G(\chi _2) }{ \pi ^2 \mathrm {i}^{ \kappa (\chi _1) + \kappa (\chi _2) } } \left( \frac{4 \pi ^2}{q_1 q_2} \right) ^s \sin \left( \frac{\pi }{2} \left( s + \kappa (\chi _1) \right) \right) \sin \left( \frac{\pi }{2} \left( s + \kappa (\chi _2) \right) \right) \Gamma (1 - s)^2, \end{aligned}$$

where we have set

$$\begin{aligned} \kappa (\chi _i) := ( 1 - \chi _i(-1) ) / 2. \end{aligned}$$
(2.1)

2.2 Estimates for \( \alpha _{\chi _1, \chi _2}(s) \) and \( L_{\chi _1, \chi _2}(s) \)

We will need rather precise estimates for \( \alpha _{\chi _1, \chi _2}(s) \) on the critical line. By using a suitable approximation for the gamma function (see e.g. [1, Chapter 5, (38)]) we can write this quantity, for \( |t| \ge 1 \), as

$$\begin{aligned} \alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}t \right) = \mathrm {i}\frac{ G(\chi _1) G(\chi _2) }{ (-1)^{ \kappa (\chi _1) + \kappa (\chi _2) } \sqrt{q_1 q_2} } e\left( \frac{t}{\pi }\log \left( \frac{2 \pi e}{ t \sqrt{q_1 q_2} } \right) \right) A(t), \end{aligned}$$
(2.2)

where \( A : {\mathbb {R}}\rightarrow {\mathbb {C}}\) is a certain smooth function whose derivatives are bounded by

$$\begin{aligned} A^{ (\nu ) }(t) \ll |t|^{-\nu } \quad \text {for} \quad \nu \ge 0. \end{aligned}$$

Note that we also have

$$\begin{aligned} \left| \alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}t\right) \right| = 1 \quad \text {for} \quad t \in {\mathbb {R}}. \end{aligned}$$
(2.3)

In the critical strip, the following simple estimate will suffice,

$$\begin{aligned} | \alpha _{\chi _1, \chi _2}(\sigma + \mathrm {i}t) | \asymp t^{1 - 2\sigma } (q_1 q_2)^{ \frac{1}{2} - \sigma } \qquad \text {for} \qquad \sigma \in [0, 1], \quad |t| \ge 1. \end{aligned}$$
(2.4)

Concerning \( L_{\chi _1, \chi _2}(s) \), we have the following hybrid upper bound, which is an immediate consequence of a result by Heath-Brown [19] and the convexity principle.

Theorem 2.1

Let \( \varepsilon > 0 \). We have, for \( \sigma \in [0, 1] \) and \( t \in {\mathbb {R}}\) with \( | \sigma + \mathrm {i}t - 1 | > \varepsilon \),

$$\begin{aligned} L_{\chi _1, \chi _2}(\sigma + it) \ll ( q_1 q_2 )^{ \frac{ 3 (1 - \sigma ) }{8} + \varepsilon } ( |t| + 1 )^{ \frac{ 3 (1 - \sigma ) }{4} + \varepsilon }, \end{aligned}$$

where the implicit constant depends only on \(\varepsilon \).

We will also need upper bounds for the first moment of \( L_{\chi _1, \chi _2}(s) \) in the critical strip. In this regard, the following result will be helpful.

Theorem 2.2

Let \( \varepsilon > 0 \). We have, for \( \sigma \in [0, 1] \) and \( q_1, q_2 \le T \),

$$\begin{aligned} \int _1^T \left| L_{\chi _1, \chi _2}(\sigma + \mathrm {i}t) \right| \, \mathrm {d}t \ll T^{1 + \varepsilon } + (q_1 q_2)^{\frac{1}{2} - \sigma } T^{2 - 2 \sigma + \varepsilon }, \end{aligned}$$

where the implicit constant depends only on \(\varepsilon \).

Proof

For \( \sigma = 1/2 \), this is an immediate consequence of a result by Gallagher [16, (1\(_T\))]. His proof can easily be adapted to cover also the range \( \sigma > 1/2 \), and the result for \( \sigma < 1/2 \) then follows from the functional equation and (2.4). \(\square \)

2.3 Voronoi summation for \( \tau _{\chi _1, \chi _2}(n) \)

Here we want to develop a summation formula of Voronoi type for \( \tau _{\chi _1, \chi _2}(n) \).

Before stating the result we need to introduce some notation. Let a and \( c > 0 \) be coprime integers. We set

$$\begin{aligned}&{\hat{\tau }}_{\chi _1, \chi _2}\left( n; \frac{a}{c} \right) := \frac{1}{ [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} } \sum _{n_1 n_2 = n} \\&\quad \cdot \sum _{\begin{array}{c} b_1 \bmod [c, q_1] \\ b_2 \bmod [c, q_2] \end{array}} \chi _1(b_1) \chi _2(b_2) e\left( \frac{ a b_1 b_2 }{c} + \frac{n_1 b_1}{ [c, q_1] } + \frac{n_2 b_2}{ [c, q_2] } \right) , \end{aligned}$$

where \( [c, q_i] \) denotes the least common multiple of c and \(q_i\). We also define

$$\begin{aligned} B_{\chi _1, \chi _2}^+(\xi )&:= \left\{ \begin{aligned} -2\pi Y_0( 4\pi \xi ) \quad \text {if} \quad \chi _1(-1) = \chi _2(-1), \\ -2\pi \mathrm {i}J_0( 4\pi \xi ) \quad \text {if} \quad \chi _1(-1) \ne \chi _2(-1), \end{aligned} \right. \end{aligned}$$
(2.5)
$$\begin{aligned} B_{\chi _1, \chi _2}^-(\xi )&:= 2 \left( \chi _1(-1) + \chi _2(-1) \right) K_0( 4\pi \xi ). \end{aligned}$$
(2.6)

Finally, we define \( \Pi _{\chi _1, \chi _2}( X; c, a ) \) to be the polynomial in X, which in the case \( \chi _1 = \chi _2 \) is given by

$$\begin{aligned} \Pi _{\chi _1, \chi _2}( X; c, a )&:= \chi _1\left( \frac{c}{ (c, q_1) } \right) \overline{\chi _1}\left( \frac{ a q_1 }{ (c, q_1) } \right) G(\chi _1) \sum _{d \mid q_1} \frac{ \mu (d) }{d} \left( X + 2 \gamma + 2 \log \left( \frac{q_1}{cd} \right) \right) , \end{aligned}$$

and which otherwise is equal to the constant

$$\begin{aligned} \Pi _{\chi _1, \chi _2}( X; c, a )&:= \chi _1\left( \frac{c}{ (c, q_2) } \right) \overline{\chi _2}\left( \frac{ q_2 }{ (c, q_2) } \right) G(\chi _2, a) L( 1, \chi _1 \overline{\chi _2} ) \\&\quad + \chi _2\left( \frac{c}{ (c, q_1) } \right) \overline{\chi _1}\left( \frac{ q_1 }{ (c, q_1) } \right) G(\chi _1, a) L( 1, \overline{\chi _1} \chi _2 ). \end{aligned}$$

The Voronoi formula for \( \tau _{\chi _1, \chi _2}(n) \) now reads as follows.

Theorem 2.3

Let \( f : (0, \infty ) \rightarrow {\mathbb {C}}\) be a smooth and compactly supported function. Let a and \( c \ge 1 \) be coprime integers. Let \( \chi _1 \) mod \(q_1\) and \(\chi _2\) mod \(q_2\) be primitive Dirichlet characters. Then

$$\begin{aligned} \begin{aligned}&\sum _n f(n) \tau _{\chi _1, \chi _2}(n) e\left( \frac{an}{c} \right) \\&\quad = \frac{1}{c} \int \! \Pi _{\chi _1, \chi _2}( \log \xi ; c, a ) f(\xi ) \, \mathrm {d}\xi \\&\qquad + \frac{1}{ [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} } \sum _\pm \sum _{n = 1}^\infty {\hat{\tau }}_{\chi _1, \chi _2}\left( n; \frac{\pm a}{c} \right) \int \! B_{\chi _1, \chi _2}^\pm \left( \frac{ (n \xi )^\frac{1}{2} }{ [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} } \right) f(\xi ) \, \mathrm {d}\xi . \end{aligned} \end{aligned}$$
(2.7)

Proof

The proof of this result follows standard paths (see e.g. [29, Chapter 1]), although a few additional technical difficulties arise from the fact that the parameters c, \(q_1\) and \(q_2\) may have possible common factors. To simplify the notation we set \( c_1 := [c, q_1] \) and \( c_2 := [c, q_2] \).

As the Hurwitz zeta function will occur frequently in what follows, we want to start by giving a brief overview of its most important properties (see [2, Chapter 12] and [15, Chapter 1.10] for proofs). Remember that the Hurwitz zeta function \( \zeta (s, \alpha ) \) is defined for \( {\text {Re}}(s) > 1 \) and \( \alpha \in (0, 1] \) as

$$\begin{aligned} \zeta (s, \alpha ) := \sum _{n = 0}^\infty \frac{1}{ (n + \alpha )^s }. \end{aligned}$$

In the first variable, it can be continued meromorphically to the whole complex plane with a simple pole at \( s = 1 \). Its Laurent series expansion around \( s = 1 \) has the form

$$\begin{aligned} \zeta (s, \alpha ) = \frac{1}{s - 1} - \psi (\alpha ) + O\left( s - 1\right) , \end{aligned}$$
(2.8)

where \( \psi \) denotes the digamma function. Furthermore, for an integer \( 1 \le b \le c \), it satisfies the following functional equation,

$$\begin{aligned} \zeta \left( s, \frac{b}{c} \right) = \frac{ \Gamma (1 - s) }{ (2\pi c)^{1 - s} } \sum _\pm \sum _{d = 1}^c e^{ \pm \frac{ \pi \mathrm {i}( 1 - s) }{2} } e\left( \mp \frac{ b d }{c} \right) \zeta \left( 1 - s, \frac{d}{c} \right) . \end{aligned}$$
(2.9)

In order to the prove Theorem 2.3, we will work with the following two Dirichlet series,

$$\begin{aligned} L_{\chi _1, \chi _2}\left( s; \frac{a}{c} \right) := \sum _{n = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n) }{n^s} e\left( \frac{an}{c} \right) \qquad \text {and} \qquad {\hat{L}}_{\chi _1, \chi _2}\left( s; \frac{a}{c} \right) := \sum _{n = 1}^\infty \frac{ {\hat{\tau }}_{\chi _1, \chi _2}\left( n; \frac{a}{c} \right) }{n^s}. \end{aligned}$$

A straightforward calculation shows that these two series can be expressed in terms of the Hurwitz zeta function as follows,

$$\begin{aligned} L_{\chi _1, \chi _2}\left( s, \frac{a}{c} \right)&= \frac{1}{ (c_1 c_2)^s } \sum _{\begin{array}{c} 1 \le b_1 \le c_1 \\ 1 \le b_2 \le c_2 \end{array}} \chi _1(b_1) \chi _2(b_2) e\left( \frac{ a b_1 b_2 }{c} \right) \zeta \left( s, \frac{b_1}{c_1} \right) \zeta \left( s, \frac{b_2}{c_2} \right) , \end{aligned}$$
(2.10)

and

$$\begin{aligned} {\hat{L}}_{\chi _1, \chi _2}\left( s, \frac{a}{c} \right)&= \frac{1}{ (c_1 c_2)^s } \sum _{\begin{array}{c} 1 \le d_1 \le c_1 \\ 1 \le d_2 \le c_2 \end{array}} \varpi _{\chi _1, \chi _2}(d_1, d_2, a; c) \zeta \left( s, \frac{d_1}{c_1} \right) \zeta \left( s, \frac{d_2}{c_2} \right) , \end{aligned}$$
(2.11)

where we have set

$$\begin{aligned} \varpi _{\chi _1, \chi _2}(d_1, d_2, a; c) := \frac{1}{ (c_1 c_2)^\frac{1}{2} } \sum _{\begin{array}{c} 1 \le b_1 \le c_1 \\ 1 \le b_2 \le c_2 \end{array}} \chi _1(b_1) \chi _2(b_2) e\left( \frac{ a b_1 b_2 }{c} + \frac{b_1 d_1}{ c_1 } + \frac{b_2 d_2}{ c_2 } \right) . \end{aligned}$$

Thus we see that both \( L_{\chi _1, \chi _2}(s; a/c) \) and \( {\hat{L}}_{\chi _1, \chi _2}(s; a/c) \) can be continued meromorphically to the whole complex plane with at most one possible pole at \( s = 1 \) of degree not larger than 2.

Our next aim is to deduce a functional equation for \( L_{\chi _1, \chi _2}(s; a/c) \). Starting from the representation (2.10) and then using (2.9) we get

$$\begin{aligned} L_{\chi _1, \chi _2}\left( s, \frac{a}{c} \right)&= \frac{ \Gamma (1 - s)^2 }{ (4 \pi ^2)^{1 - s} (c_1 c_2)^\frac{1}{2} } \sum _{\begin{array}{c} 1 \le d_1 \le c_1 \\ 1 \le d_2 \le c_2 \end{array}} \zeta \left( 1 - s, \frac{d_1}{c_1} \right) \zeta \left( 1 - s, \frac{d_2}{c_2} \right) \\&\quad \cdot \big ( \varpi _{\chi _1, \chi _2}(-d_1, d_2, a; c) + \varpi _{\chi _1, \chi _2}(d_1, -d_2, a; c) \\&\quad + e^{ -\pi \mathrm {i}(1 - s) } \varpi _{\chi _1, \chi _2}(d_1, d_2, a; c) + e^{ \pi \mathrm {i}(1 - s) } \varpi _{\chi _1, \chi _2}(-d_1, -d_2, a; c) \big ). \end{aligned}$$

At this point we observe that the following relations hold,

$$\begin{aligned} \varpi _{\chi _1, \chi _2}(-d_1, d_2, a; c)&= \chi _1(-1) \varpi _{\chi _1, \chi _2}(d_1, d_2, -a; c), \\ \varpi _{\chi _1, \chi _2}(d_1, -d_2, a; c)&= \chi _2(-1) \varpi _{\chi _1, \chi _2}(d_1, d_2, -a; c), \\ \varpi _{\chi _1, \chi _2}(-d_1, -d_2, a; c)&= \chi _1 \chi _2(-1) \varpi _{\chi _1, \chi _2}(d_1, d_2, a; c). \end{aligned}$$

Using these, together with (2.11), we then arrive at the following identity,

$$\begin{aligned} L_{\chi _1, \chi _2}\left( s; \frac{a}{c} \right) = \frac{ \Gamma (1 - s)^2 }{\pi }\left( \frac{ 4 \pi ^2 }{ c_1 c_2 } \right) ^{s - \frac{1}{2}} \sum _\pm \kappa _{\chi _1, \chi _2}^\pm (1 - s) {\hat{L}}_{\chi _1, \chi _2}\left( 1 - s; \pm \frac{a}{c} \right) , \end{aligned}$$
(2.12)

with

$$\begin{aligned} \kappa _{\chi _1, \chi _2}^+(s) := \frac{ \chi _1 \chi _2(-1) e^{\pi \mathrm {i}s} + e^{-\pi \mathrm {i}s} }{2} \qquad \text {and} \qquad \kappa _{\chi _1, \chi _2}^-(s) := \frac{ \chi _1(-1) + \chi _2(-1) }{2}. \end{aligned}$$

We now turn to the actual proof of Theorem 2.3. Here we first express the sum on the left hand side in (2.7) via Mellin inversion as

$$\begin{aligned} \sum _n f(n) \tau _{\chi _1, \chi _2}(n) e\left( \frac{an}{c} \right) = \frac{1}{2\pi \mathrm {i}} \int _{ (2) } \! {\hat{f}}(s) L_{\chi _1, \chi _2}\left( s; \frac{a}{c} \right) \, \mathrm {d}s, \end{aligned}$$

where \({\hat{f}}\) denotes the Mellin transform of f. After moving the line of integration to \( {\text {Re}}(s) = -1 \), using the functional equation (2.12), and expanding the L-functions back into Dirichlet series, we arrive at

$$\begin{aligned} \sum _n f(n) \tau _{\chi _1, \chi _2}(n) e\left( \frac{an}{c} \right)&= \underset{s = 1}{{\text {Res}}}\,\,\left( {\hat{f}}(s) L_{\chi _1, \chi _2}\left( s; \frac{a}{c} \right) \right) \\&\quad + \frac{1}{ (c_1 c_2)^\frac{1}{2} } \sum _\pm \sum _{n = 1}^\infty {\hat{\tau }}_{\chi _1, \chi _2}\left( n; \frac{\pm a}{c} \right) I^\pm (n), \end{aligned}$$

where

$$\begin{aligned} I^\pm (n) := \frac{1}{2\pi \mathrm {i}} \int _{ (-1) } \! G^\pm (1 - s) {\hat{f}}(s) \, \mathrm {d}s \quad \text {with} \quad G^\pm (s) := 2 \kappa _{\chi _1, \chi _2}^\pm (s) \Gamma (s)^2 \left( \frac{c_1 c_2}{4\pi ^2 n} \right) ^s. \end{aligned}$$

The integral \( I^\pm (n) \) can be evaluated by observing that the functions \( G^+(s) \) and \( G^-(s) \) are the Mellin transforms of certain Bessel functions (see [17, 17.43.16–18]). By the Mellin convolution theorem we thus have

$$\begin{aligned} I^\pm (n) = \int \! B_{\chi _1, \chi _2}^\pm \bigg ( \frac{ (n \xi )^\frac{1}{2} }{ (c_1 c_2)^\frac{1}{2} } \bigg ) f(\xi ) \, \mathrm {d}\xi , \end{aligned}$$

with \( B_{\chi _1, \chi _2}^\pm (\xi ) \) as defined in (2.5) and (2.6).

It remains to evaluate the residue, which essentially amounts to determining the Laurent series expansion of \( L_{\chi _1, \chi _2}( s; a/c) \) around \( s = 1 \). To this end we first use (2.10) together with (2.8), and get

$$\begin{aligned} L_{\chi _1, \chi _2}\left( s, \frac{a}{c} \right)= & {} \frac{1}{ (s - 1)^2 } \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right) - \frac{1}{s - 1} \left( \lambda _{\chi _1, \chi _2}^{ (1) }\left( \frac{a}{c} \right) \right. \\&\left. + \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right) \log (c_1 c_2) \right) + O\left( 1\right) , \end{aligned}$$

with

$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right)&:= \frac{1}{c_1 c_2} \sum _{\begin{array}{c} 1 \le b_1 \le c_1 \\ 1 \le b_2 \le c_2 \end{array}} \chi _1(b_1) \chi _2(b_2) e\left( \frac{a b_1 b_2}{c} \right) , \\ \lambda _{\chi _1, \chi _2}^{ (1) }\left( \frac{a}{c} \right)&:= \frac{1}{c_1 c_2} \sum _{\begin{array}{c} 1 \le b_1 \le c_1 \\ 1 \le b_2 \le c_2 \end{array}} \chi _1(b_1) \chi _2(b_2) e\left( \frac{a b_1 b_2}{c} \right) \left( \psi \left( \frac{b_1}{c_1} \right) + \psi \left( \frac{b_2}{c_2} \right) \right) . \end{aligned}$$

In the remaining part of the proof we will show that, if \( \chi _1 = \chi _2 \) then

$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right)&= \frac{1}{c} \chi _1\left( \frac{c_1}{q_1} \right) \overline{\chi _1}\left( a \frac{c_1}{c} \right) G(\chi _1) \frac{ \varphi (q_1) }{ q_1 }, \end{aligned}$$
(2.13)
$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (1) }\left( \frac{a}{c} \right)&= -\frac{2}{c} \chi _1\left( \frac{c_1}{q_1} \right) \overline{\chi _1}\left( a \frac{c_1}{c} \right) G(\chi _1) \sum _{ d \mid q_1 } \frac{ \mu (d) }{d} ( \log q_1 + \gamma - \log d ), \end{aligned}$$
(2.14)

and otherwise

$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right)&= 0, \end{aligned}$$
(2.15)
$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (1) }\left( \frac{a}{c} \right)&= -\frac{1}{c} \bigg ( \chi _1\left( \frac{c_2}{q_2} \right) \overline{\chi _2}\left( a \frac{c_2}{c} \right) G(\chi _2) L( 1, \chi _1 \overline{\chi _2} ) \nonumber \\&\qquad + \overline{\chi _1}\left( a \frac{c_1}{c} \right) \chi _2\left( \frac{c_1}{q_1} \right) G(\chi _1) L( 1, \overline{\chi _1} \chi _2 ) \bigg ). \end{aligned}$$
(2.16)

Theorem 2.3 follows immediately from these identities.

For \( i = 1, 2 \), let

$$\begin{aligned} \lambda _{\chi _i}^{ (3) }\left( \frac{h}{c} \right) := \frac{1}{c_i} \sum _{ b_i \bmod c_i } \chi _i(b_i) e\left( \frac{h b_i}{c} \right) . \end{aligned}$$

If we fix i and decompose c as

$$\begin{aligned} c = c^*c^\circ \quad \text {with} \quad (c^*, q_i) = 1 \quad \text {and} \quad c^\circ \mid {q_i}^\infty , \end{aligned}$$

then we clearly have

$$\begin{aligned} \lambda _{\chi _i}^{ (3) }\left( \frac{h}{c} \right) = \frac{ \chi _i\left( c^*\right) }{c_i} \Bigg ( \sum _{b_i^*\bmod c^*} e\left( \frac{h b_i^*}{c^*} \right) \Bigg ) \Bigg ( \sum _{ b_i^\circ \bmod [c^\circ , q_i] } \chi _i(b_i^\circ ) e\left( \frac{ h b_i^\circ }{ c^\circ } \right) \Bigg ). \end{aligned}$$

Lemma 2.6 below shows that the sum over \( b_i^\circ \) is zero if \( \frac{ c^\circ }{ ( c^\circ , q_i ) } \not \mid h \), and otherwise is given by

$$\begin{aligned} \sum _{ b_i^\circ \bmod [c^\circ , q_i] } \chi _i(b_i^\circ ) e\left( \frac{ h b_i^\circ }{ c^\circ } \right) = \overline{\chi _i}\left( \frac{ h (c^\circ , q_i) }{ c^\circ } \frac{ q_i }{ ( c^\circ , q_i ) } \right) G( \chi _i ) \frac{ c^\circ }{ ( c^\circ , q_i ) }. \end{aligned}$$

Hence we see that \( \lambda _{\chi _i}^{ (3) }(h/c) \) vanishes unless \( q_i \mid c \) and \( \frac{c}{q_i} \mid h \), in which case we have

$$\begin{aligned} \lambda _{\chi _i}^{ (3) }\Big ( \frac{h}{c} \Big ) = \overline{\chi _i}\Big ( \frac{ h q_i }{c} \Big ) \frac{ G(\chi _i) }{q_i}. \end{aligned}$$

We first turn towards the evaluation of \( \lambda _{\chi _1, \chi _2}^{ (2) }(a/c) \). We have

$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right) = \frac{1}{c_1} \sum _{ b_1 = 1 }^{ c_1 } \chi _1(b_1) \lambda _{\chi _2}^{ (3) }\left( \frac{a b_1}{c} \right) = \frac{1}{c_2} \sum _{ b_2 = 1 }^{ c_2 } \chi _2(b_2) \lambda _{\chi _1}^{ (3) }\left( \frac{a b_2}{c} \right) . \end{aligned}$$

It follows from what we have shown above that \( \lambda _{\chi _1, \chi _2}^{ (2) }(a/c) \) vanishes unless both \(q_1\) and \(q_2\) divide c, in which case we have

$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right) = \overline{\chi _2}(a) \chi _1\left( \frac{c}{q_2} \right) \frac{ G(\chi _2) }{c q_2} \sum _{ 1 \le b_1 \le q_2 } \chi _1 \overline{\chi _2}( b_1 ). \end{aligned}$$

Clearly, for this expression to be non-zero we must have \( ( c, q_1 q_2 ) = q_2 \). By symmetry, we also must have \( (c, q_1 q_2) = q_1 \), and thus in fact \( q_1 = q_2 \). However, by orthogonality of Dirichlet characters, the sum over \(b_1\) can then only be non-zero if \( \chi _1 = \chi _2 \). In summary, we see that \( \lambda _{\chi _1, \chi _2}^{ (2) }(a/c) \) vanishes unless the conditions

$$\begin{aligned} \chi _1 = \chi _2, \quad q_1 \mid c \quad \text {and} \quad \left( \frac{c}{q_1}, q_1 \right) = 1, \end{aligned}$$

are all met, in which case it is given by

$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (2) }\left( \frac{a}{c} \right) = \frac{1}{c} \chi _1\left( \frac{c_1}{q_1} \right) \overline{\chi _1}(a) G(\chi _1) \frac{ \varphi (q_1) }{q_1}. \end{aligned}$$

The identities (2.13) and (2.15) now follow immediately from these considerations.

Next we consider \( \lambda _{\chi _1, \chi _2}^{ (1) }(a/c) \), which we write as

$$\begin{aligned} \lambda _{\chi _1, \chi _2}^{ (1) }\left( \frac{a}{c} \right)= & {} \frac{1}{c_1} \sum _{1 \le b_1 \le c_1} \chi _1(b_1) \psi \left( \frac{b_1}{c} \right) \lambda _{\chi _2}^{ (3) }\left( \frac{a b_1}{c} \right) \\&+ \frac{1}{c_2} \sum _{1 \le b_2 \le c_2} \chi _2(b_2) \psi \left( \frac{b_2}{c} \right) \lambda _{\chi _1}^{ (3) }\left( \frac{a b_2}{c} \right) . \end{aligned}$$

Using what we have shown above on \( \lambda _{\chi _i}^{ (3) }(h/c) \), this expression becomes

$$\begin{aligned} \begin{aligned} \lambda _{\chi _1, \chi _2}^{ (1) }\left( \frac{a}{c} \right) ={}&\frac{1}{ c [q_1, q_2] } \Bigg ( \chi _1\left( \frac{c_2}{q_2} \right) \overline{\chi _2}\left( a \frac{c_2}{c} \right) G(\chi _2) \! \sum _{b_1 = 1}^{ [q_1, q_2] } \! \chi _1 \overline{\chi _2}(b_1) \psi \left( \frac{b_1}{ [q_1, q_2] } \right) \\ {}&+ \chi _2\left( \frac{c_1}{q_1} \right) \overline{\chi _1}\left( a \frac{c_1}{c} \right) G(\chi _1) \! \sum _{b_2 = 1}^{ [q_1, q_2] } \! \overline{\chi _1} \chi _2(b_2) \psi \left( \frac{b_2}{ [q_1, q_2] } \right) \Bigg ). \end{aligned} \end{aligned}$$
(2.17)

In order to evaluate the sum over \( b_1 \), we note that

$$\begin{aligned} \sum _{ b_1 = 1 }^{ [q_1, q_2] } \chi _1 \overline{\chi _2} (b_1) \psi \left( \frac{b_1}{ [q_1, q_2] } \right) = \lim _{s \rightarrow 1} \bigg ( \frac{1}{s - 1} \sum _{ b_1 = 1 }^{ [q_1, q_2] } \chi _1 \overline{\chi _2} (b_1) - [q_1, q_2] L( s, \chi _1 \overline{\chi _2} ) \bigg ), \end{aligned}$$

as can be seen by writing \( L( s, \chi _1 \overline{\chi _2} ) \) in terms of the Hurwitz zeta function,

$$\begin{aligned} L( s, \chi _1 \overline{\chi _2} ) = \frac{1}{ [q_1, q_2] } \sum _{ b_1 = 1 }^{ [q_1, q_2] } \chi _1 \overline{\chi _2} (b_1) \zeta \left( s, \frac{b_1}{ [q_1, q_2] } \right) , \end{aligned}$$

and then using (2.8). Hence, if \( \chi _1 = \chi _2 \),

$$\begin{aligned} \sum _{ b_1 = 1 }^{ [q_1, q_2] } \chi _1 \overline{\chi _2} (b_1) \psi \left( \frac{b_1}{ [q_1, q_2] } \right)&= -[q_1, q_2] \sum _{ d \mid q_1 } \frac{ \mu (d) }{d} ( \log q_1 + \gamma - \log d ), \end{aligned}$$

while otherwise,

$$\begin{aligned} \sum _{ b_1 = 1 }^{ [q_1, q_2] } \chi _1 \overline{\chi _2} (b_1) \psi \left( \frac{b_1}{ [q_1, q_2] } \right)&= -[q_1, q_2] L( 1, \chi _1 \overline{\chi _2} ). \end{aligned}$$

The sum over \(b_2\) can be evaluated analogously. After inserting the resulting expressions into (2.17), we eventually get (2.14) and (2.16). This concludes the proof of Theorem 2.3. \(\square \)

As an immediate corollary of Theorem 2.3, we can deduce a summation formula for \( \tau _{\chi _1, \chi _2}(n) \) in arithmetic progressions. If we set

$$\begin{aligned} T_{\chi _1, \chi _2}(n; c, h) := \frac{1}{c^\frac{1}{2} } \sum _{\begin{array}{c} a \bmod c \\ (a, c) = 1 \end{array}} e\left( \frac{-h a}{c} \right) {\hat{\tau }}_{\chi _1, \chi _2}\left( n; \frac{a}{c} \right) , \end{aligned}$$

then the result reads as follows.

Theorem 2.4

Let \( f : (0, \infty ) \rightarrow {\mathbb {C}}\) be a smooth and compactly supported function. Let h and \( c \ge 1 \) be integers. Let \( \chi _1 \) mod \(q_1\) and \(\chi _2\) mod \(q_2\) be primitive Dirichlet characters. Then

$$\begin{aligned} \sum _{ n \equiv h \bmod c } \! f(n) \tau _{\chi _1, \chi _2}(n)&= \frac{1}{c} \sum _{c_0 \mid c} \frac{1}{c_0} \sum _{\begin{array}{c} a_0 \bmod c_0 \\ (a_0, c_0) = 1 \end{array}} e\left( \frac{-h a_0}{c_0} \right) \int \! \Pi _{\chi _1, \chi _2}( \log \xi ; c_0, a_0 ) f(\xi ) \, \mathrm {d}\xi \\&\quad + \frac{1}{c} \sum _{c_0 \mid c} \frac{ {c_0}^\frac{1}{2} }{ [c_0, q_1]^\frac{1}{2} [c_0, q_2]^\frac{1}{2} } \sum _\pm \sum _{n = 1}^\infty T_{\chi _1, \chi _2}( n; c_0, \pm h ) \\&\quad \cdot \int \! B_{\chi _1, \chi _2}^\pm \left( \frac{ (n \xi )^\frac{1}{2} }{ [c_0, q_1]^\frac{1}{2} [c_0, q_2]^\frac{1}{2} } \right) f(\xi ) \, \mathrm {d}\xi . \end{aligned}$$

Proof

The formula follows by encoding the congruence condition via additive characters and then applying Theorem 2.3. \(\square \)

Concerning the Bessel function \( B_{\chi _1, \chi _2}^+(\xi ) \), we want to note the following technical lemma, which describes its behaviour for large \(\xi \) (see [44, Lemma 2.3]).

Lemma 2.5

If \( \xi \gg 1 \), then \( B_{\chi _1, \chi _2}^+(\xi ) \) can be expressed as

$$\begin{aligned} B_{\chi _1, \chi _2}^+(\xi ) = 2 {\text {Re}}\left( e( 2 \xi ) W_{\chi _1, \chi _2}(\xi ) \right) , \end{aligned}$$

where \( W_{\chi _1, \chi _2} : (0, \infty ) \rightarrow {\mathbb {C}}\) is a certain smooth function whose derivatives satisfy the bounds

$$\begin{aligned} W_{\chi _1, \chi _2}^{ (\nu ) }(\xi ) \ll \xi ^{-\frac{1}{2} - \nu } \quad \text {for} \quad \nu \ge 0. \end{aligned}$$

We finish this section with the following result on Gauß sums, which is a special case of [34, Lemma 5.4]. We already made use of it in the proof of Theorem 2.3, but it will also prove useful later when evaluating the sums \( T_{\chi _1, \chi _2}(n; c, h) \).

Lemma 2.6

Let \({\tilde{\chi }}\) mod \({\tilde{q}}\) be a Dirichlet character induced by the primitive character \( \chi \) mod q, and let a be an integer. Assume that \( {\tilde{q}} \mid q^\infty \). Then \( G({\tilde{\chi }}, a) \) vanishes unless \( {\tilde{q}} / q \) divides a, in which case we have

$$\begin{aligned} G({\tilde{\chi }}, a) = {\overline{\chi }}\left( \frac{ a q }{{\tilde{q}}} \right) G(\chi ) \frac{{\tilde{q}}}{q}. \end{aligned}$$

2.4 Approximate functional equations for \( L_{\chi _1, \chi _2}(s) \)

Last but not least we want to state the following smooth approximate functional equation for \( L_{\chi _1, \chi _2}(s) \) which generalizes [23, Theorem 4.2] to Dirichlet L-functions.

Theorem 2.7

Let \(\varepsilon > 0 \). Let \( V : (0, \infty ) \rightarrow [0, \infty ) \) be a smooth function satisfying

$$\begin{aligned} V(\xi ) + V( \xi ^{-1} ) = 1 \quad \text {for} \quad \xi \in (0, \infty ). \end{aligned}$$

Let \( s = \sigma + \mathrm {i}t \in {\mathbb {C}}\) and \( x, y \ge 1 \) be such that \( 1/2 \le \sigma \le 1 \), \( q_1, q_2 \le t \) and \( 4 \pi ^2 xy = q_1 q_2 t^2 \). Then

$$\begin{aligned} L_{\chi _1, \chi _2}(s)= & {} \sum _{n = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n) }{n^s} V\left( \frac{n}{x} \right) + \alpha _{\chi _1, \chi _2}(s) \sum _{n = 1}^\infty \frac{ \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n) }{ n^{1 - s} } V\left( \frac{n}{y} \right) \nonumber \\&+ R_{\chi _1, \chi _2}(s; x, y), \end{aligned}$$
(2.18)

where \( R_{\chi _1, \chi _2}(s; x, y) \) satisfies the following individual bound,

$$\begin{aligned} R_{\chi _1, \chi _2}(s; x, y) \ll (q_1 q_2)^{ \frac{ 3 (1 - \sigma ) }{8} } t^{ -\frac{1 + 3\sigma }{4} + \varepsilon }, \end{aligned}$$
(2.19)

as well as, for \( T \gg \max \{ q_1, q_2 \} \), the following bound on average on the critical line,

$$\begin{aligned} \int _{T/2}^T \left| R_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}t; \tfrac{ t \sqrt{q_1 q_2} }{2\pi }, \tfrac{ t \sqrt{q_1 q_2} }{2\pi } \right) \right| \, \mathrm {d}t \ll T^\varepsilon . \end{aligned}$$
(2.20)

The implicit constants depend at most on V and \(\varepsilon \).

Proof

In the special case \( q_1 = q_2 = 1 \), this result is proven in [23, Theorem 4.2]. The proof can be adapted to our situation without any difficulties via Theorems 2.1 and 2.2. \(\square \)

A similar approximate formula holds for the second sum on the right hand side in (2.18).

Theorem 2.8

Let \(\varepsilon > 0 \) and \( \rho > 1 \). Let \( V : (0, \infty ) \rightarrow [0, \infty ) \), \( s \in {\mathbb {C}}\) and \( x, y \ge 1 \) be as in Theorem 2.7. Then

$$\begin{aligned}&\alpha _{\chi _1, \chi _2}(s) \sum _{n = 1}^\infty \frac{ \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n) }{ n^{1 - s} } V\left( \frac{n}{y} \right) \nonumber \\&\quad = \sum _{n = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n) }{n^s} V\left( \frac{x}{n} \right) V\left( \frac{n}{\rho x} \right) \\&\qquad + \alpha _{\chi _1, \chi _2}(s) \sum _{n = 1}^\infty \frac{ \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n) }{ n^{1 - s} } V\left( \frac{n}{y} \right) V\left( \frac{\rho n}{y} \right) + R_{\chi _1, \chi _2}'(s; x, y), \end{aligned}$$

where \( R_{\chi _1, \chi _2}'(s; x, y) \) satisfies the bounds (2.19) and (2.20).

Proof

As above, this formula can be proven by adapting the proof given in [23, Theorem 4.2]. \(\square \)

3 Background on automorphic forms

The aim of this section is to briefly present the tools coming from the spectral theory of automorphic forms needed in the treatment of the shifted convolution problem in Sect. 4. Apart from the well-known Kuznetsov formula, this in particular includes a certain variant of the large sieve inequalities for Fourier coefficients of automorphic forms.

For a general account of the theoretic background we refer to [14, 27]. In our specific situation we will however rely mainly on the results worked out in [13].

3.1 Fourier coefficients of automorphic forms

Let q and \(q_0\) be positive integers such that \( q_0 \mid q \). In the following, \( \psi \) will always denote a Dirichlet character mod \(q_0\). Let \( \kappa (\psi ) \) be defined as in (2.1). Furthermore, it will be convenient to set

$$\begin{aligned} i(\gamma , z) := cz + d \qquad \text {and} \qquad j(\gamma , z) := \frac{ c z + d }{ |cz + d| } \qquad \text {for} \qquad \gamma = \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix} \in \mathrm {GL}_2({\mathbb {R}}). \end{aligned}$$

Let \( \theta _k(q, \psi ) \) be the dimension of the space of holomorphic cusp forms of weight k with respect to \( \Gamma _0(q) \) and with nebentypus \(\psi \). Note that this space is empty unless \( k \equiv \kappa (\psi ) \bmod 2 \). Let \( f_{j, k}^\psi \)\( 1 \le j \le \theta _k(q, \psi ) \), be an orthonormal basis for this space. Given a singular cusp \( \mathfrak {a} \) with associated scaling matrix \( \sigma _\mathfrak {a} \), we write the Fourier expansion of \( f_{j, k}^\psi \) around \( \mathfrak {a} \) as

$$\begin{aligned} i( \sigma _{\mathfrak {a}}, z )^{-k} f_{j, k}^\psi ( \sigma _{\mathfrak {a}} z) = \frac{ (4\pi )^\frac{k}{2} }{ \sqrt{ (k - 1)! } } \sum _{n = 1}^\infty \lambda _{j, k}^\psi (n, \mathfrak {a}) n^\frac{k - 1}{2} e(nz). \end{aligned}$$

Next, let \( u_j^\psi \)\( j \ge 1 \), be an orthonormal basis of the space of Maaß cusp forms of weight \( \kappa (\psi ) \) with respect to \( \Gamma _0(q) \) and with nebentypus \( \psi \). We can assume that each \( u_j^\psi \) is either even or odd. We denote the corresponding spectral parameters by \( t_j^\psi \), and we write the Fourier expansion of \(u_j^\psi \) around a singular cusp \( \mathfrak {a} \) as

$$\begin{aligned} j( \sigma _{\mathfrak {a}}, z )^{ -\kappa (\psi ) } u_j^\psi ( \sigma _{\mathfrak {a}} z) = \sqrt{ \cosh (\pi t_j^\psi ) } \sum _{n \ne 0} \rho _j^\psi ( n, \mathfrak {a} ) n^{-\frac{1}{2}} W_{ \frac{n}{ |n| } \frac{ \kappa (\psi ) }{2}, \mathrm {i}t_j^\psi }(4 \pi |n| y) e(nx), \end{aligned}$$

where \( W_s(\xi ) \) denotes the Whittaker function as defined in [27, (1.26)]. Note that we can choose the spectral parameters in such a way that either \( t_j^\psi \in [0, \infty ) \) or \( \mathrm {i}t_j^\psi \in [0, \infty ) \). The spectral parameters which satisfy the latter condition are called exceptional. It is widely believed that Maaß cusp forms with exceptional spectral parameter do not exist, although this has not been proven so far. Let \( \theta \in [0, \infty ) \) be such that \( \mathrm {i}t_j^\psi \le \theta \) for all exceptional \( t_j^\psi \), uniformly for all levels q and any nebentypus \(\psi \). By the work of Kim and Sarnak [30], we know that the value

$$\begin{aligned} \theta = \frac{7}{64} \end{aligned}$$

is admissible.

Lastly, we write the Fourier expansion of the Eisenstein series \( E_\mathfrak {c}^\psi ( z; 1/2 + \mathrm {i}t ) \) of weight \( \kappa (\psi ) \) with respect to \( \Gamma _0(q) \) and with nebentypus \( \psi \), associated to the singular cusp \( \mathfrak {c} \), around a singular cusp \( \mathfrak {a} \) as

$$\begin{aligned}&j(\sigma _\mathfrak {a}, z)^{ -\kappa (\psi ) } E_\mathfrak {c}^\psi \left( \sigma _{\mathfrak {a}} z; \tfrac{1}{2} + \mathrm {i}t \right) \\&\quad = c_{ \mathfrak {c}, 1 }^\psi (t) y^{\frac{1}{2} + \mathrm {i}t} + c_{ \mathfrak {c}, 2 }^\psi (t) y^{\frac{1}{2} - \mathrm {i}t} \\&\qquad + \sqrt{ \cosh (\pi t) } \sum _{n \ne 0} \varphi _{ \mathfrak {c}, t }^\psi ( n, \mathfrak {a} ) n^{-\frac{1}{2}} W_{ \frac{n}{ |n| } \frac{ \kappa (\psi ) }{2}, \mathrm {i}t }(4 \pi |n| y) e(nx). \end{aligned}$$

Note that the normalization of the Fourier coefficients used here differs from the one used in [13, 45], from where we will cite some results further below.

3.2 Bounds for Kloosterman sums

Let \( \mathfrak {a} \) and \( \mathfrak {b} \) be cusps of \( \Gamma _0(q) \) which are singular with respect to all characters \( \psi \) mod \( q_0 \), and let \( \sigma _\mathfrak {a} \) and \( \sigma _\mathfrak {b} \) be their associated scaling matrices. For \( m, n \in {\mathbb {Z}}\) and \( c \in (0, \infty ) \) the Kloosterman sum associated to \( \mathfrak {a} \) and \( \mathfrak {b} \) is defined as

$$\begin{aligned} S_{\mathfrak {a} \mathfrak {b}}^\psi (m, n; c) := \sum _{ d \bmod c {\mathbb {Z}}} {\overline{\chi }}\left( \sigma _\mathfrak {a} \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix} {\sigma _\mathfrak {b}}^{-1} \right) e\left( m \frac{a}{c} + n \frac{d}{c} \right) , \end{aligned}$$

where the sum runs over all d mod \( c {\mathbb {Z}}\) for which there exist a and b such that

$$\begin{aligned} \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix} \in {\sigma _\mathfrak {a}}^{-1} \Gamma _0(q) \sigma _\mathfrak {b}. \end{aligned}$$

Note that this definition depends on the particular choice of the associated scaling matrices. Furthermore, depending on the choice of c the sum may well be empty.

Of particular importance are the sums with \( \mathfrak {a} = \mathfrak {b} \), as they come up in the proof of the large sieve inequalities. In the following, we will focus on a particular set of cusps \( \mathfrak {a} \), namely

$$\begin{aligned} \mathfrak {A} := \{ \infty \} \cup \left\{ u/w \in {\mathbb {Q}}: u, w \in {\mathbb {Z}}_{\ge 1}, \,\, (u, w) = 1, \,\, w \mid q, \,\, \left( w, q/w \right) = 1 \right\} , \end{aligned}$$

since they are easier to work with from a technical point of view, and since they cover all the cases we need. Note that all the cusps in \( \mathfrak {A} \) are singular with respect to all characters mod \( q_0 \).

As can be deduced from [13, Lemma 4.1], the sum \( S_{\mathfrak {a} \mathfrak {a}}^\psi (m, n; c) \) for \( \mathfrak {a} \in \mathfrak {A} \) is non-empty exactly when c is an integer divisible by q, in which case we have

$$\begin{aligned} \left| S_{\mathfrak {a} \mathfrak {a}}^\psi (m, n; c) \right| = \left| S_\psi (m, n; c) \right| , \end{aligned}$$
(3.1)

where \( S_\psi (m, n; c) \) is the usual twisted Kloosterman sum,

$$\begin{aligned} S_\psi (m, n; c) := \sum _{\begin{array}{c} a \bmod c \\ (a, c) = 1 \end{array}} \psi (a) e\left( \frac{ ma + n {\overline{a}} }{c} \right) . \end{aligned}$$

Concerning upper bounds, we know by (3.1) and [31, Theorem 9.2] that

$$\begin{aligned} S_{\mathfrak {a} \mathfrak {a}}^\psi (m, n; c) \ll (m, n, c)^\frac{1}{2} ( q_0 c )^{\frac{1}{2} + \varepsilon }. \end{aligned}$$

The factor \( {q_0}^{1/2} \) appearing on the right hand side is unfavorable, but in general cannot be omitted (see [31, Example 9.9]). However, it effectively disappears if we include a further averaging over all characters \(\psi \) mod \(q_0\).

Lemma 3.1

Let \( \varepsilon > 0 \). Let c and \(q_0\) be positive integers such that \( q_0 \mid c \), let \( m, n \in {\mathbb {Z}}\) and let \(\mathfrak {a} \in \mathfrak {A} \). Then

$$\begin{aligned} \frac{1}{ \varphi (q_0) } \sum _{\psi \bmod q_0} \left| S_{\mathfrak {a} \mathfrak {a}}^\psi (m, n; c) \right| ^2 \ll (m, n, c) c^{1 + \varepsilon }, \end{aligned}$$
(3.2)

where the implicit constant depends only on \( \varepsilon \).

Proof

By (3.1) it is enough to consider the case of usual twisted Kloosterman sums. Moreover, by twisted multiplicativity of Kloosterman sums (see e.g. [31, Proposition 9.13]) it is enough to consider the case when c and \(q_0\) are powers of a prime p. Hence, let \( c = p^\ell \) and \( q_0 = p^{\ell _0} \) with \( \ell _0 \le \ell \), and let k be the largest integer such that \( p^k \mid (m, n) \).

If \( \ell _0 < \ell - k \), then by [31, Propositions 9.7 and 9.8] we have

$$\begin{aligned} S_\psi (m, n; c) \ll p^{ \frac{k + \ell }{2} + \varepsilon } = (m, n, c)^\frac{1}{2} c^{\frac{1}{2} + \varepsilon }, \end{aligned}$$

and (3.2) follows immediately. If \( \ell _0 \ge \ell - k \), then we have by orthogonality of Dirichlet characters,

$$\begin{aligned} \frac{1}{ \varphi (q_0) } \sum _{\psi \bmod q_0} \left| S_\psi ( m, n; c ) \right| ^2&= \sum _{\begin{array}{c} a_1, a_2 \bmod c \\ a_1 \equiv a_2 \bmod q_0 \end{array}} e\left( \frac{ (a_1 - a_2) m + ( \overline{a_1} - \overline{a_2} ) n }{c} \right) \\&= \sum _{\begin{array}{c} a_1, a_2 \bmod c \\ a_1 \equiv a_2 \bmod q_0 \end{array}} 1, \end{aligned}$$

so that

$$\begin{aligned} \frac{1}{ \varphi (q_0) } \sum _{\psi \bmod q_0} \left| S_\psi ( m, n; c ) \right| ^2 \le \frac{c^2}{q_0} = p^{2\ell - \ell _0} \le p^{k + \ell } = (m, n, c) c, \end{aligned}$$

and we see that (3.2) also holds in this case. \(\square \)

3.3 The Kuznetsov formula

Let \( f : (0, \infty ) \rightarrow {\mathbb {C}}\) be a smooth and compactly supported function. Given a Dirichlet character \( \psi \) mod \(q_0\), we define the following integral transforms of f,

$$\begin{aligned} {\tilde{f}}(t)&:= \frac{ 2\pi \mathrm {i}t^{ \kappa (\psi ) } }{ \sinh (\pi t) } \int _0^\infty \! \left( J_{2\mathrm {i}t}(\eta ) - (-1)^{ \kappa (\psi ) } J_{-2\mathrm {i}t}(\eta ) \right) f(\eta ) \, \frac{d\eta }{\eta }, \end{aligned}$$
(3.3)
$$\begin{aligned} {\check{f}}(t)&:= 8 \mathrm {i}^{ -\kappa (\psi ) } \cosh (\pi t) \int _0^\infty \! K_{2\mathrm {i}t}(\eta ) f(\eta ) \, \frac{d\eta }{\eta }, \end{aligned}$$
(3.4)
$$\begin{aligned} \dot{f}(k)&:= 4 \mathrm {i}^k \int _0^\infty \! J_{k - 1}(\eta ) f(\eta ) \, \frac{d\eta }{\eta }. \end{aligned}$$
(3.5)

Note that these integral transforms depend on the parity of the character \(\psi \), even though we do not indicate this in the notation.

The Kuznetsov formula then reads as follows (see [45, Theorem 2.3]).

Theorem 3.2

Let \( f : (0, \infty ) \rightarrow {\mathbb {C}} \) be a smooth and compactly supported function, let \( \mathfrak {a}, \mathfrak {b} \in \mathfrak {A} \), let \( \psi \) mod \(q_0\) be a Dirichlet character, and let mn be positive integers. Then

$$\begin{aligned} \sum _c \frac{ S_{\mathfrak {a} \mathfrak {b}}^\psi (m, n; c) }{c} f\left( 4\pi \frac{ \sqrt{mn} }{c} \right) =&\sum _{j = 1}^\infty {\tilde{f}}(t_j^\psi ) \overline{ \rho _j^\psi (m, \mathfrak {a}) } \rho _j^\psi (n, \mathfrak {b}) \\&+ \sum _{ \mathfrak {c} \text { sing.} } \frac{1}{4\pi } \int _{-\infty }^\infty \! {\tilde{f}}(t) \overline{ \varphi _{ \mathfrak {c}, t }^\psi ( m, \mathfrak {a} ) } \varphi _{\mathfrak {c}, t }^\psi ( n, \mathfrak {b} ) \, \mathrm {d}t \\&+ \sum _{\begin{array}{c} k > \kappa (\psi ) \\ k \equiv \kappa (\psi ) \bmod 2 \\ 1 \le j \le \theta _k(q, \psi ) \end{array}} \!\!\!\! \dot{f}(k) \overline{ \lambda _{j, k}^\psi (m, \mathfrak {a}) } \lambda _{j, k}^\psi ( n, \mathfrak {b} ), \end{aligned}$$

and

$$\begin{aligned} \sum _c \frac{ S_{\mathfrak {a} \mathfrak {b}}^\psi (m, -n; c) }{c} f\left( 4\pi \frac{ \sqrt{mn} }{c} \right) =&\sum _{j = 1}^\infty {\check{f}}(t_j^\psi ) \overline{ \rho _j^\psi (m, \mathfrak {a}) } \rho _j^\psi (-n, \mathfrak {b}) \\&+ \sum _{ \mathfrak {c} \text { sing.} } \frac{1}{4\pi } \int _{-\infty }^\infty \! {\check{f}}(t) \overline{ \varphi _{ \mathfrak {c}, t }^\psi ( m, \mathfrak {a} ) } \varphi _{\mathfrak {c}, t }^\psi ( -n, \mathfrak {b} ) \, \mathrm {d}t, \end{aligned}$$

where c runs over all positive real numbers for which \( S_{\mathfrak {a} \mathfrak {b}}^\psi (m, \pm n; c) \) is non-empty.

Assume that q is of the form \( q = rs \) for positive coprime integers r and s with \( q_0 \mid r \). If we consider the cusps \( \mathfrak {a} = \infty \) and \( \mathfrak {b} = 1/s \), together with associated scaling matrices

$$\begin{aligned} \sigma _\infty = \begin{pmatrix} 1 &{} 1 \\ &{} 1 \end{pmatrix} \qquad \text {and} \qquad \sigma _{1/s} = \begin{pmatrix} \sqrt{r} &{} 1 \\ s \sqrt{r} &{} \sqrt{r}^{-1} \end{pmatrix}, \end{aligned}$$

then the left hand sides of the two formulae in Theorem 3.2 Concerning equation (3.6):

$$\begin{aligned} \sum _c \frac{ S_{\infty 1/s}^\psi (m, \pm n; c) }{c} f\left( 4\pi \frac{ \sqrt{mn} }{c} \right) = e\left( \frac{ \pm n \overline{s} }{r} \right) \sum _{ (c, r) = 1 } {\overline{\psi }}(c) \frac{ S\left( m, \pm n {\overline{r}}; sc \right) }{ \sqrt{r} sc } f\left( 4\pi \frac{ \sqrt{mn} }{ \sqrt{r} sc } \right) .\nonumber \\ \end{aligned}$$
(3.6)

It is in this specific form that we will use the Kuznetsov formula in Sect. 4.

3.4 Large sieve inequalities

The aim of this section is to deduce a variant of the large sieve inequalities for Fourier coefficients of automorphic forms adapted to our specific setting. We could in principle use [13, Proposition 4.7], however the factor \( {q_0}^{1/2} \) appearing there is disadvantageous in our situation. As we will show, this factor can be removed by averaging over all \( \psi \) mod \(q_0\).

Let \( \mathfrak {a} \in \mathfrak {A} \) and \( N \ge 1 \). For each \( \psi \) mod \(q_0\), let \( a_n^\psi \) be a sequence of complex numbers supported in \( N/2 < n \le N \), and set

$$\begin{aligned} \Vert a_N^\psi \Vert := \sum _{ N/2 < n \le N } \max _{\psi \bmod q_0} | a_n^\psi |^2. \end{aligned}$$

Furthermore, let

$$\begin{aligned} \Sigma _{1, \pm }^\psi (j)&:= \sum _{ N/2< n \le N } a_n^\psi \rho _j^\psi ( \pm n, \mathfrak {a} ), \qquad \Sigma _{2, \pm }^\psi (\mathfrak {c}, t) := \sum _{ N/2< n \le N } a_n^\psi \varphi _{ \mathfrak {c}, t }^\psi ( \pm n, \mathfrak {a} ), \\ \Sigma _3^\psi (j, k)&:= \sum _{ N/2 < n \le N } a_n^\psi \lambda _{j, k}^\psi ( n, \mathfrak {a} ). \end{aligned}$$

Then the following variant of the large sieve inequalities holds.

Theorem 3.3

Let \( \varepsilon > 0 \). Let \( T, N \ge 1 \) and \( \mathfrak {a} \in \mathfrak {A} \). Let \( a_n^\psi \) be as described above. Then

$$\begin{aligned} \frac{1}{ \varphi (q_0) } \sum _{\psi \bmod q_0} \sum _{ | t_j^\psi | \le T } ( 1 + |t_j^\psi | )^{ \pm \kappa (\psi ) } \left| \Sigma _{1, \pm }^\psi (j) \right| ^2&\ll \left( T^2 + \frac{ N^{1 + \varepsilon } }{q} \right) \Vert a_N^\psi \Vert , \\ \frac{1}{ \varphi (q_0) } \sum _{\psi \bmod q_0} \sum _{ \mathfrak {c} \text { sing.} } \int _{-T}^T \! ( 1 + |t| )^{ \pm \kappa (\psi ) } \left| \Sigma _{2, \pm }^\psi (\mathfrak {c}, t) \right| ^2 \, \mathrm {d}t&\ll \left( T^2 + \frac{ N^{1 + \varepsilon } }{q} \right) \Vert a_N^\psi \Vert , \\ \frac{1}{ \varphi (q_0) } \sum _{ \psi \bmod q_0 } \sum _{\begin{array}{c} \kappa (\psi ) < k \le T \\ k \equiv \kappa (\psi ) \bmod 2 \end{array}} \sum _{ 1 \le j \le \theta _k(q, \psi ) } \left| \Sigma _3^\psi (j, k) \right| ^2&\ll \left( T^2 + \frac{ N^{1 + \varepsilon } }{q} \right) \Vert a_N^\psi \Vert , \end{aligned}$$

where the implicit constants depend only on \( \varepsilon \).

Proof

The proof is in large parts identical to the proof of the original large sieve inequalities as given by Deshouillers and Iwaniec [12, Theorem 2], and its generalization to arbitrary nebentypus as worked out by Drappeau [13, Proposition 4.7]. We will therefore restrict ourselves to pointing out the main differences.

Let \( \kappa _0 \in \{ 0, 1 \} \), \( \vartheta \in (0, \infty ) \) and \( \lambda \in [0, \infty ) \), and set

$$\begin{aligned} B_\mathfrak {a}(\lambda , \vartheta , c, N) := \frac{1}{ \varphi (q_0) } \! \sum _{\begin{array}{c} \psi \bmod q_0 \\ \kappa (\psi ) = \kappa _0 \end{array}} \sum _{\begin{array}{c} N/2< n_1 \le N \\ N/2 < n_2 \le N \end{array}} \!\! a_{n_1}^\psi \overline{ a_{n_2}^\psi } e^{ -\lambda \sqrt{n_1 n_2} } S_{\mathfrak {a} \mathfrak {a}}^\psi (n_1, n_2, c) e\left( 2 \frac{ \sqrt{n_1 n_2} }{c} \vartheta \right) . \end{aligned}$$

Then we have the following bounds for this expression,

$$\begin{aligned} | B_\mathfrak {a}(\lambda , \vartheta , c, N) |&\ll c^{\frac{1}{2} + \varepsilon } N \Vert a_N^\psi \Vert , \end{aligned}$$
(3.7)
$$\begin{aligned} | B_\mathfrak {a}(\lambda , \vartheta , c, N) |&\ll ( c + N + \sqrt{\vartheta c N} ) \Vert a_N^\psi \Vert , \end{aligned}$$
(3.8)
$$\begin{aligned} | B_\mathfrak {a}(\lambda , \vartheta , c, N) |&\ll \vartheta ^{-\frac{1}{2}} c^\frac{1}{2} N^{\frac{1}{2} + \varepsilon } \Vert a_N^\psi \Vert \qquad \qquad \text {(for } \vartheta< 2 \, \hbox {and}\, c < N ), \end{aligned}$$
(3.9)

with all the implicit constants depending at most on \(\varepsilon \). Here the first bound (3.7) is a direct consequence of Lemma 3.1, while (3.8) and (3.9) are proven in [13, Lemma 4.6].

From this point on we can follow the proof of [13, Proposition 4.7], always taking into account the extra summation over \( \psi \). We leave the details to the reader. \(\square \)

When taking care of the exceptional eigenvalues, the following weighted large sieve inequality will be useful.

Theorem 3.4

Let \( \varepsilon > 0 \). Let \( 1 \le N \le q^2 \) and \( \mathfrak {a} \in \mathfrak {A} \). Let \( a_n^\psi \) be as described above. Then

$$\begin{aligned} \frac{1}{ \varphi (q_0) } \sum _{\psi \bmod q_0} \sum _{ t_j^\psi ~\text {exc.} } \left( \frac{q}{ N^\frac{1}{2} } \right) ^{4 \mathrm {i}t_j^\psi } \left| \Sigma _{1, \pm }^\psi ( j ) \right| ^2 \ll q^\varepsilon N^{1 + \varepsilon } \Vert a_N^\psi \Vert , \end{aligned}$$

where the implicit constant depends only on \( \varepsilon \).

Proof

This result is a direct consequence of the Cauchy–Schwarz inequality and the following estimate,

$$\begin{aligned} \frac{1}{ \varphi (q_0) } \sum _{\begin{array}{c} \psi \bmod q_0 \\ \kappa (\psi ) = \kappa _0 \end{array}} \sum _{ t_j^\psi \text {exc.} } \left( \frac{q}{ n^\frac{1}{2} } \right) ^{4\mathrm {i}t_j^\psi } \big | \rho _j^\psi (\pm n, \mathfrak {a}) \big |^2 \ll (qn)^\varepsilon (q, n)^\frac{1}{2}, \end{aligned}$$

where \( \kappa _0 \in \{ 0, 1 \} \). It can be proven in the same way as [28, (16.58)] with the difference that in order to bound the Kloosterman sums, Lemma 3.1 has to be used instead of Weil’s bound. \(\square \)

4 A shifted convolution problem

In this section, we consider the shifted convolution problem which is at the heart of the proof of Theorems 1.11.6.

As usual, let \( \chi _1 \) mod \(q_1\) and \( \chi _2 \) mod \(q_2\) be primitive Dirichlet characters, and set \( q_1^*:= \left( q_1, {q_2}^\infty \right) \) and \( q_2^*:= \left( q_2, {q_1}^\infty \right) \). Furthermore, let \( \delta > 0 \) be a fixed constant, let \( \alpha , N, H \ge 1 \) be real numbers satisfying the condition

$$\begin{aligned} \alpha ^\frac{2}{3} H \le N^{1 - \delta }, \end{aligned}$$
(4.1)

and let \( f : (0, \infty ) \times {\mathbb {R}}\rightarrow {\mathbb {C}}\) be a smooth weight function, compactly supported in either

$$\begin{aligned} {\text {supp}}f \subset [ N/4, 2 N ] \times [ H/4, 2 H ] \qquad \text {or} \qquad {\text {supp}}f \subset [ N/4, 2 N ] \times [ -2H, -H/4 ], \end{aligned}$$

and with derivatives satisfying the bounds

$$\begin{aligned} \frac{ \partial ^{\nu _1 + \nu _2} }{ \partial \xi ^{\nu _1} \partial \eta ^{\nu _2} } f(\xi , \eta ) \ll \frac{1}{ N^{\nu _1} H^{\nu _2} } \quad \text {for} \quad \nu _1, \nu _2 \ge 0. \end{aligned}$$
(4.2)

We are then interested in the following shifted convolution sum

$$\begin{aligned} D_{\chi _1, \chi _2}(f, \alpha ) := \sum _h \frac{1}{h} \sum _n \tau _{\chi _1, \chi _2}(n) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n + h) f(n, h) e\left( \alpha \frac{h}{n} \right) , \end{aligned}$$

and our aim will be to prove the following asymptotic formula.

Proposition 4.1

Let \( \delta , \varepsilon > 0 \). Let \( f, \alpha , N, H \) be as described above. Then

$$\begin{aligned} D_{\chi _1, \chi _2}(f, \alpha ) =&\sum _h \frac{1}{h} \int \! Q_{\chi _1, \chi _2}( \log \xi , \log (\xi + h); h ) f(\xi , h) e\left( \alpha \frac{h}{\xi }\right) \, \mathrm {d}\xi \\&+ O\Bigg ( \left( { q_1^*}^{ 1 - 4 \theta } q_1 + { q_2^*}^{1 - 4\theta } q_2 \right) ^\frac{1}{2} [q_1, q_2]^{\frac{1}{2} - 2\theta } N^{\frac{1}{2} + \theta + \varepsilon } \\&+ ( q_1^*q_1 + q_2^*q_2 )^\frac{1}{2} [q_1, q_2]^\frac{1}{2} N^{\frac{1}{2} + \varepsilon } \bigg ( 1 + \alpha \frac{ H^\frac{1}{2} }{N} \bigg ) \Bigg ), \end{aligned}$$

where \( Q_{\chi _1, \chi _2}(X_1, X_2; h) \) is a polynomial in \(X_1\) and \(X_2\) of degree at most 2 with coefficients depending only on \(\chi _1\), \(\chi _2\) and h. The implicit constant depends at most on \( \delta \), \( \varepsilon \) and the implicit constants in (4.2).

Remember that \(\theta \) denotes the bound in the Ramanujan-Petersson conjecture (see Sect. 3.1). Here we are only concerned with the evaluation of the sum over n, while we will take care of the remaining sum over h at a later stage. Nevertheless, the additional average over h will simplify some of the estimations in the proof.

The polynomial \( Q_{\chi _1, \chi _2}(X_1, X_2; h) \) can be stated in fairly explicit terms. Let

$$\begin{aligned} \psi _z(q) := \sum _{d \mid q} \frac{ \mu (d) }{ d^{1 + z} }, \qquad Z_q(z) := \psi _z(q) z \zeta (z + 1) \qquad \text {and} \qquad \Delta _z := \frac{\partial }{\partial z} \bigg |_{z = 0}. \end{aligned}$$
(4.3)

Then, if \( \chi _1 = \chi _2 \), it is the quadratic polynomial given by Concerning equation (4.4)

$$\begin{aligned} Q_{\chi _1, \chi _2}(\log \xi _1, \log \xi _2; h) := \Delta _{z_1} \Delta _{z_2} {\xi _1}^{z_1} {\xi _2}^{z_2} Z_{q_1}(2 z_1) Z_{q_2}(2 z_2) \frac{ r_{q_1}(h) }{q_1} \!\!\! \sum _{\begin{array}{c} c = 1 \\ (c, q_1) = 1 \end{array}}^\infty \! \frac{ r_c(h) }{ c^{2 + 2 z_1 + 2 z_2} },\nonumber \\ \end{aligned}$$
(4.4)

while if \( \chi _1 \ne \chi _2 \), it is simply a constant, namely, in the case \( q_1 = q_2 \),

$$\begin{aligned} \begin{aligned} Q_{\chi _1, \chi _2}(X_1, X_2; h) :={}&2 \left| L( 1, \chi _1 \overline{\chi _2} ) \right| ^2 \frac{ r_{q_1}(h) }{q_1} \sum _{\begin{array}{c} c = 1 \\ (c, q_1) = 1 \end{array}}^\infty \frac{ r_c(h) }{ c^2 } \\ {}&+ L( 1, \overline{\chi _1} \chi _2 )^2 \frac{ G( \overline{\chi _1} \chi _2, h) }{ \overline{ G(\chi _1) } G( \chi _2 ) } \sum _{c = 1}^\infty \frac{ r_c(h) ( \overline{\chi _1} \chi _2 )^2(c) }{ c^2 } \\ {}&+ L( 1, \chi _1 \overline{\chi _2} )^2 \frac{ G( \chi _1 \overline{\chi _2}, h) }{ G(\chi _1) \overline{ G( \chi _2 ) } } \sum _{c = 1}^\infty \frac{ r_c(h) ( \chi _1 \overline{\chi _2} )^2(c) }{ c^2 }, \end{aligned} \end{aligned}$$

and, in the case \( q_1 \ne q_2 \),

$$\begin{aligned} Q_{\chi _1, \chi _2}(X_1, X_2; h) := \left| L(1, \overline{\chi _1} \chi _2 ) \right| ^2 \sum _{\begin{array}{c} c = 1 \\ (c, q_1) = 1 \end{array}}^\infty \frac{ r_{c q_2}(h) }{c^2 q_2} + \left| L( 1, \chi _1 \overline{\chi _2} ) \right| ^2 \sum _{\begin{array}{c} c = 1 \\ (c, q_2) = 1 \end{array}}^\infty \frac{ r_{c q_1}(h) }{c^2 q_1}. \end{aligned}$$

4.1 Initial transformations

Let \( u : (0, \infty ) \rightarrow [0, 1] \) be a smooth and compactly supported weight function which satisfies the conditions

$$\begin{aligned} {\text {supp}}u \subset [ 1/2, 2 ] \qquad \text {and} \qquad \sum _{j \in {\mathbb {Z}}} u\left( \frac{\xi }{2^j} \right) = 1 \quad \text {for} \quad \xi \in (0, \infty ). \end{aligned}$$
(4.5)

We set

$$\begin{aligned} u_0(\xi ) := \sum _{i \le 0} u\left( \frac{8\xi }{2^i \sqrt{N} } \right) \qquad \text {and} \qquad u_j(\xi ) = u\left( \frac{8\xi }{ 2^j \sqrt{N} } \right) \quad \text {for} \quad j \ge 1. \end{aligned}$$

We start the proof of Proposition 4.1 by opening the divisor function \( \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n) \) and localizing the two new variables in dyadic intervals via the smooth partition of unity defined above. This way our original sum \( D_{\chi _1, \chi _2}(f, \alpha ) \) is split up into the sums

$$\begin{aligned} \begin{aligned} D_{j_1, j_2} :=&\sum _{n_1, n_2, h} \overline{\chi _1}(n_1) \overline{\chi _2}(n_2) \tau _{\chi _1, \chi _2}(n_1 n_2 - h) \\&\cdot u_{j_1}(n_1) u_{j_2}(n_2) \frac{ f(n_1 n_2 - h, h) }{h} e\left( \alpha \frac{h}{n_1 n_2 - h} \right) , \end{aligned} \end{aligned}$$
(4.6)

with \(j_1\) and \(j_2\) ranging over \( 0 \le j_1, j_2 \ll \log N \). Note that \( D_{0, 0} \) is empty.

Since the expression (4.6) is symmetric in \(n_1\) and \(n_2\), we can assume without loss of generality that \( j_2 \ge 1 \). The variables \(n_1\) and \(n_2\) are then supported in the ranges

$$\begin{aligned} n_1 \asymp N_1 \qquad \text {and} \quad \quad n_2 \asymp N_2 \qquad \text {with} \qquad N_2 := 2^{j_2 - 3} N^{1/2}, \quad N_1 := N / N_2, \end{aligned}$$

and we have \( N_1 \ll N^{1/2} \ll N_2 \).

In \( D_{j_1, j_2} \) we split the variable \(n_2\) into residue classes modulo \(q_2\), so that the sum becomes

$$\begin{aligned} D_{j_1, j_2} = \sum _{n_1, h} \overline{\chi _1}(n_1) \sum _{a_2 \bmod q_2} \overline{\chi _2}(a_2) \sum _{ m \equiv n_1 a_2 - h \bmod n_1 q_2 } \tau _{\chi _1, \chi _2}(m) g_{n_1, h}(m), \end{aligned}$$

with

$$\begin{aligned} g_{n_1, h}(\xi ) := u_{j_1}(n_1) u_{j_2}\left( \frac{ \xi + h }{n_1} \right) \frac{ f( \xi , h ) }{h} e\left( \alpha \frac{h}{\xi }\right) . \end{aligned}$$

At this point, we use Theorem 2.4 to evaluate the sum over m, and get

$$\begin{aligned} D_{j_1, j_2} = \Sigma _{j_1, j_2}^0 + \Sigma _{j_1, j_2}^+ + \Sigma _{j_1, j_2}^-, \end{aligned}$$

where \( \Sigma _{j_1, j_2}^0 \) takes the form

$$\begin{aligned} \begin{aligned} \Sigma _{j_1, j_2}^0 :={}&\frac{1}{ q_2 } \sum _{n, h} \frac{ \overline{\chi _1}(n) }{n} \sum _{c \mid n q_2} \frac{1}{c} \sum _{\begin{array}{c} a_0 \bmod c \\ (a_0, c) = 1 \end{array}} e\left( \frac{ a_0 h }{c} \right) G\left( \overline{\chi _2}, -a_0 \frac{n q_2}{c} \right) \\ {}&\cdot \int \! \Pi _{\chi _1, \chi _2}( \log \xi ; c, a_0 ) g_{n, h}(\xi ) \, \mathrm {d}\xi , \end{aligned} \end{aligned}$$
(4.7)

and where the other two sums are given by

$$\begin{aligned} \begin{aligned} \Sigma _{j_1, j_2}^\pm :={}&\frac{1}{ q_2 } \sum _{n, h} \frac{ \overline{\chi _1}(n) }{n} \sum _{ c \mid n q_2 } \sum _{m = 1}^\infty \frac{ (c q_2)^\frac{1}{2} K_{\chi _1, \chi _2}^\pm (m, n, h, c) }{ [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} } \\ {}&\cdot \int \! B_{\chi _1, \chi _2}^\pm \left( \frac{ (m \xi )^\frac{1}{2} }{ [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} } \right) g_{n, h}(\xi ) \, \mathrm {d}\xi , \end{aligned} \end{aligned}$$

with

$$\begin{aligned} K_{\chi _1, \chi _2}^\pm (m, n, h, c) := \frac{1}{ {q_2}^\frac{1}{2} } \sum _{a_2 \bmod q_2} \overline{\chi _2}(a_2) T_{\chi _1, \chi _2}( m; c, \pm ( n a_2 - h ) ). \end{aligned}$$
(4.8)

As we will show in Sect. 4.5, the contribution coming from the terms \( \Sigma _{j_1, j_2}^0 \) together forms the main term in Proposition 4.1. We will however first focus on the other two sums \( \Sigma _{j_1, j_2}^\pm \). Once more it will be advantageous to localize the variable m in a dyadic interval, so instead of looking at these sums directly, we will consider

$$\begin{aligned} \Sigma _{j_1, j_2}^\pm (M) :=&\sum _{m, n, h} \frac{ \overline{\chi _1}(n) }{n} u\left( \frac{m}{M} \right) \sum _{ c \mid n q_2 } \frac{ c^\frac{1}{2} K_{\chi _1, \chi _2}^\pm (m, n, h, c) }{ {q_2}^\frac{1}{2} [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} } \\&\cdot \int \! B_{\chi _1, \chi _2}^\pm \left( \frac{ (m \xi )^\frac{1}{2} }{ [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} } \right) g_{n, h}(\xi ) \, \mathrm {d}\xi , \end{aligned}$$

with the weight function u as defined in (4.5).

4.2 Evaluation of \( K_{\chi _1, \chi _2}^\pm (m, n, h, c) \)

Before going any further, we first need to evaluate the exponential sum (4.8) and express it in terms of Kloosterman sums. This will allow us afterwards to make use of the Kuznetsov formula.

We decompose the moduli \(q_1\) and \(q_2\) as follows,

$$\begin{aligned} q_1^*:= \left( q_1, {q_2}^\infty \right) , \quad q_2^*:= \left( q_2, {q_1}^\infty \right) \qquad \text {and} \qquad q_1^\circ := q_1 / q_1^*, \quad q_2^\circ := q_2 / q_2^*, \end{aligned}$$

and accordingly write the Dirichlet characters \( \chi _1 \) and \( \chi _2 \) as

$$\begin{aligned} \chi _i = \chi _i^*\chi _i^\circ \quad \text {with} \quad \chi _i^*\bmod q_i^*\quad \text {and} \quad \chi _i^\circ \bmod q_i^\circ . \end{aligned}$$

Note that the characters \( \chi _1^*\), \( \chi _1^\circ \), \( \chi _2^*\) and \( \chi _2^\circ \) are all primitive. We also set

$$\begin{aligned} h = h^*h^\circ \quad \text {with} \quad h^*:= (h, q_2^*) \quad \text {and} \quad h^\circ := h / h^*. \end{aligned}$$

Furthermore, we define the quantity

$$\begin{aligned} \kappa _{\chi _1, \chi _2} := \chi _1^*\overline{\chi _2^*}(q_1^\circ q_2^\circ ) \chi _1^\circ \overline{\chi _2^\circ }( [q_1^*, q_2^*] ) \frac{ G( \chi _1^\circ \overline{\chi _2^\circ } ) }{ \sqrt{ q_1^\circ q_2^\circ } }, \end{aligned}$$

as well as the exponential sum

$$\begin{aligned} E_{\chi _1, \chi _2}(m; \psi )&:= \frac{ {\overline{\psi }}( q_1^\circ {q_2^\circ }^2 ) \overline{ G(\psi ) } }{ \sqrt{ q_2^*/ h^*} } \! \sum _{m_1 m_2 = m} \! \frac{ \overline{\chi _1^\circ } \chi _2^\circ (m_1) G( \chi _1^*\overline{ \chi _2^*\psi }, m_1 ) }{ \sqrt{ q_2^*[q_1^*, q_2^*] } } \\&\quad \cdot \sum _{ a \bmod q_2^*} \psi \chi _2^*(a) \overline{\chi _2^*}( a + m_2 ), \end{aligned}$$

where \(\psi \) is a Dirichlet character mod \( q_2^*/ h^*\).

With the necessary notation set up, we can now state the main result of this section.

Lemma 4.2

The sum \( K_{ \chi _1, \chi _2 }^\pm (m, n, h, c) \) vanishes unless \( (c, q_1 q_2) = q_2 \), in which case we have

$$\begin{aligned} K_{ \chi _1, \chi _2 }^\pm (m, n, h, c)&= \chi _2(\mp 1) \chi _1(n) \kappa _{\chi _1, \chi _2} \frac{ {q_2^*}^\frac{1}{2} }{ {h^*}^\frac{1}{2} } \frac{1}{ \varphi (q_2^*/ h^*) } \sum _{ \psi \bmod q_2^*/ h^*} E_{\chi _1, \chi _2}(m; \psi ) \\&\qquad \cdot \psi (\mp h^\circ ) \overline{\chi _1} \chi _2 \left( \frac{n q_2}{c} \right) \overline{\psi ^2}\left( \frac{c}{q_2} \right) \frac{ S( \mp h^*h^\circ , \overline{ q_2^*[q_1, q_2^*] } m ; c / q_2^*) }{ (c / q_2^*)^\frac{1}{2} }, \end{aligned}$$

where \( \psi \) runs over all Dirichlet characters mod \( q_2^*/ h^*\).

Proof

Remember that \( (n, q_1) = 1 \). Since \( c \mid n q_2 \), the sum over \( a_2 \) in (4.8) is simply a Gauß sum mod \(q_2\), which can be evaluated directly. Hence \( K_{ \chi _1, \chi _2 }^\pm (m, n, h, c) \) becomes

$$\begin{aligned} K_{\chi _1, \chi _2}^\pm (m, n, h, c) = \chi _2\left( \mp \frac{ n q_2 }{c} \right) \frac{ G( \overline{\chi _2} ) }{ {q_2}^\frac{1}{2} } \sum _{m_1 m_2 = m} \frac{ {\tilde{K}}_{\chi _1, \chi _2}(m_1, m_2, \pm h, c) }{ c^\frac{1}{2} [c, q_1]^\frac{1}{2} [c, q_2]^\frac{1}{2} }, \end{aligned}$$
(4.9)

with

$$\begin{aligned} \begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}(m_1, m_2, f, c) :=&\sum _{\begin{array}{c} a \bmod c \\ (a, c) = 1 \end{array}} \sum _{\begin{array}{c} b_1 \bmod [c, q_1] \\ b_2 \bmod [c, q_2] \end{array}} \chi _1(b_1) \chi _2(a b_2) \\&\cdot e\left( \frac{ a ( b_1 b_2 + f ) }{c} + \frac{m_1 b_1}{ [c, q_1] } + \frac{m_2 b_2}{ [c, q_2] } \right) . \end{aligned} \end{aligned}$$
(4.10)

In particular, we see that the sum vanishes unless \( q_2 \) divides c. Moreover, we have the condition \( \left( c / q_2, q_1 \right) = 1 \).

In view of this, we write the variable c as

$$\begin{aligned} c = c_0 c_2 q_2 \quad \text {with} \quad c_2 := \left( c / q_2, {q_2}^\infty \right) \quad \text {and} \quad c_0 := c / ( c, {q_2}^\infty ). \end{aligned}$$

Note that with these definitions we have \( (c_0, q_1 q_2) = (c_2, q_1) = 1 \). We write the variables a\(b_1\) and \(b_2\) inside (4.10) accordingly as

figure a

so that \( {\tilde{K}}_{\chi _1, \chi _2}(m_1, m_2, f, c) \) takes the form

$$\begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}(m_1, m_2, f, c) = \chi _1 {\chi _2}^2 (c_0) {\tilde{K}}_{\chi _1, \chi _2}^{ (1) } {\tilde{K}}_{\chi _1, \chi _2}^{ (2) }, \end{aligned}$$
(4.11)

with

$$\begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}^{ (1) }&:= \sum _{\begin{array}{c} a_0 \bmod c_0 \\ (a_0, c_0) = 1 \end{array}} \sum _{\begin{array}{c} d_1 \bmod c_0 \\ d_2 \bmod c_0 \end{array}} e\left( \frac{ {c_2}^2 q_2 [q_1, q_2] a_0 d_1 d_2 + f a_0 + m_1 d_1 + m_2 d_2 }{ c_0 } \right) , \\ {\tilde{K}}_{\chi _1, \chi _2}^{ (2) }&:= \sum _{\begin{array}{c} a_2 \bmod c_2 q_2 \\ u_1 \bmod c_2 [q_1, q_2] \\ u_2 \bmod c_2 q_2 \end{array}} \chi _1(u_1) \chi _2(a_2 u_2) e\left( \frac{ {c_0}^2 a_2 u_1 u_2 + f a_2 + m_2 u_2 }{c_2 q_2} + \frac{ m_1 u_1 }{ c_2 [q_1, q_2] } \right) . \end{aligned}$$

In \( {\tilde{K}}_{\chi _1, \chi _2}^{ (1) } \), we evaluate the sum over \( d_2 \) and the whole expression immediately simplifies to

$$\begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}^{ (1) } = c_0 S\big ( -\overline{c_2 q_2^\circ } f, \overline{ c_2 q_2^*[q_1, q_2] } m_1 m_2; c_0 \big ). \end{aligned}$$
(4.12)

In \( {\tilde{K}}_{\chi _1, \chi _2}^{ (2) } \), we evaluate the sum over \( u_2 \) via Lemma 2.6 and get

$$\begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}^{ (2) } = c_2 G(\chi _2) \!\!\!\!\!\!\!\!\! \sum _{\begin{array}{c} a_2 \bmod c_2 q_2 \\ u_1 \bmod c_2 [q_1, q_2] \\ a_2 u_1 \equiv - \overline{c_0}^2 m_2 \bmod c_2 \end{array}} \!\!\!\!\!\!\!\!\! \chi _2(a_2) \chi _1(u_1) \overline{\chi _2}\left( \frac{ {c_0}^2 a_2 u_1 + m_2 }{c_2} \right) e\left( \frac{ f a_2 }{c_2 q_2} + \frac{ m_1 u_1 }{ c_2 [q_1, q_2] } \right) . \end{aligned}$$

Here we write the variables \(a_2\) and \(u_1\) as

$$\begin{aligned} a_2 = a^*c_2 q_2^\circ + a^\circ q_2^*\qquad \text {and} \qquad u_1 = u^*q_1^\circ q_2^\circ c_2 + v [q_1^*, q_2] c_2 + u^\circ [q_1, q_2^*], \end{aligned}$$

with

$$\begin{aligned} a^\circ \bmod c_2 q_2^\circ , \quad a^*\bmod q_2^*\quad \text {and} \quad u^\circ \bmod c_2 q_2^\circ , \quad v \bmod q_1^\circ , \quad u^*\bmod [q_1^*, q_2^*], \end{aligned}$$

so that

$$\begin{aligned} \begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}^{ (2) }&= \overline{\chi _1^\circ }(m_1) \chi _1^\circ ( c_2 [q_1^*, q_2] ) \chi _1^*( c_2 q_1^\circ q_2^\circ ) \chi _2^\circ (q_2^*) \overline{\chi _2^*}( q_1^\circ {c_0}^2 q_2^\circ ) \\&\cdot c_2 G(\chi _1^\circ ) G(\chi _2) \tilde{K}_{\chi _1, \chi _2}^{ (2 \text{ a}) } {\tilde{K}}_{\chi _1, \chi _2}^{ (2 \text{ b}) }, \end{aligned} \end{aligned}$$
(4.13)

with

$$\begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}^{ (2 \text{ a}) }&:= \! \sum _{\begin{array}{c} a^\circ , u^\circ \bmod c_2 q_2^\circ \\ a^\circ u^\circ \equiv - m_2 \bmod c_2 \end{array}} \! \chi _2^\circ (a^\circ ) \overline{\chi _2^\circ }\left( \frac{ a^\circ u^\circ + m_2 }{c_2} \right) e\bigg ( \frac{ f a^\circ + m_1 \overline{ {c_0}^2 q_2^*[q_1, q_2^*] } u^\circ }{ c_2 q_2^\circ } \bigg ), \\ {\tilde{K}}_{\chi _1, \chi _2}^{ (2 \text{ b}) }&:= \! \sum _{\begin{array}{c} a^*\bmod q_2^* \\ u^*\bmod [q_1^*, q_2^*] \end{array}} \! \chi _1^*(u^*) \chi _2^*(a^*) \overline{\chi _2^*}( a^*u^*+ m_2 ) e\bigg ( \frac{ f \overline{ q_1^\circ (c_0 c_2 q_2^\circ )^2 } a^*}{q_2^*} \bigg ) e\bigg ( \frac{ m_1 u^*}{ [q_1^*, q_2^*] } \bigg ). \end{aligned}$$

In the first sum \( {\tilde{K}}_{\chi _1, \chi _2}^{ (2 \text{ a}) } \), we make the substitution \( u^\circ \mapsto \overline{ a^\circ } ( u^\circ - m_2 ) \), which leads to

$$\begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}^{ (2 \text{ a}) } = \chi _2^\circ (m_1) \overline{\chi _2^\circ }( {c_0}^2 q_2^*[q_1, q_2^*] ) G( \overline{\chi _2^\circ } ) S( -\overline{c_0} f, \overline{ c_0 q_2^*[q_1, q_2^*] } m_1 m_2 ; c_2 q_2^\circ ). \end{aligned}$$
(4.14)

In order to evaluate the second sum \( {\tilde{K}}_{\chi _1, \chi _2}^{ (2 \text{ b}) } \), we factorize f as follows,

$$\begin{aligned} f = f^*f^\circ \quad \text {with} \quad f^*:= (f, q_2^*) \quad \text {and} \quad f^\circ := f / f^*, \end{aligned}$$

and then express the first exponential in terms of Dirichlet characters mod \( q_2^*/ f^*\),

$$\begin{aligned} e\bigg ( \frac{ f \overline{ q_1^\circ (c_0 c_2 q_2^\circ )^2 } a^*}{q_2^*} \bigg ) = \frac{1}{ \varphi (q_2^*/ f^*) } \sum _{ \psi \bmod q_2^*/ f^*} \psi ( - f^\circ \overline{ q_1^\circ (c_0 c_2 q_2^\circ )^2 } a^*) \overline{ G(\psi ) }. \end{aligned}$$

This way we get Concerning equation (4.15):

$$\begin{aligned} {\tilde{K}}_{\chi _1, \chi _2}^{ (2 \text{ b}) } = \frac{ q_2^*[q_1^*, q_2^*]^\frac{1}{2} }{ {f^*}^\frac{1}{2} \varphi (q_2^*/ f^*) } \sum _{ \psi \bmod q_2^*/ f^*} \psi (-f^\circ ) {\overline{\psi }}( q_1^\circ (c_0 c_2 q_2^\circ )^2 ) {\tilde{E}}_{\chi _1, \chi _2}(m_1, m_2; \psi ),\qquad \end{aligned}$$
(4.15)

with

$$\begin{aligned} {\tilde{E}}_{\chi _1, \chi _2}(m_1, m_2; \psi ) := \frac{ G( \chi _1^*\overline{ \chi _2^*\psi }, m_1 ) \overline{ G(\psi ) } }{ (q_2^*/ f^*)^\frac{1}{2} {q_2^*}^\frac{1}{2} [q_1^*, q_2^*]^\frac{1}{2} } \sum _{ a \bmod q_2^*} \psi \chi _2^*(a) \overline{\chi _2^*}( a + m_2 ). \end{aligned}$$

Eventually, the lemma follows from (4.9)–(4.15). \(\square \)

We conclude the section with the following bound for \( E_{\chi _1, \chi _2}(m; \psi ) \).

Lemma 4.3

We have

$$\begin{aligned} \left| E_{\chi _1, \chi _2}(m; \psi ) \right| \le (m, q_1 q_2) \tau (m). \end{aligned}$$

Proof

This is a direct consequence of the fact that

$$\begin{aligned} \left| G( \chi _1^*\overline{ \chi _2^*\psi }, m_1 ) \right|&\le ( m_1, q_1^*q_2^*)^\frac{1}{2} [q_1^*, q_2^*]^\frac{1}{2}, \end{aligned}$$

as can be seen from [34, Lemma 5.4], and the bound

$$\begin{aligned} \Bigg | \sum _{ a \bmod q_2^*} \psi \chi _2^*(a) \overline{\chi _2^*}( a + m_2 ) \Bigg |&\le (m_2, q_2^*)^\frac{1}{2} {q_2^*}^\frac{1}{2}, \end{aligned}$$

proven in [40, Theorem 2.2]. \(\square \)

4.3 Technical preparations

Now that we have expressed the sum \( \Sigma _{j_1, j_2}^\pm (M) \) as a sum of Kloosterman sums, the next step would be to apply the Kuznetsov formula. However, before we can do so, some technical preparations need to be done first.

Let \( \iota _0 := 1 \) or \( \iota _0 := -1 \) depending on whether h is supported on the positive or negative real numbers. Using Lemma 4.2 we write the sum \( \Sigma _{j_1, j_2}^\pm (M) \) as

$$\begin{aligned} \Sigma _{j_1, j_2}^\pm (M) = \chi _2(\mp 1) \kappa _{\chi _1, \chi _2} \sum _{h^*\mid q_2^*} \sum _{n_0} \frac{ \overline{\chi _1} \chi _2(n_0) }{n_0} \Xi _{j_1, j_2}^\pm (M), \end{aligned}$$

where

$$\begin{aligned} \Xi _{j_1, j_2}^\pm (M)&:= \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{\begin{array}{c} h, m \\ (h, h^*) = 1 \end{array}} \psi (\mp \iota _0 h) E_{\chi _1, \chi _2}(m; \psi ) \\&\quad \cdot \sum _{ ( c, q_1 ) = 1 } \overline{\psi ^2}(c) \frac{ S( \mp \iota _0 h, \overline{ h^*[q_1, q_2^*] } m ; c q_2^\circ ) }{ c \sqrt{ h^*q_2^\circ [q_1, q_2] } } F_{h, m}^\pm \left( \frac{ 4\pi }{c} \sqrt{ \frac{ hm }{ h^*q_2^\circ [q_1, q_2] } } \right) , \end{aligned}$$

with

$$\begin{aligned} F_{h, m}^\pm (\eta )&:= \int \! B_{\chi _1, \chi _2}^\pm \left( \frac{ \eta \xi }{4 \pi } \right) U_{h, m}(\eta , \xi ) e\left( \iota _0 \frac{\alpha }{\xi ^2} \right) \, \mathrm {d}\xi , \end{aligned}$$

and

$$\begin{aligned} U_{h, m}(\eta , \xi )&:= \iota _0 \frac{ \xi \eta }{ 2\pi } \sqrt{ \frac{ {h^*}^3 [q_1, q_2] }{ q_2^*hm } } u\left( \frac{m}{M} \right) f\left( \xi ^2 h \frac{ q_2^*}{ h^*}, \iota _0 h \frac{q_2^*}{h^*} \right) \\&\quad \cdot u_{j_1}\left( 4\pi \frac{ n_0 }{ \eta } \sqrt{ \frac{ hm }{ h^*q_2^\circ [q_1, q_2] } } \right) u_{j_2}\left( \frac{ \eta ( \xi ^2 + \iota _0 ) }{ 4\pi n_0 } \sqrt{ \frac{ h q_2^*q_2 [q_1, q_2] }{h^*m} } \right) . \end{aligned}$$

We also set

$$\begin{aligned} E := \frac{ h^*H }{ q_2^*}, \quad C := \frac{N_1}{n_0}, \end{aligned}$$

and

$$\begin{aligned} F_0 := \frac{ h^*N }{ {q_2}^\frac{1}{2} H C}, \quad X := \sqrt{ \frac{N}{H} }, \quad Y := \frac{4\pi }{C} \sqrt{ \frac{HM}{ q_2 [q_1, q_2] } }, \quad Z := XY. \end{aligned}$$

With this notation, the sums over h, m and c are supported in the intervals

$$\begin{aligned} |h| \in [ E/4, 2E ], \quad m \in [ M/4, 2 M ], \quad c \in [ C/9, 9C ], \end{aligned}$$

while the variables \(\xi \) and \(\eta \) are of the size

$$\begin{aligned} \xi \in [ X/3, 3X ], \quad \eta \in [ Y/120, 120Y ], \end{aligned}$$

provided that N is sufficiently large. Also, note that the summation variable \(n_0\) is bounded by \( n_0 \ll N_1 \), and that \( C \ll N^{1/2} \).

We next want to show that the sums \( \Sigma _{j_1, j_2}^\pm (M) \) become negligibly small when M is in certain ranges. Let \( \varepsilon _0 > 0 \) be an arbitrarily small but fixed constant, and set

$$\begin{aligned} M_0^- := N^{\varepsilon _0} \frac{ q_2 [q_1, q_2] }{16\pi ^2 N} C^2 \qquad \text {and} \qquad M_0^+ := \frac{ q_2 [q_1, q_2] }{16\pi ^2 N} C^2 \left( \frac{\alpha H}{N} \right) ^2. \end{aligned}$$

If M satisfies the bound \( M > M_0^- \), which is equivalent to saying that \( Z > N^{\varepsilon _0 / 2} \), then by well-known properties of the \(K_0\)-Bessel function (see e.g. [27, (B.36)]), we have

$$\begin{aligned} F_{h, m}^-(\eta ) \ll F_0 \exp \bigg ( {-} \frac{ N^{ \varepsilon _0 / 4 } M^{1/2} }{10} \bigg ). \end{aligned}$$

Hence the contribution coming from the sums \( \Sigma _{j_1, j_2}^-(M) \) for such large M is negligible. By consequence, when looking at \( \Sigma _{j_1, j_2}^-(M) \) we can safely assume that \( M \ll M_0^- \).

Similarly, if \( M > M_0^- \), then we can express \( F_{h, m}^+(\eta ) \) by Lemma 2.5 as

$$\begin{aligned} F_{h, m}^+(\eta )= & {} \int \! \bigg ( W_{\chi _1, \chi _2}\bigg ( \frac{ \xi \eta }{ 4 \pi } \bigg ) U_{h, m}(\eta , \xi ) e\bigg ( \frac{ \iota _0 \alpha }{\xi ^2} + \frac{ \xi \eta }{ 2 \pi } \bigg ) \\&+ \overline{ W_{\chi _1, \chi _2}\bigg ( \frac{ \xi \eta }{ 4 \pi } \bigg ) } U_{h, m}(\eta , \xi ) e\bigg ( \frac{ \iota _0 \alpha }{\xi ^2} - \frac{ \xi \eta }{ 2 \pi } \bigg ) \bigg ) \mathrm {d}\xi . \end{aligned}$$

If we now make the additional assumption that

$$\begin{aligned} \alpha X^{-3} \ge 10^6 Y \quad \text {or} \quad \alpha X^{-3} \le 10^{-6} Y, \end{aligned}$$
(4.16)

then

$$\begin{aligned} \left| \frac{\partial }{\partial \xi } \bigg ( \iota _0 \frac{ \alpha }{\xi ^2} \pm \frac{ \xi \eta }{ 2 \pi } \bigg ) \right| = \left| -2 \iota _0 \frac{\alpha }{\xi ^3} \pm \frac{\eta }{ 4\pi } \right| \ge \frac{Y}{10^4}, \end{aligned}$$

so that by integrating by parts over \(\xi \) repeatedly it follows that, for any \( \nu \),

$$\begin{aligned} F_{h, m}^+(\eta ) \ll F_0 Z^{-\nu } \ll F_0 N^{ -\varepsilon _0 \nu / 4 } M^{-\nu / 2}. \end{aligned}$$

Hence we see that the contribution coming from those sums \( \Sigma _{j_1, j_2}^+(M) \) where M satisfies both \( M > M_0^- \) and (4.16) is negligible. When looking at \( \Sigma _{j_1, j_2}^+(M) \) we can therefore assume that M is either bounded by \( M \ll M_0^- \), or that it satisfies the two conditions \( M \gg M_0^- \) and \( Y \asymp \alpha X^{-3} \). Note that the latter condition \( Y \asymp \alpha X^{-3} \) is equivalent to saying that \( M \asymp M_0^+ \).

Due to technical reasons it is necessary to separate the variables h and m via Fourier inversion. To this end, we define

$$\begin{aligned} G_{\rho , \lambda }^\pm (\eta )&:= \frac{1}{ G_{\rho , \lambda }^0 } \iint \! F_{h, m}^\pm (\eta ) e( -\rho h - \lambda m ) \, \mathrm {d}h \mathrm {d}m \end{aligned}$$

with

$$\begin{aligned} G_{\rho , \lambda }^0&:= \frac{ E M}{ (1 + \rho ^2 E^2) (1 + \lambda ^2 M^2) }, \end{aligned}$$

so that

$$\begin{aligned} \Xi _{j_1, j_2}^\pm (M)= & {} \iint \! G_{\rho , \lambda }^0 \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{\begin{array}{c} h, m \\ (h, h^*) = 1 \end{array}} \psi (\mp \iota _0 h) e(\rho h) E_{\chi _1, \chi _2}(m; \psi ) e(\lambda m) \\&\cdot \sum _{ ( c, q_1 ) = 1 } \overline{\psi ^2}(c) \frac{ S( \mp \iota _0 h, \overline{ h^*[q_1, q_2^*] } m ; c q_2^\circ ) }{ c \sqrt{ h^*q_2^\circ [q_1, q_2] } } G_{\rho , \lambda }^\pm \left( \frac{ 4\pi }{c} \sqrt{ \frac{ hm }{ h^*q_2^\circ [q_1, q_2] } } \right) \, \mathrm {d}\rho \, \mathrm {d}\lambda . \end{aligned}$$

Last but not least, we need estimates for the integral transforms of \( G_{\rho , \lambda }^\pm \) as defined in (3.3)–(3.5). Note that in our case it suffices to consider the integral transforms associated to even characters.

We start with the case \( M \le M_0^- \).

Lemma 4.4

Assume that \( M \le M_0^- \). Then we have, for any \( \nu \ge 0 \),

$$\begin{aligned} {\tilde{G}}_{\rho , \lambda }^\pm (\mathrm {i}t), {\check{G}}_{\rho , \lambda }^\pm (\mathrm {i}t)&\ll \frac{ F_0 }{ Y^{2t} } \quad&\text {for} \quad 0 \le t \le 1/4, \end{aligned}$$
(4.17)
$$\begin{aligned} {\tilde{G}}_{\rho , \lambda }^\pm (t), {\check{G}}_{\rho , \lambda }^\pm (t), \dot{G}_{\rho , \lambda }^\pm (t)&\ll N^\varepsilon F_0 \left( \frac{N^\varepsilon }{t} \right) ^\nu \quad&\text {for} \quad t > 0. \end{aligned}$$
(4.18)

Proof

It is clearly sufficient to look directly at the function \( F_{h, m}^\pm (\eta ) \) and its first two partial derivatives in h and m. Noting that \( Y \ll 1 \), and that

$$\begin{aligned} {\text {supp}}F_{h, m}^\pm \subset [ Y/120, 120 Y ] \qquad \text {and} \qquad F_{h, m}^{ \pm (\nu ) }(\eta ) \ll N^\varepsilon F_0 ( N^\varepsilon / Y )^\nu \quad \text {for} \quad \nu \ge 0, \end{aligned}$$

we apply [5, Lemma 2.1] on \( F_{h, m}^\pm (\eta ) \) and its partial derivatives in h and m, and (4.17) and (4.18) eventually follow. \(\square \)

Next, we consider the case \( M > M_0^- \), which requires a more delicate analysis. As argued above, this only involves the function \( F_{h, m}^+(\eta ) \), and we can assume that \( M \asymp M_0^+ \). Remember that now we also have \( Z > N^{\varepsilon _0 / 2} \).

Lemma 4.5

Assume that \( M > M_0^- \) and \( M \asymp M_0^+ \). Then we have, for any \( \nu \ge 0 \),

$$\begin{aligned} {\tilde{G}}_{\rho , \lambda }^+(\mathrm {i}t), {\check{G}}_{\rho , \lambda }^+(\mathrm {i}t)&\ll \frac{F_0}{N^\nu } \quad&\text {for} \quad 0 \le t \le 1/4, \end{aligned}$$
(4.19)
$$\begin{aligned} {\tilde{G}}_{\rho , \lambda }^+(t), {\check{G}}_{\rho , \lambda }^+(t), \dot{G}_{\rho , \lambda }^+(t)&\ll N^\varepsilon \frac{ F_0 }{ Z^2 } \left( \frac{Z}{t} \right) ^\nu \quad&\text {for} \quad t > 0. \end{aligned}$$
(4.20)

Proof

As before, it is enough to consider the function \( F_{h, m}^+(\eta ) \) and its first two partial derivatives in h and m. We will restrict our attention here to \( F_{h, m}^+(\eta ) \) itself, since the analogous bounds for its derivatives can be derived similarly. Moreover, we will make the additional assumption \( \iota _0 = -1 \), since the other case \( \iota _0 = 1 \) can be treated almost identically.

We start by using Lemma 2.5 to write \( F_{h, m}^+(\eta ) \) as

$$\begin{aligned} F_{h, m}^+(\eta ) = \Phi ^+(\eta ) + \Phi ^-(\eta ) \qquad \text {with} \qquad \Phi ^\pm (\eta ) := \int \! V_\xi ^\pm (\eta ) e\bigg ( {-}\frac{\alpha }{\xi ^2} \pm \frac{ \xi \eta }{ 2 \pi } \bigg ) \, \mathrm {d}\xi , \end{aligned}$$

where \( V_\xi ^+(\eta ) \) and \( V_\xi ^-(\eta ) \) are given by

$$\begin{aligned} V_\xi ^+(\eta ) := W_{\chi _1, \chi _2}\left( \frac{ \xi \eta }{ 4 \pi } \right) U_{h, m}(\eta , \xi ) \qquad \text {and} \qquad V_\xi ^-(\eta ) := \overline{ W_{\chi _1, \chi _2}\left( \frac{ \xi \eta }{ 4 \pi } \right) } U_{h, m}(\eta , \xi ). \end{aligned}$$

Note that

$$\begin{aligned} {\text {supp}}V_\xi ^\pm \subset [ Y/120, 120 Y ] \qquad \text {and} \qquad V_\xi ^{ \pm (\nu ) }(\eta ) \ll F_0 X^{-1} Z^{-\frac{1}{2}} Y^{-\nu } \quad \text {for} \quad \nu \ge 0. \end{aligned}$$

Furthermore, the assumption (4.1) ensures that \( Y \ll N^{-\varepsilon } \). Hence we can apply [44, Lemma 2.6] on the function \( V_\xi ^\pm (\eta ) e( \pm (2\pi )^{-1} \xi \eta ) \), and get

figure b

This proves the first bound (4.19), but also the second bound (4.20) in the range \( t \gg N^\varepsilon Z \).

It thus remains to estimate the integral transforms of \( \Phi ^\pm (\eta ) \) for \( t \ll N^\varepsilon Z \). In \( \Phi ^+(\eta ) \), we integrate by parts over \(\xi \) once and then apply one more time [44, Lemma 2.6]. This gives

$$\begin{aligned} {\tilde{\Phi }}^+(t), {\check{\Phi }}^+(t), {\dot{\Phi }}^+(t) \ll N^\varepsilon F_0 Z^{-5/2} \quad \text {for} \quad t > 0, \end{aligned}$$
(4.21)

which is sufficiently small. Unfortunately, we cannot repeat this procedure to get bounds for the integral transforms of \( \Phi ^-(\eta ) \), since the argument of the exponential in \( \Phi ^-(\eta ) \) may vanish. Instead, we will estimate the integral transforms manually via a stationary phase argument, and show that

$$\begin{aligned} {\tilde{\Phi }}^-(t), {\check{\Phi }}^-(t), {\dot{\Phi }}^-(t) \ll N^\varepsilon F_0 Z^{-2} \quad \text {for} \quad t > 0. \end{aligned}$$
(4.22)

We begin with \( {\tilde{\Phi }}^-(t) \). It will be convenient to have a smooth bump function of a certain shape at hand. To this end, we let \( v_0 : {\mathbb {R}}\rightarrow [0, 1] \) be a smooth and compactly supported function such that

$$\begin{aligned} v_0(\xi ) = 1 \quad \text {for} \quad |\xi | \le 1 \qquad \text {and} \qquad v_0(\xi ) = 0 \quad \text {for} \quad |\xi | \ge 2, \end{aligned}$$

and furthermore define \( v_1(\xi ) := 1 - v_0(\xi ) \).

Assume first that \( t \ll N^\varepsilon \). Using [17, 8.411.11], we write \( {\tilde{\Phi }}^-(t) = I^+ + I^- \) with

$$\begin{aligned} I^\pm = -\iint \!\!\! \int _1^\infty \! \cos (2t {\text {arcosh}}\zeta ) \frac{ V_\xi ^-(\eta ) }{ { \eta \sqrt{\zeta ^2 - 1} } } e\bigg ( {-}\frac{\alpha }{\xi ^2} - \frac{ \xi \eta }{ 2 \pi } \pm \frac{ \eta \zeta }{2\pi } \bigg ) \, \mathrm {d}\zeta \mathrm {d}\eta \mathrm {d}\xi . \end{aligned}$$

Integrating by parts over \(\eta \) repeatedly shows that the integral \( I^- \) is arbitrarily small. We split the other integral into two parts \( I^+ = I_0^+ + I_1^+ \) with

$$\begin{aligned} I_j^+ = -\iint \!\!\! \int _1^\infty \! \cos (2t {\text {arcosh}}\zeta ) v_j\left( \frac{ \xi - \zeta }{X/12} \right) \frac{ V_\xi ^-(\eta ) }{ { \eta \sqrt{\zeta ^2 - 1} } } e\bigg ( {-}\frac{\alpha }{\xi ^2} - \frac{ \xi \eta }{ 2 \pi } \pm \frac{ \eta \zeta }{2\pi } \bigg ) \, \mathrm {d}\zeta \mathrm {d}\eta \mathrm {d}\xi . \end{aligned}$$

In \( I_1^+ \), we integrate by parts over \( \eta \) repeatedly to see that its size is negligible. In \( I_0^+ \), we observe that \( \zeta \asymp X \) and integrate by parts over \( \zeta \) repeatedly to see that this integral is also negligibly small. Hence (4.22) is certainly true.

Now assume \( N^\varepsilon \ll t \ll N^\varepsilon Z \). Since \( Y \ll N^{-\varepsilon } \), we can use [27, (B.28)] to express the Bessel function \( J_{2\mathrm {i}t}(\eta ) \) inside the integral transform (3.3) as

$$\begin{aligned} J_{2 \mathrm {i}t}(\eta ) = \Gamma (2\mathrm {i}t + 1)^{-1} \eta ^{2\mathrm {i}t} W_t(\eta ), \end{aligned}$$

where \( W_t(\eta ) \) is a certain complex-valued function which, uniformly in t, satisfies the bounds

$$\begin{aligned} W_t^{ (\nu ) }(\eta ) \ll \eta ^{-\nu } \quad \text {for} \quad \nu \ge 0. \end{aligned}$$

It follows that

$$\begin{aligned} {\tilde{\Phi }}^-(t) \ll t^{-\frac{1}{2}} \left( | L^+ | + | L^- | \right) , \end{aligned}$$

with

$$\begin{aligned} L^\pm := \iint \! e\left( A_0^\pm (\xi , \eta ) \right) V_\xi ^-(\eta ) W_{\pm t}(\eta ) \, \frac{\mathrm {d}\xi d\eta }{\eta }\quad \text {and} \quad A_0^\pm (\xi , \eta ) := \pm \frac{ t \log \eta }{\pi }-\frac{\alpha }{\xi ^2} - \frac{\xi \eta }{2\pi }. \end{aligned}$$

Integrating by parts over \( \eta \) repeatedly shows that \( L^- \) is negligibly small. By the same reasoning we see that \( L^+ \) too is negligible, unless t is of the size \( t \asymp Z \) which we will henceforth assume.

We split the double integral \( L^+ \) via the weight functions \(v_0\) and \(v_1\) defined above into four parts \( L^+ = L_{0, 0}^+ + L_{1, 0}^+ + L_{0, 1}^+ + L_{1, 1}^+ \), where

$$\begin{aligned} L_{j_1, j_2}^+ = \iint \! e\left( A_0^+(\xi , \eta ) \right) v_{j_1}\left( \frac{ A_1(\xi , \eta ) }{ N^\varepsilon (X/Y)^\frac{1}{2} } \right) v_{j_2}\left( \frac{ A_2(\xi , \eta ) }{ N^\varepsilon (Y/X)^\frac{1}{2} } \right) V_\xi ^-(\eta ) W_t(\eta ) \, \frac{\mathrm {d}\xi d\eta }{\eta }, \end{aligned}$$

with

$$\begin{aligned} A_1(\xi , \eta ) := \frac{\partial }{\partial \eta } A_0^+(\xi , \eta ) = \frac{t}{\pi \eta } - \frac{\xi }{2\pi } \qquad \text {and} \qquad A_2(\xi , \eta ) := \frac{\partial }{\partial \xi } A_0^+(\xi , \eta ) = \frac{2\alpha }{\xi ^3} - \frac{\eta }{2\pi }. \end{aligned}$$

Integration by parts, either over \(\xi \) or over \(\eta \), shows once more that \( L_{1, 0}^+ \), \( L_{0, 1}^+ \) and \( L_{1, 1}^+ \) are all of negligible size, so that we can focus on the remaining integral \( L_{0, 0}^+ \) .

Here we make the substitution

$$\begin{aligned} ( \xi , \eta ) = \psi (\zeta _1, \zeta _2) \qquad \text {with} \qquad \psi (\zeta _1, \zeta _2) := \left( \alpha _0 + \zeta _1, 2t ( \alpha _0 + \zeta _1 + 2\pi \zeta _2 )^{-1} \right) , \end{aligned}$$

where we have set \( \alpha _0 := (2\pi \alpha )^{1/2} t^{-1/2} \). Note that \( \alpha _0 \asymp X \) and \( (\alpha _0 + \zeta _1) \asymp X \). This gives

$$\begin{aligned} L_{0, 0}^+ \ll \frac{ F_0 }{ Z^\frac{3}{2} } \frac{Y}{X} \iint \! v_0\left( \frac{ A_1( \psi (\zeta _1, \zeta _2) ) }{ N^\varepsilon (X/Y)^\frac{1}{2} } \right) v_0\left( \frac{ A_2( \psi (\zeta _1, \zeta _2) ) }{ N^\varepsilon (Y/X)^\frac{1}{2} } \right) \, \mathrm {d}\zeta _1 \mathrm {d}\zeta _2. \end{aligned}$$

As we will show below, the two integration variables \(\zeta _1\) and \(\zeta _2\) are both supported in \( \zeta _1, \zeta _2 \ll N^\varepsilon (X/Y)^{1/2} \). As a consequence, it follows that \( L_{0, 0}^+ \ll N^\varepsilon F_0 Z^{-3/2} \), which in turn directly leads to (4.22).

Concerning \( A_1( \psi (\zeta _1, \zeta _2) ) \), we have

$$\begin{aligned} A_1( \psi (\zeta _1, \zeta _2)) = \zeta _2, \end{aligned}$$

which immediately confirms that the variable \( \zeta _2 \) is bounded by \( N^\varepsilon (X/Y)^{1/2} \). Concerning \( A_2( \psi (\zeta _1, \zeta _2) ) \), a quick calculation shows that

$$\begin{aligned} A_2( \psi (\zeta _1, \zeta _2)) = -\frac{ t \zeta _1 ( 2\alpha _0 + \zeta _1 ) }{ \pi ( \alpha _0 + \zeta _1 )^3 } + \frac{ 2 \zeta _2 t }{ ( \alpha _0 + \zeta _1 ) ( \alpha _0 + \zeta _1 + 2\pi \zeta _2 ) }. \end{aligned}$$

Since the second summand on the right hand side is bounded by \( N^\varepsilon (Y/X)^{1/2} \), we see that for the expression \( A_2( \psi (\zeta _1, \zeta _2) ) \) to be bounded by \( N^\varepsilon (Y/X)^{1/2} \), we must have

$$\begin{aligned} \frac{ t \zeta _1 ( \zeta _1 + 2\alpha _0 ) }{ \pi ( \zeta _1 + \alpha _0 )^3 } \ll N^\varepsilon \frac{ Y^\frac{1}{2} }{ X^\frac{1}{2} }, \end{aligned}$$

which is possible only if \( \zeta _1 \ll N^\varepsilon (X/Y)^{1/2} \).

The integral transform \( {\check{\Phi }}^-(t) \) can be treated similarly by using suitable integral representations for the Bessel function \( K_{2\mathrm {i}t}(\eta ) \), for example [17, 8.432.4] and [27, (B.32) and (B.34)]. Finally, in order to bound the integral transform \( {\dot{\Phi }}^-(t) \), we express the Bessel function \( J_{k - 1}(\eta ) \) via the integral representation [17, 8.411.1] and then integrate by parts repeatedly over \( \eta \), which already gives the desired bound. This finishes the proof of Lemma 4.5. \(\square \)

4.4 Use of the Kuznetsov formula

We are finally ready to apply the Kuznetsov formula on the sums \( \Xi _{j_1, j_2}^\pm (M) \). Specifically, we will use Theorem 3.2 in the form (3.6) with parameters

$$\begin{aligned} {\tilde{\psi }} := \psi ^2, \quad {\tilde{q}}_0 := h^*, \quad {\tilde{r}} := h^*[q_1, q_2^*], \quad {\tilde{s}} := q_2^\circ , \quad {\tilde{q}} := h^*[q_1, q_2]. \end{aligned}$$

We will give the details only for \( \Xi _{j_1, j_2}^+(M) \) and assume that \( \iota _0 = -1 \), since the other sums and cases can all be treated in the same manner.

Using the Kuznetsov formula as described above leads to

$$\begin{aligned} \Xi ^+_{j_1, j_2}(M) = \iint \! G_{\rho , \lambda }^0 \left( \Xi _1 + \Xi _2 + \Xi _3 \right) \, \mathrm {d}\rho \mathrm {d}\lambda , \end{aligned}$$

where \(\Xi _1\), \(\Xi _2\) and \( \Xi _3 \) are given by

$$\begin{aligned} \Xi _1&:= \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{ j \ge 0 } {\tilde{G}}_{\rho , \lambda }^+\big ( t_j^{\psi ^2} \big ) \overline{ \Sigma _{1 \text{ a }}^\psi (j) } \Sigma _{ 1 \text{ b } }^\psi (j), \\ \Xi _2&:= \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{ \mathfrak {c} \text { sing.} } \frac{1}{4\pi } \int _{-\infty }^\infty \! {\tilde{G}}_{\rho , \lambda }^+(t) \overline{ \Sigma _{2 \text{ a }}^\psi (\mathfrak {c}, t) } \Sigma _{2 \text{ b }}^\psi (\mathfrak {c}, t) \, \mathrm {d}t, \\ \Xi _3&:= \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{\begin{array}{c} k \ge 2, \,\, k \equiv 0 \bmod 2 \\ 1 \le j \le \theta _k( h^*[q_1, q_2], \psi ^2 ) \end{array}} \dot{G}_{\rho , \lambda }^+(k) \overline{ \Sigma _{3 \text{ a }}^\psi (j, k) } \Sigma _{3 \text{ b }}^\psi (j, k), \end{aligned}$$

with

$$\begin{aligned} \Sigma _{1 \text{ a }}^\psi (j)&:= \!\!\! \sum _{ E/4< h \le 2E } \!\!\! A_1^\psi (h) \rho _j^{\psi ^2}( h, \infty ), \quad&\Sigma _{2 \text{ a }}^\psi (j)&:= \!\!\! \sum _{ M/4< m \le 2 M } \!\!\! A_2^\psi (m) \rho _j^{\psi ^2}\left( m, 1 / q_2^\circ \right) , \\ \Sigma _{1 \text{ b }}^\psi (\mathfrak {c}, t)&:= \!\!\! \sum _{ E/4< h \le 2E } \!\!\! A_1^\psi (h) \varphi _{ \mathfrak {c}, t }^{\psi ^2}( h, \infty ), \quad&\Sigma _{2 \text{ b }}^\psi (\mathfrak {c}, t)&:= \!\!\! \sum _{ M / 4< m \le 2 M } \!\!\! A_2^\psi (m) \varphi _{ \mathfrak {c}, t }^{\psi ^2}\left( m, 1 / q_2^\circ \right) , \\ \Sigma _{1 \text{ c }}^\psi (j, k)&:= \!\!\! \sum _{ E/4< h \le 2E } \!\!\! A_1^\psi (h) \lambda _{j, k}^{\psi ^2}( h, \infty ), \quad&\Sigma _{2 \text{ c }}^\psi (j, k)&:= \!\!\! \sum _{ M / 4 < m \le 2 M } \!\!\! A_2^\psi (m) \lambda _{j, k}^{\psi ^2}\left( m, 1 / q_2^\circ \right) , \end{aligned}$$

and

$$\begin{aligned} A_1^\psi (h) := {\overline{\psi }}(h) e(-\rho h), \qquad A_2^\psi (m) := E_{\chi _1, \chi _2}(m; \psi ) e(\lambda m) e\left( -\frac{ \overline{q_2^\circ } m }{ h^*[q_1, q_2^*] } \right) . \end{aligned}$$

We first consider the case \( M \ll M_0^- \). We split the sum \( \Xi _1 \) into three parts,

$$\begin{aligned} \Xi _1 = \frac{1}{ \varphi (h^*) } \sum _{\begin{array}{c} \psi \bmod h^* \\ t_j^{\psi ^2} \le N^\varepsilon \end{array}} (\ldots ) + \frac{1}{ \varphi (h^*) } \sum _{\begin{array}{c} \psi \bmod h^* \\ t_j^{\psi ^2} > N^\varepsilon \end{array}} (\ldots ) + \frac{1}{ \varphi (h^*) } \sum _{\begin{array}{c} \psi \bmod h^* \\ t_j^{\psi ^2} \text {exc.} \end{array}} (\ldots ) =: \Xi _{1 \text{ a }} + \Xi _{1 \text{ b }} + \Xi _{1 \text{ c }}. \end{aligned}$$

By Lemma 4.4 it is clear that the contribution coming from \( \Xi _{1 \text{ b }} \) is negligible. Concerning \( \Xi _{1 \text{ a }} \), we make use of the bound (4.18) and apply Cauchy–Schwarz, so that

$$\begin{aligned} \Xi _{1 \text{ a }} \ll N^\varepsilon F_0 \Bigg ( \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{ t_j^{\psi ^2} \le N^\varepsilon } \left| \Sigma _{1 \text{ a }}^\psi (j) \right| ^2 \Bigg )^\frac{1}{2} \Bigg ( \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{ t_j^{\psi ^2} \le N^\varepsilon } \left| \Sigma _{1 \text{ b }}^\psi (j) \right| ^2 \Bigg )^\frac{1}{2}. \end{aligned}$$

Applying Theorem 3.3 on the sums inside the two factors then leads to

$$\begin{aligned} \Xi _{1 \text{ a }}&\ll N^\varepsilon F_0 \left( 1 + \frac{ E^\frac{1}{2} }{ ( h^*[q_1, q_2] )^\frac{1}{2} } \right) \left( 1 + \frac{M^\frac{1}{2}}{ ( h^*[q_1, q_2] )^\frac{1}{2} } \right) E^\frac{1}{2} M^\frac{1}{2} \\&\ll (q_2^*q_2 [q_1, q_2])^\frac{1}{2} N^{\frac{1}{2} + \varepsilon }. \end{aligned}$$

Note that we have made here implicitly use of the fact that, for a given Dirichlet character \( {\tilde{\psi }} \) mod \(h^*\), there are at most \( {h^*}^\varepsilon \) many Dirichlet characteres \( \psi \) mod \(h^*\) such that \( \psi ^2 = {\tilde{\psi }} \).

For \( \Xi _{1 \text{ c }} \) the same approach leads, for \( H \gg h^*q_2^*[q_1, q_2]^2 \), to

$$\begin{aligned} \Xi _{1 \text{ c }} \ll (q_2^*q_2 [q_1, q_2])^\frac{1}{2} \left( \frac{N}{ ( q_2^*[q_1, q_2] )^2 } \right) ^\theta N^{\frac{1}{2} + \varepsilon }. \end{aligned}$$

For \( H \ll h^*q_2^*[q_1, q_2]^2 \) we make use of Theorem 3.4 instead of Theorem 3.3 to estimate the sum over h, which gives

$$\begin{aligned} \begin{aligned} \Xi _{1 \text { c }}&\ll \frac{ N^\varepsilon F_0 E^\theta }{ (Y h^*[q_1, q_2])^{2\theta } } \Bigg ( \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{ t_j^{\psi ^2} \text{ exc. } } \left( \frac{ h^*[q_1, q_2] }{ E^\frac{1}{2} } \right) ^{ 4\mathrm {i}t_j^{\psi ^2} } \left| \Sigma _{1 \text { a }}^\psi (j) \right| \Bigg )^\frac{1}{2} \\ {}&\quad \cdot \Bigg ( \frac{1}{ \varphi (h^*) } \sum _{ \psi \bmod h^*} \sum _{ t_j^{\psi ^2} \text{ exc. } } \left| \Sigma _{1 \text { b }}^\psi (j) \right| ^2 \Bigg )^\frac{1}{2} \\ {}&\ll ( q_2^*q_2 [q_1, q_2] )^\frac{1}{2} \left( \frac{N}{ ( q_2^*[q_1, q_2] )^2 } \right) ^\theta N^{\frac{1}{2} + \varepsilon }. \end{aligned} \end{aligned}$$

The two other sums \( \Xi _2 \) and \( \Xi _3 \) can be estimated similarly, except that there are no exceptional eigenvalues to be taken care of. The upper bound we get for these two sums is the same as the one for \( \Xi _{1 \text{ a }} \).

Next we look at the case where \( M \gg M_0^- \) and \( M \asymp M_0^+ \). As before we split the sum \( \Xi _1 \) into three parts,

$$\begin{aligned} \Xi _1&= \frac{1}{ \varphi (h^*) } \sum _{\begin{array}{c} \psi \bmod h^* \\ t_j^{\psi ^2} \le N^\varepsilon Z \end{array}} (\ldots ) + \frac{1}{ \varphi (h^*) } \sum _{\begin{array}{c} \psi \bmod h^* \\ t_j^{\psi ^2} > N^\varepsilon Z \end{array}} (\ldots ) + \frac{1}{ \varphi (h^*) } \sum _{\begin{array}{c} \psi \bmod h^* \\ t_j^{\psi ^2} \text {exc.} \end{array}} (\ldots ) \\&=: \Xi _{1 \text{ a }} + \Xi _{1 \text{ b }} + \Xi _{1 \text{ c }}. \end{aligned}$$

By Lemma 4.5 we see that the contribution coming from both the terms \( \Xi _{1 \text{ b }} \) and \( \Xi _{1 \text{ c }} \) is negligible. For \( \Xi _{1 \text{ a }} \) we get in the same way as above, using (4.20), Cauchy–Schwarz and Theorem 3.3,

$$\begin{aligned} \Xi _{1 \text{ a }}&\ll \frac{ N^\varepsilon F_0 }{Z^2} \left( Z + \frac{ E^\frac{1}{2} }{ ( h^*[q_1, q_2] )^\frac{1}{2} } \right) \left( Z + \frac{M^\frac{1}{2}}{ ( h^*[q_1, q_2] )^\frac{1}{2} } \right) E^\frac{1}{2} M^\frac{1}{2} \\&\ll N^\varepsilon (q_2^*q_2 [q_1, q_2])^\frac{1}{2} N^{\frac{1}{2} + \varepsilon } \left( 1 + \alpha \frac{ H^\frac{1}{2} }{N} \right) . \end{aligned}$$

The same bound also holds for \( \Xi _2 \) and \( \Xi _3 \), as can be deduced analogously.

Putting everything together we arrive at

$$\begin{aligned} \Xi _{j_1, j_2}^-(M) \ll ( q_2^*q_2 [q_1, q_2] )^\frac{1}{2} N^{\frac{1}{2} + \varepsilon } \left( 1 + \alpha \frac{ H^\frac{1}{2} }{N} + \frac{ N^\theta }{ ( q_2^*[q_1, q_2] )^{2\theta } } \right) . \end{aligned}$$

This eventually leads to the error term stated in Proposition 4.1

4.5 The main term

It remains to evaluate the main term, which is formed by summing over all the terms (4.7), and which takes the following form,

$$\begin{aligned} M := \frac{1}{2} \sum _h \frac{1}{h} \int \! \sum _{ c = 1 }^\infty \frac{ \overline{\chi _1}(c) A_2(c) B_2(c) + \overline{\chi _2}(c) A_1(c) B_1(c) }{c^2} f( \xi , h ) e\left( \alpha \frac{h}{\xi }\right) \, \mathrm {d}\xi , \end{aligned}$$

with

$$\begin{aligned} A_i(c)&:= \frac{1}{ {q_i}^2 } \sum _{\begin{array}{c} a \bmod c q_i \\ (a, c q_i) = 1 \end{array}} \chi _i(a) e\left( \frac{ ha }{c q_i} \right) \overline{ G( \chi _i ) } \Pi _{\chi _1, \chi _2}( \log \xi ; c q_i, a ), \\ B_1(c)&:= \sum _n \frac{ \chi _1 \overline{\chi _2}(n) }{n} ( 1 + u_0(cn) ) \left( 1 - u_0\left( \frac{ \xi + h }{cn} \right) \right) , \qquad B_2(c) := \overline{ B_1 (c) }. \end{aligned}$$

In the case \( \chi _1 = \chi _2 \), the expression \( A_i(c) \) simplifies to

$$\begin{aligned} A_i(c)&= {q_1}^{-1} \chi _1(c) r_{c q_1}(h) \Delta _{z_1} \xi ^{z_1} Z_{q_1}(2 z_1) c^{-2 z_1}, \end{aligned}$$

while \( B_i(c) \) can be evaluated via a standard counter integration argument, leading to

$$\begin{aligned} B_i(c)&= \Delta _{z_2} ( \xi + h )^{z_2} Z_{q_1}(2 z_2) c^{-2 z_2} + O\left( c^{1 - \varepsilon } N^{-\frac{1}{2} + \varepsilon } \right) . \end{aligned}$$

Put together this immediately leads to the expression stated in (4.4). The other case \( \chi _1 \ne \chi _2 \) can be handled similarly.

5 Proof of Theorems 1.11.6

In this section, we want to prove our main results, Theorems 1.11.6. The general outline of the proof follows the approach described in [23, Chapter 4].

As before we assume \( \chi _1 \) mod \(q_1\) and \( \chi _2 \) mod \(q_2\) to be primitive Dirichlet characters. Let

$$\begin{aligned} q_1^*:= \left( q_1, {q_2}^\infty \right) , \quad q_2^*:= \left( q_2, {q_1}^\infty \right) \quad \text {and} \quad q_0 := \sqrt{q_1 q_2}. \end{aligned}$$

Instead of looking directly at (1.7) and (1.9), it will be advantageous to look at their smooth analogues. Hence, let \( \delta > 0 \) be a fixed constant, let \( T_0 \) and \( \Omega \) be positive real numbers such that

$$\begin{aligned} q_0 \max \{ q_1, q_2 \} \le T_0^{1 - \delta } \qquad \text {and} \qquad {q_0}^\frac{1}{3} {T_0}^{-\frac{1}{3} + \delta } \le \Omega \le 1, \end{aligned}$$

and let \( w : (0, \infty ) \rightarrow [0, \infty ) \) be a smooth weight function, which is compactly supported in

$$\begin{aligned} {\text {supp}}w \subset [ T_0 / 4, 2 T_0 ], \end{aligned}$$

and whose derivatives satisfy the bounds

$$\begin{aligned} w^{ (\nu ) }(t)&\ll (\Omega T_0)^{ -\nu } \quad&\text {for} \quad \nu&\ge 0, \end{aligned}$$
(5.1)

and

$$\begin{aligned} \int \big | w^{ (\nu ) }(t) \big | \, \mathrm {d}t&\ll (\Omega T_0)^{1 - \nu } \quad&\text {for} \quad \nu&\ge 1. \end{aligned}$$
(5.2)

Our principal object of study will then be the smoothed moment

$$\begin{aligned} I_{\chi _1, \chi _2}(w) := \int \left| L_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) \right| ^2 w(t) \, \mathrm {d}t. \end{aligned}$$

Compared with the original expressions (1.7) and (1.9), we use a different normalization in t here, as this will lead to simpler formulae during the proof.

Our aim is to prove the following asymptotic formula.

Proposition 5.1

Let \( \delta , \varepsilon > 0 \). Then

$$\begin{aligned} I_{\chi _1, \chi _2}(w) = \int \! P_{\chi _1, \chi _2}\left( \log \left( \tfrac{2\pi t}{q_0} \right) \right) w(t) \, \mathrm {d}t + O\left( {T_0}^\varepsilon E_{\chi _1, \chi _2}( T_0, \Omega ) \right) , \end{aligned}$$

where \( P_{\chi _1, \chi _2} \) is a polynomial of degree at most 4 whose coefficients depend only on \(\chi _1\) and \(\chi _2\), where \( E_{\chi _1, \chi _2}( T_0, \Omega ) \) is the quantity defined as

$$\begin{aligned} \begin{aligned} E_{\chi _1, \chi _2}( T_0, \Omega ) :={}&\left( {q_0}^\frac{1}{2} + \Omega ^{-\frac{1}{2}} \right) \frac{ ( q_1^*q_1 + q_2^*q_2 )^\frac{1}{2} }{ (q_1, q_2)^\frac{1}{2} } {q_0}^\frac{3}{2} {T_0}^\frac{1}{2} \\ {}&+ \left( { q_1^*}^{1 - 4\theta } q_1 + { q_2^*}^{1 - 4\theta } q_2 \right) ^\frac{1}{2} \frac{ {q_0}^{ 2 - 4\theta } }{ (q_1, q_2)^{\frac{1}{2} - 2\theta } } {T_0}^{\frac{1}{2} + \theta }, \end{aligned} \end{aligned}$$
(5.3)

and where the error depends only on \(\delta \), \( \varepsilon \) and the implicit constants in (5.1) and (5.2).

The polynomial \( P_{\chi _1, \chi _2} \) which appears in the main term is the same polynomial as in Theorems 1.11.6 (we set \( P_\chi := P_{\chi , \chi } \)). We will evaluate it explicitly at the end in Sect. 5.5.

Applying Proposition 5.1 with \( T_0 = (2\pi )^{-1} q_0 T \) and \( \Omega = 1 \) immediately gives Theorems 1.2, 1.4 and 1.6. In order to prove the other results, we again set \( T_0 = (2\pi )^{-1} q_0 T \), and then choose two smooth and compactly supported weight functions \( w^-, w^+ : (0, \infty ) \rightarrow [0, 1] \), such that the first satisfies

$$\begin{aligned} w^-(t) = 1 \quad \text {for} \quad t \in [ (1 + \Omega ) T_0 / 2, (1 - \Omega ) T_0 ], \qquad \!\! w^-(t) = 0 \quad \text {for} \quad t \not \in [T_0/2, T_0], \end{aligned}$$

and such that the second satisfies

$$\begin{aligned} w^+(t) = 1 \quad \text {for} \quad t \in [T_0/2, T_0], \qquad \!\! w^+(t) = 0 \quad \text {for} \quad t \not \in [ (1 - \Omega ) T_0 / 2, (1 + \Omega ) T_0 ]. \end{aligned}$$

Then

$$\begin{aligned} \frac{2\pi }{q_0} I_{\chi _1, \chi _2}( w^- ) \le \int _{T/2}^T \left| L_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^2 \, \mathrm {d}t \le \frac{2\pi }{q_0} I_{\chi _1, \chi _2}( w^+ ), \end{aligned}$$

so that after applying Proposition 5.1 on both sides, we arrive at the following asymptotic formula,

$$\begin{aligned} \int _{T/2}^T \left| L_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}t \right) \right| ^2 \, \mathrm {d}t = \int _{T/2}^T \! P_{\chi _1, \chi _2}(\log t) \, \mathrm {d}t + O\left( \frac{ E_{\chi _1, \chi _2}( q_0 T, \Omega ) }{ q_0 } + \Omega T \right) . \end{aligned}$$

Now Theorems 1.1, 1.3 and 1.5 follow with the choice

$$\begin{aligned} \Omega = (q_1, q_2)^{-\frac{1}{3}} \left( q_1^*q_1 + q_2^*q_2 \right) ^\frac{1}{3} (q_1 q_2)^\frac{1}{3} T^{-\frac{1}{3}}. \end{aligned}$$

5.1 An approximative formula for \( | L_{\chi _1, \chi _2}(s) |^2 \)

As a first step towards the proof of Proposition 5.1, we will develop here an approximative formula for \( | L_{\chi _1, \chi _2}(s) |^2 \) on the critical line.

In order to state the exact result, we first choose a smooth weight function \( V : (0, \infty ) \rightarrow [0, 1] \) which satisfies the conditions

$$\begin{aligned} V(\xi ) + V( \xi ^{-1} ) = 1 \quad \text {for} \quad \xi > 0 \qquad \text {and} \qquad V(\xi ) = 0 \quad \text {for} \quad \xi \ge 2. \end{aligned}$$
(5.4)

Then the formula reads as follows.

Proposition 5.2

Let \( \delta , \varepsilon > 0 \) and \( \rho > 1 \). Then we have, for \( t^{1 - \delta } \gg q_0 \max \{ q_1, q_2 \} \),

$$\begin{aligned} \left| L_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) \right| ^2 = 2 {\text {Re}}\big ( \Sigma _{\chi _1, \chi _2}^{ (1) }(t) + \Sigma _{\chi _1, \chi _2}^{ (2) }(t) \big ) + R_{\chi _1, \chi _2}(t), \end{aligned}$$
(5.5)

where \( \Sigma _{\chi _1, \chi _2}^{ (1) }(t) \) and \( \Sigma _{\chi _1, \chi _2}^{ (2) }(t) \) are given by

$$\begin{aligned} \begin{aligned} \Sigma _{\chi _1, \chi _2}^{ (1) }(t) :={}&\sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n_1) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_2) }{ (n_1 n_2)^\frac{1}{2} } e\left( \frac{t}{q_0} \log \left( \frac{n_2}{n_1} \right) \right) W_{1, \rho }\left( \frac{n_1}{t}, \frac{ n_2 }{t} \right) , \\ \Sigma _{\chi _1, \chi _2}^{ (2) }(t) :={}&\alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) \sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_1) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_2) }{ (n_1 n_2)^\frac{1}{2} } \\ {}&\cdot e\left( \frac{t}{q_0} \log (n_1 n_2) \right) W_{2, \rho }\left( \frac{ n_1 }{t}, \frac{ n_2 }{t} \right) , \end{aligned} \end{aligned}$$

with the weight functions \( W_{1, \rho } \) and \( W_{2, \rho } \) defined as

$$\begin{aligned} W_{1, \rho }(\xi _1, \xi _2)&:= V(\xi _1) \big ( 1 - V\big ( {\xi _2}^{-1} \big ) V\big ( \rho {\xi _2}^{-1} \big ) \big ), \\ W_{2, \rho }(\xi _1, \xi _2)&:= V(\xi _1) V(\xi _2) V( \rho \xi _2 ), \end{aligned}$$

and where \( R_{\chi _1, \chi _2}(t) \) is bounded by

$$\begin{aligned} R_{\chi _1, \chi _2}(t) \ll q_0 t^{ -\frac{1}{4} + \varepsilon } \qquad \text {and} \qquad \int _{T_0 / 2}^{T_0} \left| R_{\chi _1, \chi _2}(t) \right| \, \mathrm {d}t \ll q_0 {T_0}^{\frac{3}{8} + \varepsilon }, \end{aligned}$$

for \( {T_0}^{1 - \delta } \gg q_0 \max \{ q_1, q_2 \} \). The implicit constants depend at most on V, \(\rho \), \(\delta \) and \( \varepsilon \).

Proof

Proposition 5.2 is essentially a direct consequence of the approximate functional equations stated in Sect. 2.4.

We open the square and apply Theorem 2.7 twice with \( \sigma = 1/2 \) and \( x = y = t \). After taking account of (2.3), this gives

$$\begin{aligned} \left| L_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) \right| ^2 = 2{\text {Re}}( \Sigma _1(t) + \Sigma _2(t) + R_1(t) + R_2(t) ) + R_3(t), \end{aligned}$$

with

$$\begin{aligned} \Sigma _1(t)&:= \sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n_1) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_2) }{ (n_1 n_2)^\frac{1}{2} } e\left( \frac{t}{q_0} \log \left( \frac{n_2}{n_1} \right) \right) V\left( \frac{ n_1 }{t} \right) V\left( \frac{n_2}{t} \right) , \\ \Sigma _2(t)&:= \overline{ \alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) } \sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{ \chi _1, \chi _2 }(n_1) \tau _{ \chi _1, \chi _2 }(n_2) }{ (n_1 n_2)^\frac{1}{2} } \\&\qquad \qquad \qquad \qquad \qquad \cdot e\left( -\frac{t}{q_0} \log (n_1 n_2) \right) V\left( \frac{ n_1 }{t} \right) V\left( \frac{ n_2}{t} \right) , \end{aligned}$$

and

$$\begin{aligned} R_1(t)&:= \overline{ \alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) } R_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0}; t, t \right) \sum _{n = 1}^\infty \frac{ \tau _{ \chi _1, \chi _2 }(n) }{ n^\frac{1}{2} } e\left( -\frac{t}{q_0} \log n \right) V\left( \frac{n}{t} \right) , \\ R_2(t)&:= \overline{ R_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0}; t, t \right) } \sum _{n = 1}^\infty \frac{ \tau _{ \chi _1, \chi _2 }(n) }{ n^\frac{1}{2} } e\left( -\frac{t}{q_0} \log n \right) V\left( \frac{n}{t} \right) , \\ R_3(t)&:= \left| R_{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0}; t, t \right) \right| ^2. \end{aligned}$$

Next, we use Theorem 2.8 with \( \sigma = 1/2 \) and \( x = y = t \) to express \( \Sigma _2(t) \) as

$$\begin{aligned} \Sigma _2(t) = \Sigma _2'(t) + \Sigma _2''(t) + R_4(t), \end{aligned}$$

with

$$\begin{aligned} \Sigma _2'(t) :=&\sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n_1) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_2) }{ (n_1 n_2)^\frac{1}{2} } e\left( \frac{t}{q_0} \log \left( \frac{n_2}{n_1} \right) \right) V\left( \frac{ n_1 }{t} \right) V\left( \frac{t}{n_2} \right) V\left( \frac{n_2}{\rho t} \right) , \\ \Sigma _2''(t) :=&\overline{ \alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) } \sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{ \chi _1, \chi _2 }(n_1) \tau _{ \chi _1, \chi _2 }(n_2) }{ (n_1 n_2)^\frac{1}{2} } \\&\cdot e\left( \frac{-t}{q_0} \log (n_1 n_2) \right) V\left( \frac{ n_1 }{t} \right) V\left( \frac{ n_2 }{t} \right) V\left( \frac{ \rho n_2 }{t} \right) , \end{aligned}$$

and

$$\begin{aligned} R_4(t)&:= \overline{ R_{\chi _1, \chi _2}'\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0}; t, t \right) } \sum _{n = 1}^\infty \frac{ \tau _{ \chi _1, \chi _2 }(n) }{ n^\frac{1}{2} } e\left( -\frac{t}{q_0} \log n \right) V\left( \frac{n}{t} \right) . \end{aligned}$$

The terms \( \Sigma _1(t) \), \( \Sigma _2'(t) \) and \( \Sigma _2''(t) \) together form the two main terms in (5.5). Furthermore, it follows immediately from the bounds (2.19) and (2.20) that

$$\begin{aligned} R_3(t) \ll {q_0}^2 t^{ -\frac{5}{4} + \varepsilon } \qquad \text {and} \qquad \int _{ T_0 / 2}^{T_0} \! \left| R_3(t) \right| \, \mathrm {d}t \ll {q_0}^2 {T_0}^{ -\frac{5}{8} + \varepsilon }, \end{aligned}$$

for \( {T_0}^{1 - \delta } \gg q_0 \max \{ q_1, q_2 \} \). In order to estimate the other error terms we first note that

$$\begin{aligned} \sum _{n = 1}^\infty \frac{ \tau _{ \chi _1, \chi _2 }(n) }{ n^\frac{1}{2} } e\left( - \frac{t}{q_0} \log n \right) V\left( \frac{n}{t} \right) \ll t^{\frac{3}{8} + \varepsilon }, \end{aligned}$$

as can be shown by a standard counter integration argument using Theorem 2.1. Together with the bound (2.19), we thus get, for \( i = 1, 2, 4 \),

$$\begin{aligned} R_i(t) \ll q_0 t^{ -\frac{1}{4} + \varepsilon } \qquad \text {and} \qquad \int _{ T_0 / 2}^{T_0} \left| R_i(t) \right| \, \mathrm {d}t \ll q_0 {T_0}^{\frac{3}{8} + \varepsilon }, \end{aligned}$$

for \( {T_0}^{1 - \delta } \gg q_0 \max \{ q_1, q_2 \} \). This finishes the proof of Proposition 5.2. \(\square \)

5.2 A preliminary formula for \( I_{\chi _1, \chi _2}(w) \)

Next, we will use Proposition 5.2 to prove a preliminary formula for \( I_{\chi _1, \chi _2}(w) \) which reduces its estimation to the estimation of certain divisor sums.

Before stating the result, it is again necessary to fix a smooth weight functions of a certain shape. Let \( U : {\mathbb {R}}\rightarrow [0, \infty ) \) be a smooth and compactly supported function such that

$$\begin{aligned} U(\xi ) = 1 \quad \text {for} \quad |\xi | \le q_0 \Omega ^{-1} {T_0}^{-7/8}, \qquad U(\xi ) = 0 \quad \text {for} \quad |\xi | \ge 2 q_0 \Omega ^{-1} {T_0}^{-7/8}, \end{aligned}$$

and such that its derivatives satisfy

$$\begin{aligned} U^{ (\nu ) }(\xi ) \ll |\xi |^{-\nu } \quad \text {for} \quad \nu \ge 0. \end{aligned}$$
(5.6)

Then we have the following formula for \( I_{\chi _1, \chi _2}(w) \).

Proposition 5.3

Let \( \delta , \varepsilon > 0 \). Then we have

$$\begin{aligned} I_{\chi _1, \chi _2}(w) = 2 {\text {Re}}\left( M_{\chi _1, \chi _2}^{ (1) }(w) + M_{\chi _1, \chi _2}^{ (2) }(w) \right) + O\left( q_0 {T_0}^{\frac{3}{8} + \varepsilon } \right) , \end{aligned}$$

where

$$\begin{aligned} M_{\chi _1, \chi _2}^{ (1) }(w)&:= \int \! \sum _{n = 1}^\infty \frac{ \left| \tau _{\chi _1, \chi _2}(n) \right| ^2 }{n} V\left( \frac{n}{t} \right) w(t) \, \mathrm {d}t, \\ M_{\chi _1, \chi _2}^{ (2) }(w)&:= \int \! \sum _{\begin{array}{c} n_1, n_2 \ge 1 \\ n_1 \ne n_2 \end{array}} \frac{ \tau _{\chi _1, \chi _2}(n_1) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_2) }{ (n_1 n_2)^\frac{1}{2} } \\&\quad \cdot e\left( \frac{t}{q_0} \log \left( \frac{n_2}{n_1} \right) \right) U\left( \frac{n_2}{n_1} - 1 \right) V\left( \frac{ n_1 }{t} \right) w(t) \, \mathrm {d}t. \end{aligned}$$

The implicit constant depends at most on V, \(\delta \), \(\varepsilon \) and the implicit constants in (5.1), (5.2) and (5.6).

Proof

We apply Proposition 5.2 with \( \rho = 8 \) on the integrand in \( I_{\chi _1, \chi _2}(w) \) and then integrate over t. This leads to

$$\begin{aligned} I_{\chi _1, \chi _2}(w) = 2{\text {Re}}\left( J_1 + J_2 \right) + O\left( q_0 {T_0}^{\frac{3}{8} + \varepsilon } \right) , \end{aligned}$$

with

$$\begin{aligned} J_1&:= \sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{\chi _1, \chi _2}(n_1) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_2) }{ (n_1 n_2)^\frac{1}{2} } \int \! W_{1, 8}\left( \frac{n_1}{t}, \frac{ n_2 }{t} \right) e\left( \frac{t}{q_0} \log \left( \frac{n_2}{n_1} \right) \right) w(t) \, \mathrm {d}t, \\ J_2&:= \sum _{n_1, n_2 = 1}^\infty \frac{ \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_2) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n_1) }{ (n_1 n_2)^\frac{1}{2} } \int \! \alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) W_{2, 8}\left( \frac{ n_1 }{t}, \frac{ n_2 }{t} \right) \\&\quad \cdot e\left( \frac{t}{q_0} \log (n_1 n_2) \right) w(t) \, \mathrm {d}t. \end{aligned}$$

We split the sum \( J_1 \) into three parts as follows,

$$\begin{aligned} J_1&= \sum _{\begin{array}{c} n_1, n_2 \ge 1 \\ n_1 = n_2 \end{array}} (\ldots ) + \sum _{\begin{array}{c} n_1, n_2 \ge 1 \\ n_1 \ne n_2 \end{array}} U\left( \frac{n_2}{n_1} - 1 \right) (\ldots ) + \sum _{\begin{array}{c} n_1, n_2 \ge 1 \\ n_1 \ne n_2 \end{array}} \left( 1 - U\left( \frac{n_2}{n_1} - 1 \right) \right) (\ldots ) \\&=: J_{1 \text{ a }} + J_{1 \text{ b }} + J_{1 \text{ c }}. \end{aligned}$$

As we will see, the contribution coming from the sums \( J_{1 \text{ c }} \) and \( J_2 \) is neglible, while both \( J_{1 \text{ a }} \) and \( J_{1 \text{ b }} \) contribute to the main term.

We start with \( J_{1 \text{ c }} \). In this sum we have, by definition of U,

$$\begin{aligned} \left| \log \left( \frac{n_2}{n_1} \right) \right| \gg \min \left\{ 1, \left| \frac{n_2}{n_1} - 1 \right| \right\} \gg \min \left\{ 1, \frac{q_0}{ \Omega {T_0}^\frac{7}{8} } \right\} , \end{aligned}$$

and by integrating by parts over t repeatedly, we see that the integral in \( J_{1 \text{ c }} \) gets arbitrarily small. Hence the contribution of \( J_{1 \text{ c }} \) is indeed negligible.

Next, we consider \( J_2 \). Using the approximation (2.2), we can write the integral in \(J_2\) as

$$\begin{aligned} \int \! \alpha _{\chi _1, \chi _2}\left( \tfrac{1}{2} + \mathrm {i}\tfrac{2\pi t}{q_0} \right) W_{2, 8}\left( \frac{ n_1 }{t}, \frac{ n_2 }{t} \right) e\left( \frac{t}{q_0} \log (n_1 n_2) \right) w(t) \, \mathrm {d}t = \int \! e( F_1(t) ) F_2(t) \, \mathrm {d}t, \end{aligned}$$

with

$$\begin{aligned} F_1(t)&:= \frac{t}{q_0} \log \left( \frac{ e^2 n_1 n_2 }{t^2} \right) \\ F_2(t)&:= \mathrm {i}\frac{ G(\chi _1) G(\chi _2) }{ (-1)^{ \kappa _1 + \kappa _2 } q_0 } A\left( \frac{2\pi t}{q_0} \right) W_{2, 8}\left( \frac{ n_1 }{t}, \frac{ n_2 }{t} \right) w(t). \end{aligned}$$

The function \( W_{2, 8}(t) \) vanishes unless both the conditions

$$\begin{aligned} \frac{t}{ n_1 } \ge \frac{1}{2} \quad \text {and} \quad \frac{t}{ n_2 } \ge 4, \end{aligned}$$

are met, which means that

$$\begin{aligned} \frac{ t^2 }{ n_1 n_2 } \ge \max \bigg \{ \frac{1}{4} \frac{n_1}{n_2}, 16 \frac{n_2}{n_1} \bigg \} \ge 2. \end{aligned}$$

This leads to the following lower bound for \( F_1'(t) \),

$$\begin{aligned} F_1'(t) = \frac{1}{q_0} \log \left( \frac{ n_1 n_2 }{ t^2 } \right) \gg \frac{1}{q_0}, \end{aligned}$$

and integrating by parts repeatedly shows that the integral gets arbitrarily small. We thus see that the contribution of \( J_2 \) too is neglible.

Finally we turn towards the two remaining terms \( J_{1 \text{ a }} \) and \( J_{1 \text{ b }} \). In both these terms, it is certainly true that \( 2 n_1 \ge n_2 \), at least for \(T_0\) sufficiently large. Since the integrand vanishes unless \( n_1 \le 2t \), this implies that \( n_2 \le 4t \). By consequence, the weight function \( W_{1, 8} \) simplifies to

$$\begin{aligned} W_{1, 8}\left( \frac{ n_1 }{t}, \frac{ n_2 }{t} \right) = V\left( \frac{ n_1 }{t} \right) . \end{aligned}$$

This finishes the proof of Proposition 5.3. \(\square \)

In order to prove Proposition 5.1, it thus remains to evaluate the two sums inside \( M_{\chi _1, \chi _2}^{ (1) }(w) \) and \( M_{\chi _1, \chi _2}^{ (2) }(w) \). The evaluation of the former is fairly easy and will be done in Sect. 5.3, where we will prove the following asymptotic formula.

Proposition 5.4

Let \( \varepsilon > 0 \). Then

$$\begin{aligned} M_{\chi _1, \chi _2}^{ (1) }(w) = \int \! P_{\chi _1, \chi _2}^{ (1) }(\log t) w(t) \, \mathrm {d}t + O\left( {q_0}^\frac{1}{2} {T_0}^{\frac{1}{2} + \varepsilon } \right) , \end{aligned}$$
(5.7)

where \( P_{\chi _1, \chi _2}^{ (1) } \) is a polynomial of degree less or equal to 4 whose coefficients depend only on \( \chi _1 \), \( \chi _2 \) and V. The implicit constant depends at most on V, \(\varepsilon \) and the implicit constants in (5.1) and (5.2).

The evaluation of the other sum is far more difficult, and it is here that the shifted convolution problem considered in Sect. 4 comes up. The final result, proven in Sect. 5.4, is as follows.

Proposition 5.5

Let \( \varepsilon > 0 \). Then

$$\begin{aligned} M_{\chi _1, \chi _2}^{ (2) }(w) = \int \! P_{\chi _1, \chi _2}^{ (2) }(\log t) w(t) \, \mathrm {d}t + O\left( {T_0}^\varepsilon E_{\chi _1, \chi _2}( T_0, \Omega ) \right) , \end{aligned}$$
(5.8)

where \( P_{\chi _1, \chi _2}^{ (2) } \) is a polynomial of degree less or equal to 2 whose coefficients depend only on \( \chi _1 \), \( \chi _2 \) and V, and where \( E_{\chi _1, \chi _2}( T_0, \Omega ) \) is the quantity defined in (5.3). The implicit constant depends at most on V, \(\varepsilon \) and the implicit constants in (5.1), (5.2) and (5.6).

These two results, applied on the preliminary asymptotic estimate stated in Proposition 5.3, eventually give Proposition 5.1. The polynomials, which appear in (5.7) and (5.8), both depend on the specific choice of the weight function V. However, as one would expect, all the terms containing V cancel out at the end, and the polynomial \( P_{\chi _1, \chi _2} \) appearing in the main term in Proposition 5.1 is of course independent of V. We will show this also explicitly in Sect. 5.5, where we will evaluate \( P_{\chi _1, \chi _2} \) and express it as a residue.

5.3 Evaluation of \( M_{\chi _1, \chi _2}^{ (1) }(w) \)

In order to prove Proposition 5.4, we only need to evaluate the sum over n inside \( M_{\chi _1, \chi _2}^{ (1) }(w) \), which we can do by a standard contour integration argument.

An elementary calculation shows that, for \( {\text {Re}}(z) > 0 \),

$$\begin{aligned} T_{\chi _1, \chi _2}(z)&:= \sum _{n = 1}^\infty \frac{ \left| \tau _{\chi _1, \chi _2}(n) \right| ^2 }{ n^{1 + z} } \\&= \frac{ \psi _z(q_1) \psi _z(q_2) \zeta (1 + z)^2 L( 1 + z, \overline{\chi _1} \chi _2 ) L( 1 + z, \chi _1 \overline{\chi _2} ) }{ \psi _{1 + 2z}(q_1 q_2) \zeta (2 + 2z) }, \end{aligned}$$

with \( \psi _z(q) \) as defined in (4.3). By Mellin inversion we thus have

$$\begin{aligned} \sum _{n = 1}^\infty \frac{ \left| \tau _{\chi _1, \chi _2}(n) \right| ^2 }{n} V\left( \frac{n}{t} \right) = \frac{1}{2\pi \mathrm {i}} \int _{ (2) } \! {\hat{V}}(z) T_{\chi _1, \chi _2}(z) t^z \, \mathrm {d}z. \end{aligned}$$

After moving the line of integration to \( {\text {Re}}(z) = -1/2 + \varepsilon \) and using the following bound, valid in the critical strip,

$$\begin{aligned} T_{\chi _1, \chi _2}(z) \ll {q_0}^{ 1 - {\text {Re}}(z) + \varepsilon } ( 1 + | {\text {Im}}z | )^{ \frac{ 1 - {\text {Re}}(z) }{2} + \varepsilon }, \end{aligned}$$

we get

$$\begin{aligned} \sum _{n = 1}^\infty \frac{ \left| \tau _{\chi _1, \chi _2}(n) \right| ^2 }{n} V\left( \frac{n}{t} \right) = P_{\chi _1, \chi _2}^{ (1) }(\log t) + O\left( {q_0}^\frac{1}{2} t^{-\frac{1}{2} + \varepsilon } \right) , \end{aligned}$$

where \( P_{\chi _1, \chi _2}^{ (1) } \) is the polynomial defined by

$$\begin{aligned} P_{\chi _1, \chi _2}^{ (1) }(\log t) := \underset{z = 0}{{\text {Res}}}\,\, \! \left( {\hat{V}}(z) T_{\chi _1, \chi _2}(z) t^z \right) . \end{aligned}$$
(5.9)

This proves Proposition 5.4.

5.4 Evaluation of \( M_{\chi _1, \chi _2}^{ (2) }(w) \)

We start by introducing a new variable \( h := n_2 - n_1 \) and splitting the ranges of h and \( n_1 \) into dyadic intervals via the dyadic partition of unity defined in (4.5). This way \( M_{\chi _1, \chi _2}^{ (2) }(w) \) is split up into sums of the form

$$\begin{aligned} D^\pm (N, H)&:= \sum _{ h, n } \tau _{\chi _1, \chi _2}(n) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n + h) \int \! f^\pm (n, h; t) e\left( \frac{t}{q_0} \log \left( 1 + \frac{h}{n} \right) \right) w(t) \, \mathrm {d}t, \end{aligned}$$

with

$$\begin{aligned} f^\pm (\xi , \eta ; t)&:= \xi ^{-\frac{1}{2}} (\xi + \eta )^{-\frac{1}{2}} u\left( \frac{\xi }{N} \right) u\left( \pm \frac{\eta }{H} \right) U\left( \frac{\eta }{\xi }\right) V\left( \frac{\xi }{t} \right) . \end{aligned}$$

Integrating by parts over t repeatedly shows that \( D^\pm (N, H) \) becomes negligibly small unless

$$\begin{aligned} H \ll \frac{ q_0 N }{ \Omega {T_0}^{1 - \varepsilon } }. \end{aligned}$$

Similarly, we can assume that \( {T_0}^\frac{1}{2} \ll N \ll T_0 \), since otherwise \( D^\pm (N, H) \) is either empty or can be included in the error term in (5.8).

Next, we write the oscillating factor in the integral over t as

$$\begin{aligned} e\left( \frac{t}{q_0} \log \left( 1 + \frac{h}{n} \right) \right) = e\left( \frac{th}{q_0 n} \right) g\left( \frac{t}{q_0}, \frac{h}{n} \right) + O\left( {T_0}^{-\frac{5}{3} + \varepsilon } \right) , \end{aligned}$$

with

$$\begin{aligned} g(\zeta _1, \zeta _2) := \sum _{\ell = 0}^{10} \frac{ (-2\pi \mathrm {i}\zeta _1)^\ell }{\ell !} \left( \sum _{k = 0}^5 \frac{ (-\zeta _2)^{k + 2} }{ k + 2 } \right) ^\ell , \end{aligned}$$

and then integrate by parts over t, so that

$$\begin{aligned} D^\pm (N, H) = \int \! D_{1, t}^\pm (N, H) w'(t) \, \mathrm {d}t + \int \! D_{2, t}^\pm (N, H) \frac{ w(t) }{t} \, \mathrm {d}t + O\left( 1 \right) , \end{aligned}$$

where \( D_{i, t}^\pm (N, H) \) is given by

$$\begin{aligned} D_{i, t}^\pm (N, H) := \sum _h \frac{1}{h} \sum _n \tau _{\chi _1, \chi _2}(n) \tau _{ \overline{\chi _1}, \overline{\chi _2} }(n + h) f_{i, t}^\pm ( n, h ) e\left( \frac{th}{q_0 n} \right) , \end{aligned}$$

with

$$\begin{aligned} f_{1, t}^\pm (\xi , \eta ) := - \frac{q_0 \xi }{2\pi \mathrm {i}} f^\pm (\xi , \eta ; t) g\left( \frac{t}{q_0}, \frac{\xi }{\eta }\right) \qquad \text {and} \qquad f_{2, t}^\pm (\xi , \eta ) := t \frac{\partial }{\partial t} f_{1, t}^\pm (\xi , \eta ). \end{aligned}$$

Here we use Proposition 4.1 with \( \alpha = t / q_0 \) to evaluate the two sums \( D_{1, t}^\pm (N, H) \) and \( D_{2, t}^\pm (N, H) \). After reversing the integration by parts in the appearing main term, we get

$$\begin{aligned} D^\pm (N, H) = \int \! M_t^\pm (N, H) w(t) \, \mathrm {d}t + O\left( {T_0}^\varepsilon E_{\chi _1, \chi _2}( T_0, \Omega ) \right) , \end{aligned}$$

where \( E_{\chi _1, \chi _2}( T_0, \Omega ) \) is as defined in (5.3), and where

$$\begin{aligned} M_t^\pm (N, H) := \sum _h \frac{1}{h} \int \! Q_{\chi _1, \chi _2}( \log \xi , \log (\xi + h); h ) f^\pm (\xi , h; t) g\left( \frac{t}{q_0}, \frac{\xi }{\eta }\right) e\left( \frac{th}{q_0 \xi } \right) \, \mathrm {d}\xi . \end{aligned}$$

Integration by parts over \(\xi \) shows that \( M_t^\pm (N, H) \) becomes negligibly small if \( H \gg q_0 N^{1 + \varepsilon } {T_0}^{-1} \), while for \( H \ll q_0 N^{1 + \varepsilon } {T_0}^{-1} \) it simplifies to

$$\begin{aligned} M_t^\pm (N, H)&= \frac{q_0}{2\mathrm {i}} \sum _h \frac{1}{\pi h} u\left( \frac{\pm h}{H} \right) \\&\quad \cdot \int \! \frac{\partial }{\partial \xi } \left( Q_{\chi _1, \chi _2}( \log (t\xi ), \log (t\xi ); h ) \xi u\left( \frac{t \xi }{N} \right) V(\xi ) \right) e\left( \frac{h}{q_0 \xi } \right) \, \mathrm {d}\xi \\&\quad + O\left( {T_0}^{ -\frac{1}{2} + \varepsilon } \right) . \end{aligned}$$

Finally, we sum over all \( H \ll q_0 N^{1 + \varepsilon } {T_0}^{-1} \) and \( {T_0}^\frac{1}{2} \ll N \ll T_0 \), and then complete the sum over h and the integral over \(\xi \) trivially. This gives

$$\begin{aligned} M_{\chi _1, \chi _2}^{ (2) }(w) = \int \! P_{\chi _1, \chi _2}^{ (2) }(\log t) w(t) \, \mathrm {d}t + O\left( {T_0}^\varepsilon E_{\chi _1, \chi _2}(T_0, \Omega ) \right) , \end{aligned}$$

with Concerning equation (5.10):

$$\begin{aligned} P_{\chi _1, \chi _2}^{ (2) }(\log t) := \frac{q_0}{2\mathrm {i}} \sum _{ h \in {\mathbb {Z}}\setminus \{0\} } \frac{1}{\pi h} \int \! \frac{\partial }{\partial \xi } \left( Q_{\chi _1, \chi _2}( \log (t \xi ), \log (t \xi ); h ) \xi V(\xi ) \right) e\left( \frac{h}{q_0 \xi } \right) \, \mathrm {d}\xi ,\nonumber \\ \end{aligned}$$
(5.10)

which is what we wanted to show.

5.5 The main term

Here we want to evaluate the polynomial \( P_{\chi _1, \chi _2} \) which appears in Proposition 5.1 and which is given by

$$\begin{aligned} P_{\chi _1, \chi _2}(\log t) = 2 {\text {Re}}\left( P_{\chi _1, \chi _2}^{ (1) }\left( \log \frac{q_0 t}{2\pi } \right) + P_{\chi _1, \chi _2}^{ (2) }\left( \log \frac{q_0 t}{2\pi } \right) \right) , \end{aligned}$$

where \( P_{\chi _1, \chi _2}^{ (1) } \) and \( P_{\chi _1, \chi _2}^{ (2) } \) are the polynomials coming up in Propositions 5.4 and 5.5. Our treatment follows closely the path set out by Conrey [11].

We will focus on the case \( \chi _1 = \chi _2 \). Since the Laurent series expansion of \( {\hat{V}}(z) \) around \( z = 0 \) is given by

$$\begin{aligned} {\hat{V}}(z) = \frac{1}{z} - \sum _{\ell = 0}^\infty \frac{ z^{2\ell + 1} }{ (2\ell + 2)! } \int _0^\infty \! V'(\xi ) (\log \xi )^{2\ell + 2} \, \mathrm {d}\xi , \end{aligned}$$

we immediately see by (5.9) that

$$\begin{aligned} P_{\chi _1, \chi _1}^{ (1) }(\log t)&= \underset{z = 0}{{\text {Res}}}\,\,\!\left( \frac{ Z_{q_1}(z)^4 }{ \psi _{1 + 2z}(q_1) \zeta (2 + 2z) } \frac{ t^z }{ z^5 } \right) \\&\quad - \frac{1}{2} \, \underset{z = 0}{{\text {Res}}}\,\,\!\left( \frac{ Z_{q_1}(z)^4 }{ \psi _{1 + 2z}(q_1) \zeta (2 + 2z) } \frac{ t^z }{z^3} \right) \int _0^\infty \! V'(\xi ) (\log \xi )^2 \, \mathrm {d}\xi \\&\quad - \frac{1}{24} \frac{ \psi _0(q_1)^4 }{ \psi _1(q_1) \zeta (2) } \int \! V'(\xi ) (\log \xi )^4 \, \mathrm {d}\xi , \end{aligned}$$

with \( Z_q(z) \) and \( \psi _z(q) \) as defined in (4.3).

The evaluation of the other polynomial \( P_{\chi _1, \chi _1}^{ (2) } \) proves more difficult. By (5.10) we can write it as

$$\begin{aligned} P_{\chi _1, \chi _1}^{ (2) }(\log t) = \Delta _{z_1} \Delta _{z_2} \psi _0(q_1) Z_{q_1}(2 z_1) Z_{q_1}(2 z_2) Z_{q_1}(2 z_1 + 2 z_2) t^{z_1 + z_2} \frac{ A(z_1 + z_2) }{ B(z_1 + z_2) }, \end{aligned}$$

with

$$\begin{aligned} A(z) :=&\psi _{1 + 2z}(q_1) \zeta (2 + 2z) \sum _{h = 1}^\infty \frac{ r_{q_1}(h) }{\pi h} \sum _{\begin{array}{c} c = 1 \\ (c, q_1) = 1 \end{array}}^\infty \frac{ r_c(h) }{ c^{2 + 2z} } \\&\cdot \int _0^\infty \! \frac{\partial }{\partial \xi } \left( V(\xi ) \xi ^{1 + z} \right) \sin \left( 2\pi \frac{h}{ \xi q_1 } \right) \, \mathrm {d}\xi , \\ \end{aligned}$$

and

$$\begin{aligned} B(z)&:= \psi _{1 + 2z}(q_1) \zeta (2 + 2z) \psi _0(q_1) Z_{q_1}(2z). \end{aligned}$$

Note that the expression A(z) converges in a neighbourhood of \( z = 0 \), and thus defines a holomorphic function in this region. A simple calculation then shows that

$$\begin{aligned} P_{\chi _1, \chi _1}^{ (2) }(\log t) = \frac{\partial ^2}{\partial z^2} \left( Z_{q_1}(z)^4 t^z \frac{ A(z) }{ B(z) } \right) \bigg |_{z = 0} = 2 \, \underset{z = 0}{{\text {Res}}}\,\,\!\left( Z_{q_1}(z)^4 \frac{ A(z) }{ B(z) } \frac{ t^z }{z^3} \right) . \end{aligned}$$

In order to evaluate \( P_{\chi _1, \chi _1}^{ (2) } \), we therefore need to determine the first three terms in the Taylor expansion of A(z) around \( z = 0 \).

In order to avoid unnecessary convergence issues, we will assume in the following transformations that \( z > 0 \) . Using

$$\begin{aligned} r_{q_1}(h) = \! \sum _{ d \mid (q_1, h) } \! \mu \left( \frac{q_1}{d} \right) d \quad \, \text {and} \quad \!\! \sum _{\begin{array}{c} c = 1 \\ (c, q_1) = 1 \end{array}}^\infty \! \frac{ r_c(h) }{ c^{2 + 2z} } = \frac{1}{ \psi _{1 + 2z}(q_1) \zeta (2 + 2z) } \!\! \sum _{\begin{array}{c} h_1 \mid h \\ (h_1, q_1) = 1 \end{array}} \!\! \frac{1}{ {h_1}^{1 + 2z} }, \end{aligned}$$

we can write A(z) as

$$\begin{aligned} A(z) = \sum _{\begin{array}{c} h_1 = 1 \\ (h_1, q_1) = 1 \end{array}}^\infty \sum _{d \mid q_1} \frac{ \mu (d) }{ {h_1}^{2 + 2z} } \sum _{h_2 = 1}^\infty \frac{1}{\pi h_2} \int _0^\infty \! \frac{\partial }{\partial \xi } \left( V(\xi ) \xi ^{1 + z} \right) \sin \left( 2\pi \frac{h_1 h_2}{ d \xi } \right) \, \mathrm {d}\xi . \end{aligned}$$

Since the sum over \( h_2 \) is boundedly convergent (see [26, p. 4]), we can exchange summation and integration. By [26, (1.5)] we then get

$$\begin{aligned} A(z) = \sum _{\begin{array}{c} h = 1 \\ (h, q_1) = 1 \end{array}}^\infty \frac{1}{ h^{1 + z} } \sum _{d \mid q_1} \frac{ \mu (d) }{ d^{1 + z} } \int _0^\infty \! \frac{\partial }{\partial \xi } \left( V\left( \frac{h}{ d \xi } \right) \frac{1}{ \xi ^{1 + z} } \right) \left( \xi - [\xi ] - \frac{1}{2} \right) \, \mathrm {d}\xi , \end{aligned}$$

where \( [\xi ] \) denotes the integer part of \(\xi \). The integral over \( \xi \) can now be evaluated via the Euler–Maclaurin summation formula, which gives

$$\begin{aligned} A(z)&= \sum _{\begin{array}{c} h = 1 \\ (h, q_1) = 1 \end{array}}^\infty \frac{1}{ h^{1 + z} } \sum _{d \mid q_1} \frac{ \mu (d) }{ d^{1 + z} } \left( \sum _{n = 1}^\infty V\left( \frac{h}{ d n } \right) \frac{1}{ n^{1 + z} } - \int _0^\infty \! V\left( \frac{h}{ d \xi } \right) \frac{1}{ \xi ^{1 + z} } \, \mathrm {d}\xi \right) \\&= \sum _{\begin{array}{c} h, n = 1 \\ (hn, q_1) = 1 \end{array}}^\infty \frac{1}{ (hn)^{1 + z} } V\left( \frac{h}{n} \right) - \frac{ \psi _0(q_1) Z_{q_1}(2z) }{2z} {\hat{V}}(z). \end{aligned}$$

By (5.4) the double sum on the last line becomes

$$\begin{aligned} \sum _{\begin{array}{c} h, n = 1 \\ (hn, q_1) = 1 \end{array}}^\infty \frac{1}{ (hn)^{1 + z} } V\left( \frac{h}{n} \right) = \frac{1}{2} \sum _{\begin{array}{c} h, n = 1 \\ (hn, q_1) = 1 \end{array}}^\infty \frac{1}{ (hn)^{1 + z} } \left( V\left( \frac{h}{n} \right) + V\left( \frac{n}{h} \right) \right) = \frac{ Z_{q_1}(z)^2 }{ 2 z^2 }. \end{aligned}$$

Hence

$$\begin{aligned} A(z) = \frac{ Z_{q_1}(z)^2 }{ 2 z^2 } - \frac{ \psi _0(q_1) Z_{q_1}(2z) }{2z} {\hat{V}}(z), \end{aligned}$$

which eventually leads to the following expression for \( P_{\chi _1, \chi _1}^{ (2) } \),

$$\begin{aligned} P_{\chi _1, \chi _1}^{ (2) }(\log t) =&\underset{z = 0}{{\text {Res}}}\,\, \! \left( \frac{ Z_{q_1}(z)^6 }{ \psi _0(q_1) \psi _{1 + 2z}(q_1) Z_{q_1}(2z) \zeta (2 + 2z) } \frac{ t^z }{z^5} \right. \\&- \left. \frac{ Z_{q_1}(z)^4 }{ \psi _{1 + 2z}(q_1) \zeta (2 + 2z) } \frac{ t^z }{z^5} \right) \\&+ \frac{1}{2} \, \underset{z = 0}{{\text {Res}}}\,\, \! \left( \frac{ Z_{q_1}(z)^4 }{ \psi _{1 + 2z}(q_1) \zeta (2 + 2z) } \frac{ t^z }{z^3} \right) \int _0^\infty \! V'(\xi ) (\log \xi )^2 \, \mathrm {d}\xi \\&+ \frac{1}{ 24 } \frac{ \psi _0(q_1)^4 }{ \psi _1(q_1) \zeta (2) } \int _0^\infty \! V'(\xi ) (\log \xi )^4 \, \mathrm {d}\xi . \end{aligned}$$

All in all, we end up with

$$\begin{aligned} P_{\chi _1, \chi _1}(\log t)&= \underset{z = 0}{{\text {Res}}}\,\,\!\Bigg ( \frac{ {q_1}^z \psi _z(q_1)^6 }{ \psi _0(q_1) \psi _{2z}(q_1) \psi _{1 + 2z}(q_1) } \frac{ \zeta (1 + z)^6 }{ (2\pi )^z \zeta (1 + 2z) \zeta (2 + 2z) } t^z \Bigg ). \end{aligned}$$
(5.11)

Remember that \( \psi _z(q) \) was defined in (4.3). The cases where \( \chi _1 \ne \chi _2 \) can be evaluated in the same manner. If \( \chi _1 \ne \chi _2\) but \( q_1 = q_2 \), we get

$$\begin{aligned} \begin{aligned} P_{\chi _1, \chi _2}(\log t) =&\underset{z = 0}{{\text {Res}}}\,\, \! \Bigg ( \frac{ {q_1}^z \psi _z(q_1)^4 }{ \psi _0(q_1) \psi _{1 + 2z}(q_1) \psi _{2z}(q_1) } \\&\cdot \frac{ \zeta (1 + z)^4 L( 1 + z, \overline{\chi _1} \chi _2 ) L( 1 + z, \chi _1\overline{\chi _2} ) }{ (2\pi )^z \zeta (1 + 2z) \zeta (2 + 2z) } t^z \Bigg ) \\&+ {\text {Re}}\Bigg ( \frac{ \overline{ G(\chi _1) } G(\chi _2) }{ q_1 } \frac{ L( 1, \chi _1 \overline{\chi _2} )^4 }{ L( 2, ( \chi _1 \overline{\chi _2} )^2 ) } \\&+ \chi _1 \chi _2(-1) \frac{ G(\chi _1) \overline{ G(\chi _2) } }{ q_1 } \frac{ L( 1, \overline{\chi _1} \chi _2 )^4 }{ L( 2, ( \overline{\chi _1} \chi _2 )^2 ) } \Bigg ), \end{aligned} \end{aligned}$$
(5.12)

while if \( q_1 \ne q_2 \), we get

$$\begin{aligned} \begin{aligned} P_{\chi _1, \chi _2}(\log t) =&\underset{z = 0}{{\text {Res}}}\,\, \!\Bigg ( \frac{ 2 (q_1 q_2)^z \psi _z(q_1)^2 \psi _z(q_2)^2 }{ \left( \psi _0(q_2) {q_1}^z \psi _{2z}(q_1) + \psi _0(q_1) {q_2}^z \psi _{2z}(q_2) \right) \psi _{1 + 2z}(q_1 q_2) } \\&\cdot \frac{ \zeta (1 + z)^4 L(1 + z, \overline{\chi _1} \chi _2 ) L(1 + z, \chi _1 \overline{\chi _2} ) }{ (2\pi )^z \zeta (1 + 2z) \zeta (2 + 2z) } t^z \Bigg ). \end{aligned} \end{aligned}$$
(5.13)

Note that the second term on the right hand side in (5.12) disappears if \(\chi _1\) and \(\chi _2\) do not have the same parity.