1 Introduction

Let \(\chi _d = \left( \frac{d}{\cdot } \right) \) be a real primitive Dirichlet character modulo d given by the Kronecker symbol, where d is a fundamental discriminant. The k-th moment of quadratic Dirichlet L-functions is

(1.1)

where denotes the sum over fundamental discriminants, and k is a positive real number. One great motivation to study (1.1) comes from Chowla’s conjecture, which states that \(L(\tfrac{1}{2},\chi _d) \ne 0\) for all fundamental discriminants d. The current best result toward this conjecture is Soundararajan’s celebrated work [17] in 2000, where it was proven that \(L(\frac{1}{2},\chi _{8d}) \ne 0\) for at least \(87.5 \%\) of the odd square-free integers \(d\ge 0\). The key to the proof is the evaluation of mollified first and second moments of quadratic Dirichlet L-functions.

In 2000, using a random matrix model, Keating and Snaith [13] conjectured that for any positive real number k,

(1.2)

where \(C_k\) are explicit constants. Various researchers have studied versions of these moments summed over certain subsets of the fundamental discriminants. For instance, in (1.1) we consider positive fundamental discriminants. However, there are no difficulties in also studying negative fundamental discriminants. Some articles even consider characters of the form \(\chi _{8d}\), where d are odd positive square-free integers. The main reason researchers study these special cases, rather than consider all fundamental discriminants, is to focus on the methods and techniques. It is possible to establish results for all fundamental discriminants, but this would involve more cases that need to be studied. The conjecture analogous to (1.2) for characters of the form \(\chi _{8d}\), which can be established by using Keating and Snaith’s method [13], was obtained in Andrade and Keating’s paper [2, Conjecture 2]. For any positive real number k, it was conjectured that

(1.3)

where denotes the sum over square-free integers, G(z) is the Barnes G-function, and

$$\begin{aligned} a_{k} := 2^{-\frac{k(k+2)}{2}} \prod _{(p,2)=1} \frac{(1-\frac{1}{p})^{\frac{k(k+1)}{2}}}{1+\frac{1}{p}} \left( \frac{ (1+\frac{1}{\sqrt{p}} )^{-k} + (1-\frac{1}{\sqrt{p}} )^{-k} }{2} +\frac{1}{p} \right) . \end{aligned}$$
(1.4)

In this paper, we prove the conjecture in (1.3) for \(k=4\) assuming the generalized Riemann hypothesis (GRH).

Theorem 1.1

Assume GRH for \(L(s,\chi _d)\) for all fundamental discriminants d. For any \(\varepsilon >0,\) we have

The proof of Theorem 1.1 largely follows Soundararajan and Young’s paper [19] in 2010 and Soundararajan’s paper [17] in 2000. In [19], Soundararajan and Young proved an asymptotic formula for the second moment of quadratic twists of a modular L-function, obtaining the leading main term. Experts believed that the methods and techniques in [19] could be used to evaluate the fourth moment of quadratic Dirichlet L-functions. Motivated by this expectation, we established Theorem 1.1. In fact, Theorem 1.1 may be viewed as a version of [19, Theorem 1.2] where f is an Eisenstein series. The main difference between this article and [19] is that the off-diagonal terms (see just after (3.11) for a precise definition) contribute to the main term, whereas in [19] they are part of the error term. We use techniques from [17, Sections 5.2, 5.3] to evaluate the off-diagonal terms and this is main new input. These terms may be written as a certain multiple complex integral. One of the difficulties in evaluating this integral is that the integrand has high order poles and this makes the calculation more intricate. It should be noted that in 2017 Florea [7] has proven an asymptotic formula for the fourth moment of quadratic Dirichlet L-functions in the function field setting, with extra lower main terms.

Similar to [19, Theorem 1.1], we obtain an unconditional lower bound that matches the conjectured asymptotic formula (1.3). This result was stated without proof by Rudnick and Soundararajan [15] in 2006.

Theorem 1.2

Unconditionally,  we have

We now introduce more refined conjectures for the moments of quadratic Dirichlet L-functions and provide a brief history of related results. In 2005, Conrey et al. [4] gave a more precise conjecture, including all other principal lower order terms,

(1.5)

where k is a positive integer, \(P_n(x)\) is an explicit polynomial of degree n, and \(E_k(X)= o_k (X)\). For characters of the form \(\chi _{8d}\), their conjecture may be written as

(1.6)

where \( Q_n(x)\) is another explicit polynomial of degree n, and \(\hat{E}_k(X) = o_k (X)\).

In 1981, Jutila [11] established (1.5) for \(k=1\) with \(E_1(X)= O(X^{\frac{3}{4}+\varepsilon })\). In 1985, Goldfeld and Hoffstein [8] improved this to \(E_1(X)= O(X^{\frac{19}{32}+\varepsilon })\) by using multiple Dirichlet series. Their work implies the error \(O(X^{\frac{1}{2}+\varepsilon })\) for a smoothed version of the sum in (1.5) when \(k=1\). This was later obtained by Young [20] in 2009, using a different technique based on a recursive method and a study of shifted moments. We remark that Alderson and Rubinstein [1] conjectured that \(E_1(X) = O(X^{\frac{1}{4}+\varepsilon })\). In 1981, the second moment was established by Jutila [11],

In 2000, Soundararajan [17] improved this by obtaining the full main term in (1.6), in the case \(k=2\), with the power savings \(\hat{E}_2(X) = O (X^{\frac{5}{6}+\varepsilon })\). In 2020, Sono [16] improved this to \( O (X^{\frac{1}{2}+\varepsilon })\) for a smoothed variant of \(\hat{E}_2(X)\). In [17] Soundararajan was the first to prove an asymptotic for the third moment, obtaining \(\hat{E}_3(X) =O(X^{\frac{11}{12}+\varepsilon })\). In 2003, Diaconu et al. [5] improved this to \(E_3(X) = O(X^{0.85 \dots +\varepsilon })\) by using multiple Dirichlet series techniques. In 2013, Young [21] further improved this to \( O(X^{\frac{3}{4}+\varepsilon })\) for a smoothed version of \(\hat{E}_3(X)\) by using similar techniques to [20]. Recently, in 2018, Diaconu and Whitehead [6] improved Young’s result by showing that a smoothed version of \(\hat{E}_3(X)\) is of size \(cX^{\frac{3}{4}}+O(X^{\frac{2}{3} +\varepsilon })\), for some \(c \in {\mathbb {R}}\). This verified a conjecture of Diaconu et al. [5] of the presence of a secondary lower order term. Zhang [22] had previously conditionally established a secondary term of size \(X^{\frac{3}{4}}\) in 2005.

For the family of quadratic Dirichlet L-functions, moments higher than four have not been asymptotically evaluated. This seems beyond current techniques. However, there are celebrated results on upper and lower bounds of the moments. In 2006, Rudnick and Soundararajan [15] proved the lower bound

for all even natural number \(k \ge 1\). In 2009, Soundararajan [18] proved under GRH that for all positive real k,

(1.7)

In 2013, Harper [9], assuming GRH, improved this to

The method of this paper is largely based on the arguments and techniques in [17, 19]. We use the approximate functional equation for Dirichlet L-functions, and then employ the Poisson summation formula to separate the summation into diagonal terms, off-diagonal terms, and error terms. Both diagonal and off-diagonal terms contribute to the main term. To bound the error terms, by following the argument in [18, 19], under GRH, we established an upper bound for the shifted moments of quadratic Dirichlet L-functions (see Theorem 2.4).

With further effort, one might be able to heuristically obtain all the main terms that are expected from the conjecture of Conrey et al. in (1.6). However, the computation will be complicated. It might be simplified by considering a shifted version of the fourth moment, analogous to the calculation in [20]. Florea considered the function field version of the fourth moment in [7]. In her work she was able to identify all the main terms as given by a conjecture of Andrade–Keating [2, Conjecture 5] (the function field analogue of (1.6)). By using a recursive method, Florea obtained extra lower main terms in this case. It is possible that her techniques may be employed to obtain additional lower main terms in Theorem 1.1 and we hope to revisit this in future work. However, one would need to apply the approximate functional equation for the fourth power of the L-function rather than the second power (2.3). In addition, one would have to eliminate the use of the parameters \(U_1,U_2\) in (3.3). In our article, we use the approximate functional equation for the second power of the L-function as it is necessary to obtain the unconditional lower bound in Theorem 1.2.

The outline of this paper is as follows. The proof of Theorems 1.1 and 1.2 proceed simultaneously. In Sect. 2, we introduce some tools. In Sect. 3, we set up the evaluation of the fourth moment. We apply the Poisson summation formula to split the fourth moment into diagonal, off-diagonal, and error terms. We evaluate the diagonal terms and off-diagonal terms in Sects. 4 and 5, respectively. The error terms are bounded in Sect. 6. The proofs of Theorem 1.1 and 1.2 are completed in Sect. 7. Finally, we give the proof of Theorem 2.4 in Sect. 8.

Notation In this paper, we shall use the convention that \(\varepsilon >0\) denotes an arbitrary small constant which may vary in different situations. For two functions f(x) and g(x), we shall use the notation \(f(x) = O(g(x))\), \(f(x) \ll g(x)\) to mean there exists a constant C such that \(|f(x)| \le C|g(x)|\) for all sufficiently large x. If we write \(f(x) = O_a(g(x))\) or \(f(x) \ll _a g(x)\), then we mean that the corresponding constants depend on a. Throughout the paper, the big O may depend on \(\varepsilon \).

2 Basic tools

In this section, we introduce several tools that shall be used in this article.

2.1 Approximate functional equation

For \(\xi > 0\), define

$$\begin{aligned} \omega (\xi )&:=\frac{1}{2\pi i}\int _{(c)} \pi ^s g(s) \xi ^{-s}\frac{ds}{s},\quad c>0, \end{aligned}$$
(2.1)

where

$$\begin{aligned} g(s)&:= \pi ^{-s}\left( \frac{\Gamma (\frac{s}{2}+\frac{1}{4})}{\Gamma (\frac{1}{4})}\right) ^2. \end{aligned}$$
(2.2)

Here, and henceforth, \(\int _{(c)}\) stands for \(\int _{c-i \infty }^{c+ i \infty }\). It can be shown (see [17, Lemma 2.1]) that \(w(\xi )\) is real-valued and smooth on \((0,+\infty )\), bounded as \(\xi \) near 0, and decays exponentially as \(\xi \rightarrow + \infty \). Define

$$\begin{aligned} A (d):=\sum _{n=1}^{\infty }\frac{\tau (n)\chi _{8d}(n)}{\sqrt{n}}\omega \left( \frac{n\pi }{8d}\right) , \end{aligned}$$

where \(\tau (n)\) is the number of divisors of n. It was proved [17, Lemma 2.2] that for odd, positive, square-free integers d,

$$\begin{aligned} L(\tfrac{1}{2},\chi _{8d})^2=2A(d). \end{aligned}$$
(2.3)

2.2 Poisson summation formula

The following lemma is [19, Lemma 2.2].

Lemma 2.1

Let \(\Phi \) be a smooth function with compact support on the positive real numbers,  and suppose that n is an odd integer. Then

$$\begin{aligned} \sum _{(d,2)=1}\left( \frac{d}{n}\right) \Phi \left( \frac{d}{Z}\right) =\frac{Z}{2n}\left( \frac{2}{n}\right) \sum _{k\in \mathbb {Z}}(-1)^kG_{k}(n)\hat{\Phi }\left( \frac{kZ}{2n}\right) , \end{aligned}$$

where

$$\begin{aligned} G_k(n):=\left( \frac{1-i}{2}+\left( \frac{-1}{n}\right) \frac{1+i}{2}\right) \sum _{a\, ({\text {mod}} n)} \left( \frac{a}{n}\right) e\left( \frac{ak}{n}\right) , \end{aligned}$$
(2.4)

and

$$\begin{aligned} \hat{\Phi }(y):=\int _{-\infty }^{\infty } \left( \cos (2\pi xy)+\sin (2\pi xy) \right) \Phi (x)dx \end{aligned}$$

is a Fourier-type transform of \(\Phi \).

The precise values of the Gauss-type sum \(G_k(n)\) have been calculated in [17, Lemma 2.3] as follows.

Lemma 2.2

If m and n are relatively prime odd integers,  then \(G_k(mn)=G_k(m)G_k(n)\). Moreover,  if \(p^{\alpha }\) is the largest power of p dividing k (setting \(\alpha =\infty \) if \(k=0),\) then

$$\begin{aligned} G_k(p^{\beta })=\left\{ \begin{array}[c]{ll} 0 &{} \quad \text {if }\beta \le \alpha \text { is odd},\\ \phi (p^{\beta }) &{} \quad \text {if }\beta \le \alpha \text { is even},\\ -p^{\alpha } &{} \quad \text {if }\beta =\alpha +1 \text { is even},\\ \left( \frac{kp^{-\alpha }}{p}\right) p^{\alpha }\sqrt{p} &{} \quad \text {if }\beta =\alpha +1 \text { is odd},\\ 0 &{}\quad \text {if }\beta \ge \alpha +2. \end{array} \right. \end{aligned}$$

2.3 Smooth function

Let \(\Phi \) be a smooth Schwarz class function that is compactly supported on \([\frac{1}{2}, \frac{5}{2}]\), and \(0 \le \Phi (t) \le 1\) for all t. For any integer \(\nu \ge 0\), define

$$\begin{aligned} \Phi _{(\nu )} := \underset{0 \le j \le \nu }{{\text { max }}} \int _{\frac{1}{2}} ^{\frac{5}{2}} | \Phi ^{(j)} (t)| dt. \end{aligned}$$

For any \(s \in {\mathbb {C}}\), define

$$\begin{aligned} \check{\Phi }(s) := \int _0^{\infty } \Phi (t) t^{-s} dt. \end{aligned}$$

Note that \(\check{\Phi }(s)\) is a holomorphic function of s. Integrating by parts \(\nu \) times gives us

$$\begin{aligned} \check{\Phi }(s) = \frac{1}{(s-1) (s-2) \cdots (s-\nu )} \int _0^{\infty } \Phi ^{(\nu )} (t) t^{-s+\nu } dt. \end{aligned}$$

Hence, for \({{\text {Re}}}(s)<1\), we see that

$$\begin{aligned} \check{\Phi }(s) \ll _{\nu } \frac{3^{|{{\text {Re}}}(s)|}}{|s-1|^\nu } \Phi _{(\nu )}. \end{aligned}$$
(2.5)

2.4 Some lemmas

The following lemma is the sharpest upper bound up to date for the fourth moment of quadratic Dirichlet L-functions, due to Heath-Brown [10, Theorem 2].

Lemma 2.3

Suppose \(\sigma +it\) is a complex number with \(\sigma \ge \frac{1}{2}\). Then

Assuming GRH, the bound in Lemma 2.3 can be improved by the following theorem.

Theorem 2.4

Assume GRH for \(L(s,\chi _d)\) for all fundamental discriminants d. Let \(z_1,z_2 \in {\mathbb {C}}\) with \(0 \le {{\text {Re}}}(z_1), {{\text {Re}}}(z_2) \le \frac{1}{\log X},\) and \(|{{\text {Im}}}(z_1)|, |{{\text {Im}}}(z_2)| \le X\). Then

Theorem 2.4 is similar to [19, Corollary 5.1]. Indeed, the proof of it follows closely the proof of [19, Corollary 5.1] and the argument in [18, Section 4]. Analogous results to Theorem 2.4 were obtained by Chandee [3, Theorem 1.1] for the moments of the Riemann zeta function, and by Munsch [14, Theorem 1.1] for the moments of Dirichlet L-functions modulo q. The proof of Theorem 2.4 is postponed to Sect. 8.

We remark that Lemma 2.3 is used to bound the error terms in the proof of Theorem 1.2, while both Lemma 2.3 and Theorem 2.4 are needed to bound the error terms in the proof of Theorem 1.1.

3 Setup of the problem

Let \(\Phi \) be a smooth function as described in Sect. 2.3. We consider the following smoothed version of the fourth moment

Using the approximate functional equation (2.3), we have

(3.1)

where

$$\begin{aligned} A_{t}(\tfrac{1}{2};8d): = 2\sum _{n=1}^{\infty }\frac{\tau (n)\chi _{8d}(n)}{\sqrt{n}}\omega \left( \frac{n\pi }{t}\right) . \end{aligned}$$
(3.2)

Let \(X^{\frac{9}{10}} \le U_1 \le U_2 \le X \) be two parameters that will be chosen later. Define

(3.3)

We remark that (3.1) is approximately equal to (3.3) by choosing appropriate values for \(U_1\) and \(U_2\). This will be explained in Sect. 7.

Combining (3.2) and (3.3), we obtain that

(3.4)

where

$$\begin{aligned} h(x,y,z) := \Phi \left( \frac{x}{X}\right) \omega \left( \frac{y\pi }{U_1}\right) \omega \left( \frac{z\pi }{U_2}\right) . \end{aligned}$$
(3.5)

Using the Möbius inversion to remove the square-free condition in (3.4) gives

$$\begin{aligned}&S(U_1,U_2)\nonumber \\&\quad = 4\sum _{(d,2)=1} \sum _{a^2|d} \mu (a) \sum _{n_1=1}^{\infty }\sum _{n_2=1}^{\infty }\frac{\tau (n_1)\tau (n_2)\chi _{8d}(n_1n_2)}{\sqrt{n_1n_2}}h(d,n_1,n_2)\nonumber \\&\quad = 4\sum _{(a,2)=1} \mu (a) \sum _{(d,2)=1} \sum _{(n_1,a)=1}\sum _{(n_2,a)=1}\frac{\tau (n_1)\tau (n_2)\chi _{8d}(n_1n_2)}{\sqrt{n_1n_2}}h(a^2d,n_1,n_2)\nonumber \\&\quad =4\left( \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}}+\sum _{\begin{array}{c} a> Y \\ (a,2)=1 \end{array}} \right) \mu (a) \sum _{(d,2)=1} \sum _{(n_1,a)=1}\sum _{(n_2,a)=1}\frac{\tau (n_1)\tau (n_2)\chi _{8d}(n_1n_2)}{\sqrt{n_1n_2}}h(a^2d,n_1,n_2)\nonumber \\&\quad =: S_1 +S_2. \end{aligned}$$
(3.6)

In the above, we let \(S_1\) denote the terms with \(a \le Y\), where Y is a parameter that satisfies \(Y \le X\). The value of Y will be chosen later. Also, we let \(S_2\) denote the terms with \(a > Y \). The terms \(S_1\) contribute to the main term. We will discuss \(S_1\) in Sects. 46. The terms \(S_2\) contribute to the error term by the following lemma.

Lemma 3.1

Unconditionally,  we have \(S_2 \ll X^{1+\varepsilon }Y^{-1}.\) Under GRH,  we have \(S_2 \ll XY^{-1} \log ^{44}X.\)

Proof

Write \(d=lb^2\), where l is square-free and b is positive. Grouping terms in \(S_2\) according to \(c=ab\), we deduce that

(3.7)

where for \( {{\text {Re}}}(s)>1\), \(L_c(s,\chi )\) is given by the Euler product of \(L(s,\chi )\) with omitting all prime factors of c. The last equation follows by the definition of h(xyz) in (3.5). Moving the lines of the integral to \({{\text {Re}}}(u) = {{\text {Re}}}(v) = \frac{1}{\log X}\), the double integral above is bounded by

(3.8)

Here we use the inequalities \(2ab \le a^2 + b^2\) and \( |L_c(\tfrac{1}{2}+u,\chi _{8l})| \le \tau (c) | L(\tfrac{1}{2}+u,\chi _{8l})|. \)

By Theorem 2.4, we see that for \(|{{\text {Im}}}(u)| \le \frac{X}{c^2}\),

(3.9)

Also, by Lemma 2.3, we get that

(3.10)

Substituting both (3.9) and (3.10) in (3.8), we can bound (3.8) by

$$\begin{aligned} \ll \frac{\tau ^4(c)}{c^2} X \log ^{13} X. \end{aligned}$$

Together with (3.7), this yields

$$\begin{aligned} S_2 \ll X \log ^{13} X \sum _{(c,2)=1} \frac{\tau ^4(c)}{c^2} \sum _{\begin{array}{c} a>Y\\ a|c \end{array}} 1 \ll X \log ^{13} X\sum _{c>Y}\frac{\tau ^5(c)}{c^2} \ll XY^{-1} \log ^{44}X . \end{aligned}$$

This completes the proof of the conditional part of the lemma. The unconditional part follows similarly by substituting (3.10) in (3.8). \(\square \)

Now we consider \(S_1\). Using the Poisson summation formula (see Lemma 2.1) for the sum over d in \(S_1\), we obtain that

$$\begin{aligned} S_1= & {} 2X \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{k \in \mathbb {Z}} (-1)^k \sum _{(n_1,2a)=1} \sum _{(n_2,2a)=1} \frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}}\frac{G_k(n_1n_2)}{n_1n_2}\nonumber \\&\times \int _{-\infty }^{\infty } h(xX,n_1,n_2) ( \cos + \sin ) \left( \frac{2\pi kxX}{2n_1n_2a^2}\right) dx. \end{aligned}$$
(3.11)

Let \(S_1(k=0)\) denote the sum above over \(k=0\), which are called diagonal terms. Let \(S_1(k\ne 0)\) denote the sum over \(k\ne 0\). Write \(S_1(k\ne 0) = S_1(k= \Box ) + S_1(k\ne \Box )\), where \(S_1(k= \Box )\) denotes the terms with square k, and \(S_1(k \ne \Box )\) denotes the remaining terms. We call \(S_1(k= \Box ) \) off-diagonal terms. We will discuss \(S_1(k=0)\), \(S_1(k= \Box ) \), and \(S_1(k\ne \Box )\) in Sects. 46, respectively.

4 Evaluation of \(S_1(k=0)\)

In this section, we shall extract one main term of \(S_1\) from \(S_1(k=0)\). The argument here is similar to [19, Section 3.2].

It follows from the definition of \(G_k(n)\) in (2.4) that \(G_0(n) = \phi (n)\) if \(n=\Box \), and \(G_0 (n) = 0\) otherwise. By this fact and (3.11), we see that

$$\begin{aligned} S_1(k=0)&=2X \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{\begin{array}{c} (n_1n_2,2a)=1\\ n_1n_2 = \Box \end{array}} \frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}}\frac{\phi (n_1n_2)}{n_1n_2} \int _{-\infty }^{\infty } h(xX,n_1,n_2) dx \nonumber \\&= 2X \sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}} \frac{\phi (n_1n_2)}{n_1n_2}\sum _{\begin{array}{c} a\le Y \\ (a,2n_1n_2)=1 \end{array}} \frac{\mu (a)}{a^2}\int _{-\infty }^{\infty } h(xX,n_1,n_2) dx. \end{aligned}$$
(4.1)

Observe that

$$\begin{aligned} \sum _{\begin{array}{c} a\le Y \\ (a,2n_1n_2)=1 \end{array}} \frac{\mu (a)}{a^2} = \frac{8}{\pi ^2}\prod _{p|n_1n_2}\left( 1-\frac{1}{p^2} \right) ^{-1} +O \left( Y^{-1}\right) . \end{aligned}$$

Inserting this into (4.1), combined with

$$\begin{aligned} \frac{\phi (n_1n_2)}{n_1n_2} \prod _{p|n_1n_2} \left( 1 - \frac{1}{p^2} \right) ^{-1} = \prod _{p|n_1n_2} \frac{p}{p+1}, \end{aligned}$$

we obtain that

$$\begin{aligned} S_1(k=0)= & {} \frac{16X}{\pi ^2}\sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}} \prod _{p|n_1n_2} \frac{p}{p+1}\int _{-\infty }^{\infty } h(xX,n_1,n_2) dx \nonumber \\&+ O \left( \frac{X}{Y} \sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}} \int _{-\infty }^{\infty } |h(xX,n_1,n_2)| dx\right) . \end{aligned}$$
(4.2)

Now we simplify the error term above. Recall that \(w(\xi )\) is bounded as \(\xi \) near 0 and decreases exponentially as \(\xi \rightarrow + \infty \). It follows that

$$\begin{aligned}&\sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}} \int _{-\infty }^{\infty } |h(xX,n_1,n_2)| dx \nonumber \\&\quad \ll \sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}} \left( 1+\frac{n_1}{U_1} \right) ^{-100} \left( 1+\frac{n_2}{U_2} \right) ^{-100} \nonumber \\&\quad \ll \log ^{11} X . \end{aligned}$$
(4.3)

The last inequality follows by separating the sum into two parts corresponding to whether \(n_1, n_2 \le U_1U_2\). Combining (4.2) and (4.3), we have

$$\begin{aligned} S_1(k=0)&=\frac{16X}{\pi ^2}\sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}} \prod _{p|n_1n_2} \frac{p}{p+1}\int _{-\infty }^{\infty } h(xX,n_1,n_2)dx \\&\quad +O \left( X Y^{-1}\log ^{11} X \right) . \end{aligned}$$

Recall h(xyz) from (3.5) and \(\omega (\xi )\) from (2.1). We have

$$\begin{aligned} S_1(k=0)&=\frac{16X}{\pi ^2}\int _{-\infty }^{\infty } \Phi \left( x \right) dx \frac{1}{(2\pi i)^2}\int _{(1)}\int _{(1)}\frac{g(u)g(v)}{uv}U_1^u U_2^v \nonumber \\&\quad \times \sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}} \frac{\tau (n_1)\tau (n_2)}{n_1^{\frac{1}{2}+u} n_2^{\frac{1}{2}+v}}\prod _{p|n_1n_2} \frac{p}{p+1}\ du\ dv \nonumber \\&\quad +O \left( X Y^{-1}\log ^{11} X\right) . \end{aligned}$$
(4.4)

Lemma 4.1

For \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta ) > \frac{1}{2},\) we have

$$\begin{aligned} \sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{n_1^{\alpha }n_2^{\beta }} \prod _{p|n_1n_2} \frac{p}{p+1} = \zeta (2\alpha )^3 \zeta (2\beta )^3 \zeta (\alpha +\beta )^4 Z_1(\alpha ,\beta ), \end{aligned}$$
(4.5)

where \(Z_1(\alpha ,\beta )\) is defined by

$$\begin{aligned} Z_1(\alpha ,\beta ) := \prod _p Z_{1,p}(\alpha ,\beta ). \end{aligned}$$

Here

$$\begin{aligned} Z_{1,2}(\alpha ,\beta ) : = \left( 1- \frac{1}{4^{\alpha }}\right) ^3 \left( 1- \frac{1}{4^{\beta }}\right) ^3 \left( 1- \frac{1}{2^{\alpha +\beta }}\right) ^4, \end{aligned}$$

and for \(p \not \mid 2,\)

$$\begin{aligned}&Z_{1,p}(\alpha ,\beta ) := \left( 1- \frac{1}{p^{2\alpha }}\right) \left( 1- \frac{1}{p^{2\beta }}\right) \left( 1- \frac{1}{p^{\alpha +\beta }}\right) ^4 \\&\quad \times \Bigg [ 1 + \frac{4}{p^{\alpha +\beta }} + \frac{1}{p^{2\alpha }} + \frac{1}{p^{2\beta }} + \frac{1}{p^{2\alpha +2\beta }} - \frac{1}{p+1} \\&\quad \times \left( \frac{3}{p^{2\alpha }} + \frac{3}{p^{2\beta }} + \frac{4}{p^{\alpha +\beta }} - \frac{1}{p^{4\alpha }} - \frac{1}{p^{4\beta }} - \frac{3}{p^{2\alpha +2\beta }} + \frac{2}{p^{2\alpha +4\beta }} + \frac{2}{p^{4\alpha +2\beta }} - \frac{1}{p^{4\alpha +4\beta }} \right) \Bigg ]. \end{aligned}$$

Furthermore,  \(Z_1(\alpha ,\beta )\) is analytic and uniformly bounded in the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta ) \ge \frac{1}{4}+\varepsilon \).

Proof

We have

$$\begin{aligned} \begin{aligned} \sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{n_1^{\alpha }n_2^{\beta }} \prod _{p|n_1n_2} \frac{p}{p+1}= \prod _{(p,2)=1}\left( 1 + \frac{p}{p+1}\left( \sum _{r=1}^{\infty }\sum _{n_1 n_2=p^{2r}}\frac{\tau (n_1)\tau (n_2)}{n_1^{\alpha }n_2^{\beta }}\right) \right) . \end{aligned} \end{aligned}$$

Note that

$$\begin{aligned} \sum _{r=1}^{\infty }\sum _{n_1 n_2=p^{2r}}\frac{\tau (n_1)\tau (n_2)}{n_1^{\alpha }n_2^{\beta }} = \frac{(1+\frac{1}{p^{2\alpha }})(1+\frac{1}{p^{2\beta }})}{(1-\frac{1}{p^{2\alpha }})^2(1-\frac{1}{p^{2\beta }})^2} + \frac{4}{p^{\alpha +\beta }} \frac{1}{(1-\frac{1}{p^{2\alpha }})^2(1-\frac{1}{p^{2\beta }})^2} -1. \end{aligned}$$

Thus,

$$\begin{aligned}&\sum _{\begin{array}{c} (n_1n_2,2)=1\\ n_1n_2 = \Box \end{array}}\frac{\tau (n_1)\tau (n_2)}{n_1^{\alpha }n_2^{\beta }} \prod _{p|n_1n_2} \frac{p}{p+1} \\&\quad = \prod _{(p,2)=1} \frac{1}{(1-\frac{1}{p^{2\alpha }})^2(1-\frac{1}{p^{2\beta }})^2} \Bigg [ 1 + \frac{4}{p^{\alpha +\beta }} + \frac{1}{p^{2\alpha }} + \frac{1}{p^{2\beta }} + \frac{1}{p^{2\alpha +2\beta }}\\&\qquad - \frac{1}{p+1} \left( \frac{3}{p^{2\alpha }} + \frac{3}{p^{2\beta }} + \frac{4}{p^{\alpha +\beta }} - \frac{1}{p^{4\alpha }} - \frac{1}{p^{4\beta }} - \frac{3}{p^{2\alpha +2\beta }} \right. \\&\left. \qquad + \frac{2}{p^{2\alpha +4\beta }} + \frac{2}{p^{4\alpha +2\beta }} - \frac{1}{p^{4\alpha +4\beta }} \right) \Bigg ]. \end{aligned}$$

Then (4.5) follows by comparing Euler factors on both sides. The remaining part of the lemma follows directly from the definition of \(Z_1(\alpha ,\beta )\). \(\square \)

It follows from (4.4) and Lemma 4.1 that

$$\begin{aligned} S_1(k=0)= & {} \frac{16X}{\pi ^2}\int _{-\infty }^{\infty } \Phi \left( x \right) dx \frac{1}{(2\pi i)^2}\int _{(1)}\int _{(1)} \frac{g(u)g(v)}{uv}U_1^u U_2^v \zeta (1+2u)^3\nonumber \\&\times \,\zeta (1+2v)^3 \zeta (1+u+v) ^4\nonumber \\&\times Z_1(\tfrac{1}{2}+u,\tfrac{1}{2}+v) \ du\ dv +O \left( XY^{-1}\log ^{11} X\right) . \end{aligned}$$
(4.6)

The double integral in (4.6) can be written as

$$\begin{aligned} \frac{1}{(2\pi i)^2}\int _{(1)}\int _{(1)} \frac{U_1^u U_2^v}{uv(2u)^3(2v)^3(u+v)^4} {\mathcal {E}}(u,v) \ du\ dv , \end{aligned}$$

where

$$\begin{aligned} {\mathcal {E}}(u,v):= & {} g(u)g(v) \zeta (1+2u)^3 (2u)^3 \zeta (1+2v)^3 (2v)^3 \zeta (1+u+v)^4 (u+v)^4\nonumber \\&\times Z_1(\tfrac{1}{2}+u,\tfrac{1}{2}+v). \end{aligned}$$

Clearly, \({\mathcal {E}}\) is analytic for \({{\text {Re}}}(u),{{\text {Re}}}(v)\ge -\frac{1}{4} + \varepsilon \).

Now move the lines of the integral above to \({{\text {Re}}}(u) = {{\text {Re}}}(v) = \frac{1}{10}\) without encountering any poles. Next move the line of the integral over v to \({{\text {Re}}}(v) = -\frac{1}{5}\). We may encounter two poles of order at most 4 at both \(v=0\) and \(v=-u\). Thus,

$$\begin{aligned}&\frac{1}{(2\pi i)^2}\int _{(\frac{1}{10})}\int _{(\frac{1}{10})} \frac{U_1^u U_2^v}{uv(2u)^3(2v)^3(u+v)^4} {\mathcal {E}}(u,v) \ du\ dv \nonumber \\&\quad = \frac{1}{2\pi i}\int _{(\frac{1}{10})} \left( \underset{v=0}{{\text {Res}}} +\underset{v=-u}{{\text {Res}}}\right) \left[ \frac{U_1^u U_2^v}{uv(2u)^3(2v)^3(u+v)^4}{\mathcal {E}}(u,v) \right] du + O \left( U_1^{\frac{1}{10}} U_2^{-\frac{1}{5}} \right) . \end{aligned}$$
(4.7)

The integral of the residue at \(v=-u\) in (4.7) will contribute to an error term. In fact, we have

$$\begin{aligned}&\underset{v=-u}{{\text {Res}}} \left[ \frac{U_1^u U_2^v}{uv(2u)^3(2v)^3(u+v)^4}{\mathcal {E}}(u,v) \right] \\&\quad = \frac{1}{3!}\left. \frac{\partial ^3}{\partial v^3} \right| _{v=-u} \left[ \frac{U_1^u U_2^v}{uv(2u)^3(2v)^3}{\mathcal {E}}(u,v) \right] \\&\quad = \frac{U_1^u U_2^{-u} }{384 u^{11} } \Big [ {\mathcal {E}}(u, -u) \left( u^3 \log ^3 U_2 + 12 u^2 \log ^2 U_2 + 60 u \log U_2 + 120\right) \\&\qquad + {\mathcal {E}}^{(0,1)}(u, -u) \left( 3u^3 \log ^2 U_2 + 24 u^2 \ln U_2 + 60 u\right) \\&\qquad + {\mathcal {E}}^{(0,2)}(u, -u) \left( 3u^3 \log U_2 + 12 u^2\right) + {\mathcal {E}}^{(0,3)}(u, -u)u^3 \Big ], \end{aligned}$$

where \( {\mathcal {E}}^{(i,j)}(u, v) := \frac{\partial ^{i+j}{\mathcal {E}}}{\partial u^i \partial v^j} (u,v)\). It follows that

$$\begin{aligned} \frac{1}{2\pi i}\int _{(\frac{1}{10})} \underset{v=-u}{{\text {Res}}} \left[ \frac{U_1^u U_2^v}{uv(2u)^3(2v)^3(u+v)^4}{\mathcal {E}}(u,v) \right] du \ll U_1^{\frac{1}{10}} U_2^{-\frac{1}{10}} \log ^3 X. \end{aligned}$$
(4.8)

It remains to consider the integral of the residue at \(v=0\) in (4.7). Note that

$$\begin{aligned} I_1(u)&:=\underset{v=0}{{\text {Res}}} \left[ \frac{U_1^u U_2^v}{uv(2u)^3(2v)^3(u+v)^4}{\mathcal {E}}(u,v) \right] \\&= \frac{U_1^u}{384u^{11}} \Big [ {\mathcal {E}}(u,0) (u^3 \log ^3 U_2 -12 u^2 \log ^2 U_2 + 60 u \log U_2 -120 ) \\&\quad + {\mathcal {E}}^{(0,1)}(u,0)(3u^3 \log ^2 U_2 -24 u^2 \log U_2 + 60 u )\\&\quad + {\mathcal {E}}^{(0,2)}(u,0)(3u^3 \log U_2 - 12u^2) + {\mathcal {E}}^{(0,3)}(u,0) u^3 \Big ] . \end{aligned}$$

Moving the line of the integral below from \({{\text {Re}}}(u)= \frac{1}{10}\) to \({{\text {Re}}}(u)= -\frac{1}{10}\) with encountering a pole at \(u=0\), we see that

$$\begin{aligned}&\frac{1}{2\pi i}\int _{(\frac{1}{10})} I_1(u) du \nonumber \\&\quad = \underset{u=0}{{\text {Res}}} \ I_1(u) +O(U_1^{-\frac{1}{10}}\log ^3 X) \nonumber \\&\quad = \frac{{\mathcal {E}}(0,0)}{11612160} \left( -\log ^{10} U_1 + 5 \log ^9 U_1 \log U_2 - 9\log ^8 U_1 \log ^2 U_2 + 6 \log ^7 U_1 \log ^3 U_2 \right) \nonumber \\&\qquad +O\left( \log ^9 X \right) +O \left( U_1^{-\frac{1}{10}}\log ^3 X \right) . \end{aligned}$$
(4.9)

Combining (4.6)–(4.9), we obtain that

$$\begin{aligned} S_1(k=0)= & {} \frac{16X}{\pi ^2}\tilde{\Phi }(1) \cdot \frac{{\mathcal {E}}(0,0)}{11612160} \left( -\log ^{10} U_1 + 5 \log ^9 U_1 \log U_2 - 9\log ^8 U_1 \log ^2 U_2\right. \nonumber \\&\left. +\, 6 \log ^7 U_1 \log ^3 U_2\right) \nonumber \\&+\, O\left( X \log ^9 X + XY^{-1} \log ^{11} X \right) . \end{aligned}$$
(4.10)

where \(\tilde{\Phi }(s)\) is defined in (5.3).

Now we compute \({\mathcal {E}}(0,0) \) above. Clearly, \({\mathcal {E}}(0,0) = Z_1(\frac{1}{2},\frac{1}{2}) \). By the definition of \(Z_1(u,v)\) in Lemma 4.1, it follows that

$$\begin{aligned} Z_1(\tfrac{1}{2},\tfrac{1}{2})&= \frac{1}{2^{10}} \prod _{(p,2)=1} \left( 1- \frac{1}{p} \right) ^6 \left[ 1 + \frac{6}{p} + \frac{1}{p^2} - \frac{1}{p+1} \left( \frac{10}{p} - \frac{5}{p^2} + \frac{4}{p^3} - \frac{1}{p^4}\right) \right] \nonumber \\&= \frac{1}{2^{10}} \prod _{(p,2)=1} \frac{(1- \frac{1}{p} )^6 }{1+ \frac{1}{p}} \left( 1 + \frac{7}{p} - \frac{3}{p^2} + \frac{6}{p^3} - \frac{4}{p^4} + \frac{1}{p^5}\right) . \end{aligned}$$
(4.11)

On the other hand, recalling the definition of \(a_4\) from (1.4), we have

$$\begin{aligned} a_4&= \frac{1}{2^{12}} \prod _{(p,2)=1} \frac{(1-\frac{1}{p})^{10}}{1+\frac{1}{p}} \left( \frac{ (1+\frac{1}{\sqrt{p}} )^{-4} + (1-\frac{1}{\sqrt{p}} )^{-4} }{2} +\frac{1}{p}\right) \nonumber \\&=\frac{1}{2^{12}} \prod _{(p,2)=1} \frac{(1-\frac{1}{p})^{10}}{1+\frac{1}{p}} \frac{1}{(1+\frac{1}{\sqrt{p}})^4 (1-\frac{1}{\sqrt{p}})^4} \nonumber \\&\quad \times \left[ \frac{1}{2} \left( 1-\frac{1}{\sqrt{p}} \right) ^4 + \frac{1}{2 } \left( 1+\frac{1}{\sqrt{p}} \right) ^4 + \frac{1}{p} \left( 1 - \frac{1}{p}\right) ^4 \right] \nonumber \\&= \frac{1}{2^{12}} \prod _{(p,2)=1} \frac{(1-\frac{1}{p})^{6}}{1+\frac{1}{p}} \left( 1 + \frac{7}{p} - \frac{3}{p^2} + \frac{6}{p^3} - \frac{4}{p^4} + \frac{1}{p^5} \right) . \end{aligned}$$
(4.12)

Comparing (4.11) with (4.12), we conclude \( Z_1(\frac{1}{2},\frac{1}{2}) = 4 a_4\), which implies \({\mathcal {E}}(0,0) = 4 a_4\). Together with (4.10), it follows that

Lemma 4.2

We have

$$\begin{aligned}&S_1(k=0) \\&\quad = \frac{a_{4} \tilde{\Phi }(1) X}{2^6 \cdot 3^4 \cdot 5 \cdot 7 \cdot \pi ^2} \left( -\log ^{10} U_1 + 5 \log ^9 U_1 \log U_2 - 9\log ^8 U_1 \log ^2 U_2 + 6 \log ^7 U_1 \log ^3 U_2 \right) \\&\qquad +O\left( X \log ^9 X + XY^{-1} \log ^{11} X \right) . \end{aligned}$$

5 Evaluation of \(S_1(k=\Box )\)

In this section, we compute another part of the main term of \(S_1\) which arises from \(S_1(k=\square )\). Many of the techniques used here are from Sections 5.2, 5.3 of [17].

Recall from (3.11) that

$$\begin{aligned}&S_1(k \ne 0)=2X \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{ k\ne 0} (-1)^k \sum _{(n_1,2a)=1} \sum _{(n_2,2a)=1} \frac{\tau (n_1)\tau (n_2)}{\sqrt{n_1n_2}}\frac{G_k(n_1n_2)}{n_1n_2}\nonumber \\&\quad \times \int _{-\infty }^{\infty } h(xX,n_1,n_2)(\cos + \sin )\left( \frac{2\pi kxX}{2n_1n_2a^2}\right) dx. \end{aligned}$$
(5.1)

To proceed, we need the following lemma.

Lemma 5.1

Let f(x) be a smooth function on \({\mathbb {R}}_{> 0}.\) Suppose f decays rapidly as \(x \rightarrow \infty ,\) and \(f^{(n)}(x)\) converges as \(x \rightarrow 0^+\) for every \(n\in \mathbb {Z}_{\ge 0}.\) Then we have

$$\begin{aligned} \int _0^{\infty } f(x)\cos (2\pi xy) dx=\frac{1}{2\pi i} \int _{(\frac{1}{2})} \tilde{f}(1-s) \Gamma (s) \cos \left( \frac{{\text {sgn}}(y)\pi s}{2}\right) (2\pi |y|)^{-s}ds, \end{aligned}$$
(5.2)

where \(\tilde{f}\) is the Mellin transform of f defined by

$$\begin{aligned} \tilde{f}(s) := \int _0^{\infty } f(x) x^{s-1} dx. \end{aligned}$$
(5.3)

In addition,  the Eq. (5.2) is also valid when \(\cos \) is replaced by \(\sin .\)

Proof

See [19, Section 3.3]. \(\square \)

Taking \(f(x) = h(xX, n_1, n_2)\) in Lemma 5.1, we have

$$\begin{aligned}&\int _{-\infty }^{\infty } h(xX,n_1,n_2) (\cos +\sin ) \left( \frac{2\pi kxX}{2n_1n_2a^2}\right) dx \\&\quad = \frac{X^{-1}}{2\pi i}\int _{(\frac{1}{2})}\tilde{h}(1-s;n_1,n_2)\Gamma (s) (\cos +{\text {sgn}}(k)\sin )\left( \frac{\pi s}{2}\right) \left( \frac{n_1n_2a^2}{\pi |k|}\right) ^{s}ds, \end{aligned}$$

where

$$\begin{aligned} \tilde{h}(1-s;n_1,n_2) = \int _0^{\infty } h(x, n_1 , n_2)x^{-s} dx. \end{aligned}$$

Recall from (3.5) the definition of h(xyz). The above contour integral is

$$\begin{aligned} \frac{1 }{(2\pi i)^3 }\int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\varepsilon )} \Gamma (s)\left( \frac{a^2}{ |k|}\right) ^s {\mathcal {J}}(s,k) g(u)g(v) \frac{1}{n_1^{u-s} n_2^{v-s}}\frac{U_1^u U_2^vX^{-s}}{uv}\ ds \ du \ dv, \end{aligned}$$

where

$$\begin{aligned} {\mathcal {J}}(s,k) = \tilde{\Phi }(1-s) (\cos +{\text {sgn}}(k)\sin )\left( \frac{\pi s}{2}\right) \pi ^{-s} . \end{aligned}$$

Move the lines of the triple integral to \({{\text {Re}}}(s) = \frac{1}{2}+\varepsilon \), \({{\text {Re}}}(u)={{\text {Re}}}(v)=\frac{1}{2}+2\varepsilon \), and change the variables \(u'=u-s\), \(v'=v-s\). We obtain that

$$\begin{aligned}&\int _{-\infty }^{\infty } h(xX,n_1,n_2) (\cos +\sin ) \left( \frac{2\pi kxX}{2n_1n_2a^2}\right) dx \\&\quad =\frac{1 }{(2\pi i)^3 }\int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\frac{1}{2}+\varepsilon )} \Gamma (s)\left( \frac{a^2}{ |k|}\right) ^s {\mathcal {J}}(s,k) g(u+s)g(v+s)\\&\qquad \times \frac{1}{n_1^{u} n_2^{v}}\frac{U_1^{u+s} U_2^{v+s} X^{-s}}{(u+s)(v+s)}\ ds \ du \ dv. \end{aligned}$$

Substituting this in (5.1), we get that

$$\begin{aligned}&S_1(k \ne 0)\nonumber \\&\quad =2X \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{ k\ne 0} (-1)^k \frac{1 }{(2\pi i)^3 }\int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\frac{1}{2}+\varepsilon )} \Gamma (s)\left( \frac{a^2}{ |k|}\right) ^s {\mathcal {J}}(s,k) g(u+s)g(v+s)\nonumber \\&\qquad \times \frac{U_1^{u+s} U_2^{v+s} X^{-s}}{(u+s)(v+s)} \sum _{(n_1,2a)=1} \sum _{(n_2,2a)=1} \frac{\tau (n_1)\tau (n_2)}{n_1^{\frac{1}{2}+u}n_2^{\frac{1}{2}+v}}\frac{G_k(n_1n_2)}{n_1n_2} \ ds \ du \ dv. \end{aligned}$$
(5.4)

Lemma 5.2

Write \(4k = k_1k_2^2,\) where \(k_1\) is a fundamental discriminant (possibly \(k_1 = 1),\) and \(k_2\) is a positive integer. In the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )>\frac{1}{2},\) we have

$$\begin{aligned} \sum _{(n_1,2a)=1}\sum _{(n_2,2a)=1} \frac{\tau (n_1)\tau (n_2)}{n_1^{\alpha }n_2^{\beta }}\frac{G_k(n_1n_2)}{n_1n_2} = L(\tfrac{1}{2}+\alpha ,\chi _{k_1})^2 L(\tfrac{1}{2}+\beta ,\chi _{k_1})^2 Z_2(\alpha ,\beta ,a,k). \end{aligned}$$
(5.5)

Here \(Z_2(\alpha ,\beta ,a,k)\) is defined as follows : 

$$\begin{aligned} Z_2(\alpha ,\beta ,a,k):=\prod _{p}Z_{2,p}(\alpha ,\beta ,a,k), \end{aligned}$$

where

$$\begin{aligned} Z_{2,p}(\alpha ,\beta ,a,k) := \left( 1-\frac{\chi _{k_1}(p)}{p^{\frac{1}{2}+\alpha }}\right) ^2\left( 1-\frac{\chi _{k_1}(p)}{p^{\frac{1}{2}+\beta }}\right) ^2 \qquad \text {if } p|2a, \end{aligned}$$

and

$$\begin{aligned} Z_{2,p}(\alpha ,\beta ,a,k)&:= \left( 1-\frac{\chi _{k_1}(p)}{p^{\frac{1}{2}+\alpha }}\right) ^2\left( 1-\frac{\chi _{k_1}(p)}{p^{\frac{1}{2}+\beta }}\right) ^2 \sum _{n_1=0}^{\infty } \sum _{n_2=0}^{\infty } \frac{\tau (p^{n_1})\tau (p^{n_2})}{p^{n_1\alpha + n_2\beta }}\\&\quad \times \frac{G_k(p^{n_1+n_2})}{p^{n_1+n_2}} \quad \text {if } p\not \mid 2a. \end{aligned}$$

In addition,  \(Z_2(\alpha ,\beta ,a,k)\) is analytic in the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )>0,\) and we have

$$\begin{aligned} Z_2(\alpha ,\beta ,a,k) \ll \tau ^4(a) \tau ^{8}(|k|) \log ^{10} X \end{aligned}$$
(5.6)

in the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta ) \ge \frac{1}{\log X},\) where the implied constant is absolute.

Proof

The formula (5.5) follows from the joint multiplicativity of \(G_k(n_1n_2)\) with variables \(n_1\) and \(n_2\). In fact,

$$\begin{aligned}&\sum _{(n_1,2a)=1}\sum _{(n_2,2a)=1} \frac{\tau (n_1)\tau (n_2)}{n_1^{\alpha }n_2^{\beta }}\frac{G_k(n_1n_2)}{n_1n_2}\\&\quad = \prod _{(p,2a)=1}\sum _{n_1=0}^{\infty } \sum _{n_2=0}^{\infty } \frac{\tau (p^{n_1})\tau (p^{n_2})}{p^{n_1\alpha + n_2\beta }}\frac{G_k(p^{n_1+n_2})}{p^{n_1+n_2}} . \end{aligned}$$

Then we obtain (5.5) by comparing Euler factors on both sides.

For \(p \not \mid 2a k\), by Lemma 2.2, we know that

$$\begin{aligned} Z_{2,p}(\alpha ,\beta ,a,k) = \left( 1-\frac{\chi _{k_1}(p)}{p^{\frac{1}{2}+\alpha }}\right) ^2\left( 1-\frac{\chi _{k_1}(p)}{p^{\frac{1}{2}+\beta }}\right) ^2 \left( 1+\frac{2\chi _{k_1}(p)}{p^{\frac{1}{2}+\alpha }}+\frac{2\chi _{k_1}(p)}{p^{\frac{1}{2}+\beta }} \right) . \end{aligned}$$
(5.7)

This shows that \(Z_2(\alpha ,\beta ,a,k)\) is analytic in the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )>0\).

It remains to prove the upper bound of \(Z_2(\alpha ,\beta ,a,k)\). It follows from (5.7) that for \(p \not \mid 2a k\),

$$\begin{aligned} \prod _{(p,2ak)=1} Z_{2,p}(\alpha ,\beta ,a,k)= & {} \prod _{(p,2ak)=1} \left( 1- \frac{3}{p^{1+2\alpha }} - \frac{3}{p^{1+2\beta }} - \frac{4}{p^{1+\alpha +\beta }} + O \left( \frac{1}{p^{3/2}}\right) \right) \\\ll & {} \log ^{10} X. \end{aligned}$$

For p|2a, we get that

$$\begin{aligned} \prod _{p|2a} Z_{2,p}(\alpha ,\beta ,a,k) \le \prod _{p|2a} \left( 1+\frac{1}{\sqrt{p}}\right) ^4 \ll \tau ^4(a). \end{aligned}$$

For \(p \not \mid 2a,p|k\), using the trivial bound \(G_k(p^n) \le p^n\), we obtain that

$$\begin{aligned} \prod _{ p|k, p \not \mid 2a} Z_{2,p}(\alpha ,\beta ,a,k) \le \prod _{ p|k, p \not \mid 2a} \left( 1+ \frac{1}{\sqrt{p}}\right) ^4 \sum _{0 \le n_1 + n_2 \le {\text {ord}}_p (k) + 1 } (n_1 +1)(n_2+1) \ll \tau ^{8}(|k|). \end{aligned}$$

By the above three bounds, we have obtained (5.6). \(\square \)

By (5.4) and Lemma 5.2, it follows that

$$\begin{aligned} S_1(k \ne 0)&=\frac{2X }{(2\pi i)^3 } \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{ k\ne 0} (-1)^k \int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\frac{1}{2}+\varepsilon )} \Gamma (s) {\mathcal {J}}(s,k) a^{2s}\nonumber \\&\quad \times g(u+s)g(v+s) \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)}\nonumber \\&\quad \times \frac{1}{|k|^s} L(1+u,\chi _{k_1})^2 L(1+v,\chi _{k_1})^2 Z_2(\tfrac{1}{2}+u,\tfrac{1}{2}+v,a,k)\ ds \ du \ dv. \end{aligned}$$
(5.8)

Note that when moving the lines of integration of the variables uv to the left, then we may encounter poles only when \(k=\Box \) (then \(k_1=1\)). Thus, we break the sum in (5.8) into two parts depending on whether \(k=\Box \).

Write

$$\begin{aligned}&S_1(k=\Box )\\&\quad :=\frac{2X }{(2\pi i)^3 } \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{\begin{array}{c} k \ne 0 \\ k=\Box \end{array} } (-1)^k \int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\frac{1}{2}+\varepsilon )} \Gamma (s) {\mathcal {J}}(s,k) a^{2s} g(u+s)g(v+s) \\&\qquad \times \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)} \frac{1}{|k|^s} \zeta (1+u)^2 \zeta (1+v)^2 Z_2(\tfrac{1}{2}+u,\tfrac{1}{2}+v,a,k)\ ds \ du \ dv, \end{aligned}$$

and

$$\begin{aligned}&S_1(k \ne \Box )\nonumber \\&\quad :=\frac{2X }{(2\pi i)^3 } \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{ k\ne 0, \Box } (-1)^k \int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\tfrac{1}{2}+\varepsilon )} \Gamma (s) {\mathcal {J}}(s,k) a^{2s} g(u+s)g(v+s)\nonumber \\&\qquad \times \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)} \frac{1}{|k|^s} L(1+u,\chi _{k_1})^2 L(1+v,\chi _{k_1})^2 Z_2(\tfrac{1}{2}+u,\tfrac{1}{2}+v,a,k)\ ds \ du \ dv.\nonumber \\ \end{aligned}$$
(5.9)

We will give an upper bound for \(S_1(k \ne \Box )\) in the next section. In the rest of this section, we focus on \(S_1(k=\Box )\) and obtain a main term. By the change of variables (replace k by \(k^2\)), we get that

$$\begin{aligned}&S_1(k=\Box )\nonumber \\&\quad =\frac{2X }{(2\pi i)^3 } \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\sum _{k=1}^{ \infty } (-1)^k \int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\tfrac{1}{2}+\varepsilon )} \Gamma (s) {\mathcal {J}}(s,1) a^{2s} g(u+s)g(v+s) \nonumber \\&\qquad \times \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)} \frac{1}{k^{2s}} \zeta (1+u)^2 \zeta (1+v)^2 Z_2(\tfrac{1}{2}+u,\tfrac{1}{2}+v,a,k^2)\ ds \ du \ dv. \end{aligned}$$
(5.10)

Lemma 5.3

In the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )>0,\) \({{\text {Re}}}(\gamma )>\tfrac{1}{2},\)

$$\begin{aligned} \sum _{k=1}^{\infty } \frac{(-1)^k}{k^{2\gamma }}Z_2(\alpha ,\beta ,a,k^2) = (2^{1-2 \gamma }-1)\zeta (2 \gamma ) Z_3(\alpha ,\beta ,\gamma ,a). \end{aligned}$$
(5.11)

Here \(Z_3(\alpha ,\beta ,\gamma ,a)\) is defined by

$$\begin{aligned} Z_3(\alpha ,\beta ,\gamma ,a) := \zeta (2 \alpha +2 \gamma )^2 \zeta (2 \beta +2 \gamma )^2 \prod _p Z_{3,p}(\alpha ,\beta ,\gamma ,a), \end{aligned}$$

where for p|2a

$$\begin{aligned} Z_{3,p}(\alpha ,\beta ,\gamma ,a): = \left( 1- \frac{1}{p^{\frac{1}{2}+\alpha }}\right) ^2 \left( 1- \frac{1}{p^{\frac{1}{2}+\beta }}\right) ^2 \left( 1- \frac{1}{p^{2\alpha + 2\gamma }}\right) ^2 \left( 1- \frac{1}{p^{2\beta + 2\gamma }}\right) ^2, \end{aligned}$$
(5.12)

and for \(p \not \mid 2a,\)

$$\begin{aligned}&Z_{3,p}(\alpha ,\beta ,\gamma ,a)\nonumber \\&\quad := \left( 1- \frac{1}{p^{\frac{1}{2}+\alpha }}\right) ^2 \left( 1- \frac{1}{p^{\frac{1}{2}+\beta }}\right) ^2 \Bigg [ \left( 1-\frac{1}{p}\right) \left( 1+\frac{1}{p^{2\alpha +2\gamma }}\right) \left( 1+\frac{1}{p^{2\beta +2\gamma }}\right) \nonumber \\&\qquad + \frac{1}{p}\left( 1-\frac{1}{p^{2\alpha +2\gamma }}\right) ^2\left( 1-\frac{1}{p^{2\beta +2\gamma }}\right) ^2 + \left( 1-\frac{1}{p}\right) \frac{4}{p^{\alpha +\beta +2\gamma }}\nonumber \\&\qquad + 2\left( 1-\frac{1}{p^{2\gamma }}\right) \left( \frac{1}{p^{\frac{1}{2}+\alpha }} + \frac{1}{p^{\frac{1}{2}+\beta }} + \frac{1}{p^{\frac{1}{2}+2\alpha +\beta + 2\gamma }}+ \frac{1}{p^{\frac{1}{2}+\alpha +2\beta + 2\gamma }}\right) \Bigg ]. \end{aligned}$$
(5.13)

Moreover, 

  1. (1)

    \(Z_3(\alpha ,\beta ,\gamma ,a)\) is analytic and uniformly bounded in the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )\ge \tfrac{1}{2}+\varepsilon ,\) \({{\text {Re}}}(\gamma )\ge 2\varepsilon .\)

  2. (2)

    \(Z_3(\alpha ,\beta ,\gamma ,a)\) is analytic and \(Z_3(\alpha ,\beta ,\gamma ,a) \ll \log ^{14} X \) in the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )\ge \tfrac{1}{2}+\frac{1}{\log X},\) \({{\text {Re}}}(\gamma )\ge \frac{2}{\log X}.\) The implied constant is absolute.

Proof

We first compute the left-hand side of (5.11) without \((-1)^k\). Note that

$$\begin{aligned} \sum _{k=1}^{\infty } \frac{1}{k^{2\gamma }}Z_2(\alpha ,\beta ,a,k^2)&= \sum _{k=1}^{\infty } \frac{1}{k^{2\gamma }}\prod _pZ_{2,p}(\alpha ,\beta ,a,k^2) = \prod _p \sum _{b=0}^{\infty } \frac{Z_{2,p}(\alpha ,\beta ,a,p^{2b})}{p^{2b\gamma }}. \end{aligned}$$
(5.14)

We remark here that \(Z_{2,p} (\alpha ,\beta ,a,1)\) may not be 1. If p|2a, we have

$$\begin{aligned} \sum _{b=0}^{\infty } \frac{Z_{2,p}(\alpha ,\beta ,a,p^{2b})}{p^{2b\gamma }} = \frac{1}{1-\frac{1}{p^{2\gamma }}} \left( 1- \frac{1}{p^{\frac{1}{2}+\alpha }}\right) ^2\left( 1- \frac{1}{p^{\frac{1}{2}+\beta }}\right) ^2. \end{aligned}$$
(5.15)

If \(p \not \mid 2a\), we have

$$\begin{aligned}&\sum _{b=0}^{\infty } \frac{Z_{2,p}(\alpha ,\beta ,a,p^{2b})}{p^{2b\gamma }} = \left( 1- \frac{1}{p^{\frac{1}{2}+\alpha }}\right) ^2\left( 1- \frac{1}{p^{\frac{1}{2}+\beta }}\right) ^2 \nonumber \\&\quad \times \sum _{b=0}^{\infty } \frac{1}{p^{2b\gamma }} \left( \sum _{\begin{array}{c} n_1,n_2 \ge 0 \\ n_1+n_2 = 2b+1 \end{array}} \frac{\tau (p^{n_1}) \tau (p^{n_2})}{p^{n_1\alpha +n_2\beta }} \frac{p^{2b}\sqrt{p}}{p^{n_1+n_2}} + \sum _{\begin{array}{c} n_1,n_2 \ge 0 \\ n_1+n_2 \le 2b \\ n_1+n_2 \text { even} \end{array}} \frac{\tau (p^{n_1}) \tau (p^{n_2})}{p^{n_1\alpha +n_2\beta }} \frac{\phi (p^{n_1+n_2})}{p^{n_1+n_2}} \right) . \nonumber \\ \end{aligned}$$
(5.16)

Note that

$$\begin{aligned}&\sum _{b=0}^{\infty } \frac{1}{p^{2b\gamma }} \sum _{\begin{array}{c} n_1,n_2 \ge 0 \\ n_1+n_2 = 2b+1 \end{array}} \frac{\tau (p^{n_1}) \tau (p^{n_2})}{p^{n_1\alpha +n_2\beta }} \frac{p^{2b}\sqrt{p}}{p^{n_1+n_2}} \\&\quad =\frac{1}{p^{-\gamma +\frac{1}{2}}} \frac{1}{(1-\frac{1}{p^{2\alpha +2\gamma }})^2(1-\frac{1}{p^{2\beta +2\gamma }})^2} \left[ \frac{2}{p^{\alpha +\gamma }}\left( 1+ \frac{1}{p^{2\beta +2\gamma }}\right) + \frac{2}{p^{\beta +\gamma }}\left( 1+ \frac{1}{p^{2\alpha +2\gamma }}\right) \right] ,\nonumber \\ \end{aligned}$$

and

$$\begin{aligned}&\sum _{b=0}^{\infty } \frac{1}{p^{2b\gamma }} \sum _{\begin{array}{c} n_1,n_2 \ge 0 \\ n_1+n_2 \le 2b \\ n_1+n_2 \text { even} \end{array}} \frac{\tau (p^{n_1}) \tau (p^{n_2})}{p^{n_1\alpha +n_2\beta }} \frac{\phi (p^{n_1+n_2})}{p^{n_1+n_2}} = \frac{1}{1-\frac{1}{p^{2\gamma }}} \\&\quad \times \left[ \frac{1}{p}+ \left( 1-\frac{1}{p} \right) \frac{1}{(1-\frac{1}{p^{2\alpha +2\gamma }})^2 (1-\frac{1}{p^{2\beta +2\gamma }})^2}\right. \nonumber \\&\quad \times \left. \left( \left( 1+\frac{1}{p^{2\alpha +2\gamma }} \right) \left( 1+\frac{1}{p^{2\beta +2\gamma }} \right) +\frac{4}{p^{\alpha +\beta +2\gamma }} \right) \right] . \end{aligned}$$

Inserting them into (5.16), combined with (5.14), (5.15), we obtain that

$$\begin{aligned} \sum _{k=1}^{\infty } \frac{1}{k^{2\gamma }}Z_2(\alpha ,\beta ,a,k^2) = \zeta (2 \gamma ) Z_3(\alpha ,\beta ,\gamma ,a). \end{aligned}$$
(5.17)

Now we prove (5.11). It is clear that \(G_{4k}(n) = G_k(n)\) for any odd n, so \(Z_2(\alpha ,\beta ,a,4k^2)=Z_2(\alpha ,\beta ,a,k^2)\). Thus,

$$\begin{aligned} \sum _{k=1}^{\infty } \frac{(-1)^k}{k^{2\gamma }}Z_2(\alpha ,\beta ,a,k^2)&= \frac{1}{4^\gamma }\sum _{k=1}^{\infty } \frac{1}{k^{2\gamma }}Z_2(\alpha ,\beta ,a,4k^2) - \sum _{k \text { odd}} \frac{1}{k^{2\gamma }}Z_2(\alpha ,\beta ,a,k^2)\\&= (2^{1-2 \gamma }-1)\sum _{k=1}^{\infty } \frac{1}{k^{2\gamma }}Z_2(\alpha ,\beta ,a,k^2). \end{aligned}$$

Together with (5.17), this yields (5.11).

The first property of \(Z_3(\alpha ,\beta ,\gamma ,a)\) comes directly from its definition. Now we prove the second property. We know that for \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )\ge \tfrac{1}{2}+\frac{1}{\log X}\), \({{\text {Re}}}(\gamma )\ge \frac{2}{\log X}\),

$$\begin{aligned}&Z_3(\alpha ,\beta ,\gamma ,a) \ll (\log ^4 X) \prod _{p|2a} \left( 1+ \frac{1}{p^{1+\frac{1}{\log X}}} \right) ^8 \\&\quad \times \prod _{p \not \mid 2a} \left( 1+ \frac{6}{p^{1+\frac{6}{\log X}}} + \frac{4}{p^{1+\frac{5}{\log X}}} + O\left( \frac{1}{p^2} \right) \right) \ll \log ^{14} X, \end{aligned}$$

as desired. \(\square \)

It follows from (5.10) and Lemma 5.3 that

$$\begin{aligned}&S_1(k=\Box )\\&\quad =\frac{2X }{(2\pi i)^3 } \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\int _{(\varepsilon )}\int _{(\varepsilon )}\int _{(\frac{1}{2}+\varepsilon )} \Gamma (s) {\mathcal {J}}(s,1) a^{2s} g(u+s)g(v+s) \frac{U_1^{u+s} U_2^{v+s} X^{-s}}{(u+s)(v+s)} \\&\qquad \times \zeta (1+u)^2 \zeta (1+v)^2 (2^{1-2s}-1)\zeta (2s) Z_3(\tfrac{1}{2}+u,\tfrac{1}{2}+v, s,a)\ ds \ du \ dv. \end{aligned}$$

Note that \(Z_3(\tfrac{1}{2}+u,\tfrac{1}{2}+v, s)\) is analytic in the region \({{\text {Re}}}(u),{{\text {Re}}}(v) \ge \varepsilon \), \({{\text {Re}}}(s) \ge 2\varepsilon \) by (1) of Lemma 5.3, so we move the lines of the integral above to \({{\text {Re}}}(u) = {{\text {Re}}}(v) = 1\), \({{\text {Re}}}(s) =\frac{1}{10}\) without encountering any poles. (The only possible pole lies in \(\zeta (2s)\) at \(s=\frac{1}{2}\), but is cancelled by the simple zero arising from \(2^{1-2s} -1 \).) Hence,

$$\begin{aligned}&S_1(k=\Box )\nonumber \\&\quad =\frac{2X }{(2\pi i)^3 } \sum _{\begin{array}{c} a\le Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\int _{(1)}\int _{(1)}\int _{(\frac{1}{10})} \Gamma (s) {\mathcal {J}}(s,1) a^{2s} g(u+s)g(v+s) \frac{U_1^{u+s} U_2^{v+s} X^{-s}}{(u+s)(v+s)} \nonumber \\&\qquad \times \zeta (1+u)^2 \zeta (1+v)^2 (2^{1-2s}-1)\zeta (2s) Z_3(\tfrac{1}{2}+u,\tfrac{1}{2}+v, s,a)\ ds \ du \ dv. \end{aligned}$$
(5.18)

Note that we may extend the sum over a to infinity with an error term

$$\begin{aligned}&\frac{2X }{(2\pi i)^3 } \sum _{\begin{array}{c} a > Y \\ (a,2)=1 \end{array}} \frac{\mu (a)}{a^2}\int _{(1)}\int _{(1)}\int _{(\frac{1}{10})} \Gamma (s) {\mathcal {J}}(s,1) a^{2s} g(u+s)g(v+s) \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)} \\&\quad \times \zeta (1+u)^2 \zeta (1+v)^2 (2^{1-2s}-1)\zeta (2s) Z_3(\tfrac{1}{2}+u,\tfrac{1}{2}+v, s,a)\ ds \ du \ dv. \end{aligned}$$

Move the lines of the integral above to \({{\text {Re}}}(u)={{\text {Re}}}(v)=\frac{1}{\log X}\), \({{\text {Re}}}(s) = \frac{2}{\log X}\) without encountering any poles. Then by (2) of Lemma 5.3, this is bounded by

$$\begin{aligned}&\ll X \log ^{20}X \sum _{\begin{array}{c} a > Y \\ (a,2)=1 \end{array}} \frac{1}{a^{2-\frac{4}{\log X}}} \\&\quad \times \int _{(\frac{1}{\log X})}\int _{(\frac{1}{\log X})}\int _{(\frac{2}{\log X})}\ (1+|2s|) |{\mathcal {J}}(s,1)| \left| \Gamma (s)\Gamma (\tfrac{u+s}{2}+\tfrac{1}{4})^2 \Gamma (\tfrac{v+s}{2}+\tfrac{1}{4})^2 \right| \ |ds| \ |du| \ |dv| \\&\ll X (\log ^{20} X) Y^{-1} \int _{(\frac{2}{\log X})} (1+|2s|) |\Gamma (s)| |\tilde{\Phi }(1-s)| \left| (\cos + \sin )(\tfrac{\pi s}{2})\right| |ds|\\&\ll X Y^{-1} (\log ^{21} X) \Phi _{(5)}. \end{aligned}$$

The last inequality is due to (2.5) and the fact \(| \Gamma (s) (\cos +\sin )(\frac{\pi s }{2}) |\ll |s|^{{{\text {Re}}}(s)-\frac{1}{2}}\). Together with (5.18), it implies that

$$\begin{aligned}&S_1(k=\Box )\nonumber \\&\quad =\frac{2X }{(2\pi i)^3 } \sum _{(a,2)=1} \frac{\mu (a)}{a^2}\int _{(1)}\int _{(1)}\int _{(\frac{1}{10})} \Gamma (s) {\mathcal {J}}(s,1) a^{2s} g(u+s)g(v+s) \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)} \nonumber \\&\qquad \times \, \zeta (1+u)^2 \zeta (1+v)^2 (2^{1-2s}-1)\zeta (2s) Z_3(\tfrac{1}{2}+u,\tfrac{1}{2}+v, s,a)\ ds \ du \ dv \nonumber \\&\qquad + O \left( X Y^{-1} (\log ^{21} X) \Phi _{(5)} \right) . \end{aligned}$$
(5.19)

Let \(K_1(\alpha ,\beta ,\gamma ;p), K_2(\alpha ,\beta ,\gamma ;p)\) denote the expressions of (5.12) and (5.13), respectively. We have the following lemma.

Lemma 5.4

In the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )>\tfrac{1}{2},\) \(0< {{\text {Re}}}(\gamma ) < \tfrac{1}{2},\)

$$\begin{aligned} \sum _{(a,2)=1} \frac{\mu (a)}{a^{2-2\gamma }} Z_3(\alpha ,\beta , \gamma , a) = \frac{ \zeta (2\alpha +2\gamma )^3 \zeta (2\beta +2\gamma )^3 \zeta (\alpha +\beta +2\gamma )^4 }{\zeta (\frac{1}{2}+\alpha +2\gamma )^2 \zeta (\frac{1}{2}+\beta +2\gamma )^2 } Z_4(\alpha ,\beta ,\gamma ), \end{aligned}$$
(5.20)

where

$$\begin{aligned}&Z_4(\alpha ,\beta ,\gamma ) := K_1(\alpha ,\beta ,\gamma ;2) \\&\quad \times \prod _p \frac{(1-\frac{1}{p^{2\alpha +2\gamma }})(1-\frac{1}{p^{2\beta +2\gamma }})(1-\frac{1}{p^{\alpha +\beta +2\gamma }})^4}{ (1-\frac{1}{p^{\frac{1}{2}+\alpha +2\gamma }})^{2} (1-\frac{1}{p^{\frac{1}{2}+\beta +2\gamma }})^{2} } \\&\quad \times \prod _{(p,2)=1} \left( K_2(\alpha ,\beta ,\gamma ;p)-\frac{1}{p^{2-2\gamma }}K_1(\alpha ,\beta ,\gamma ;p) \right) . \end{aligned}$$

Moreover,  \(Z_4(\alpha ,\beta ,\gamma )\) is analytic and uniformly bounded in the region \({{\text {Re}}}(\alpha ),{{\text {Re}}}(\beta )\ge \frac{3}{8},\) \(-\frac{1}{16} \le {{\text {Re}}}(\gamma ) \le \frac{1}{8}\).

Proof

We have

$$\begin{aligned} \begin{aligned}&\sum _{(a,2)=1} \frac{\mu (a)}{a^{2-2\gamma }} Z_3 (\alpha ,\beta ,\gamma ,a) \\&\quad = \zeta (2\alpha +2\gamma )^2 \zeta (2\beta +2\gamma )^2 \sum _{(a,2)=1} \frac{\mu (a)}{a^{2-2\gamma }} \prod _{p|2a} K_1(\alpha ,\beta ,\gamma ;p) \prod _{p \not \mid 2a} K_2(\alpha ,\beta ,\gamma ;p) \\&\quad = \zeta (2\alpha +2\gamma )^2 \zeta (2\beta +2\gamma )^2 K_1(\alpha ,\beta ,\gamma ;2)\\&\qquad \times \prod _{(p,2)=1} \left( K_2(\alpha ,\beta ,\gamma ;p) - \frac{1}{p^{2-2\gamma }} K_1(\alpha ,\beta ,\gamma ;p)\right) . \end{aligned} \end{aligned}$$

This implies the Eq. (5.20). The later part of the lemma can be proved directly by the definition of \(Z_4(\alpha ,\beta ,\gamma )\). \(\square \)

It follows from (5.19) and Lemma 5.4 that

$$\begin{aligned}&S_1(k=\Box )\nonumber \\&\quad =\frac{2X }{(2\pi i)^3 }\int _{(1)}\int _{(1)}\int _{(\frac{1}{10})} {\mathcal {J}}(s,1) (2^{1-2s}-1)\zeta (2s) g(u+s)g(v+s) \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)} \nonumber \\&\qquad \times \zeta ^2(1+u)\zeta ^2(1+v) \frac{\Gamma (s) \zeta (1+2u+2s)^3 \zeta (1+2v+2s)^3 \zeta (1+u+v+2s)^4 }{\zeta (1+u+2s)^2 \zeta (1+v+2s)^2 } \nonumber \\&\qquad \times Z_4(\tfrac{1}{2}+u,\tfrac{1}{2}+v,s) \ ds \ du \ dv + O \left( X Y^{-1}(\log ^{21} X ) \Phi _{(5)} \right) , \end{aligned}$$
(5.21)

where \(Z_4(\tfrac{1}{2}+u,\tfrac{1}{2}+v,s)\) is analytic and uniformly bounded in the region \({{\text {Re}}}(u),{{\text {Re}}}(v)\ge -\frac{1}{8}\), \(-\frac{1}{16} \le {{\text {Re}}}(s) \le \frac{1}{8} \).

Move the lines of the triple integral above to \({{\text {Re}}}(u) = {{\text {Re}}}(v) = {{\text {Re}}}(s) = \frac{1}{100}\) without encountering any poles. Then move the line of the integral over v to \({{\text {Re}}}(v)= -\frac{1}{50} + \frac{1}{\log X}\). There is a pole of order at most 2 at \(v=0\), and a pole of order at most 4 at \(v=-s\), so the triple integral in (5.21) is

$$\begin{aligned} \frac{1}{(2\pi i)^2} \int _{(\frac{1}{100})} \int _{(\frac{1}{100})} I_2 (u,s) + I_3 (u,s) \ du \ ds + O \left( U_1^{\frac{1}{50}} U_2^{-\frac{1}{100}}X^{-\frac{1}{100}} (\log ^2 X) \Phi _{(5)} \right) , \end{aligned}$$
(5.22)

where \(I_2(u,s),I_3(u,s)\) are the residues of the integrand in (5.21) at \(v=0\) and \(v=-s\), respectively.

The double integral of \(I_3 (u,s)\) in (5.22) is bounded. To see this, note that

$$\begin{aligned}&I_3(u,v)\\&\quad = {\mathcal {J}}(s,1) (2^{1-2s}-1)\zeta (2s) g(u+s) \frac{U_1^{u+s}X^{-s}}{u+s} \frac{\zeta (1+u)^2 \Gamma (s) \zeta (1+2u+2s)^3}{\zeta (1+u+2s)^2} \frac{1}{3!}\left. \frac{d^3}{dv^3} \right| _{v=-s} \\&\qquad \times \left( \frac{g(v+s) U_2^{v+s}\zeta (1+v)^2 \zeta (1+2v+2s)^3(v+s)^3 \zeta (1+u+v+2s)^4 Z_4(\tfrac{1}{2}+u,\tfrac{1}{2}+v,s)}{\zeta (1+v+2s)^2 } \right) . \end{aligned}$$

Moving the line of the following integral in terms of u from \({{\text {Re}}}(u)=\frac{1}{100}\) to \({{\text {Re}}}(u)=\frac{1}{\log X}\) gives

$$\begin{aligned} \frac{1}{(2\pi i)^2} \int _{(\frac{1}{100})} \int _{(\frac{1}{100})} I_3 (u,s) \ du \ ds \ll U_1^{\frac{1}{100}} X^{-\frac{1}{100}} ( \log ^5 X) \Phi _{(5)}. \end{aligned}$$
(5.23)

Now we handle the double integral of \(I_2 (u,s)\) in (5.22). Write the integrand in (5.21) in the form of

$$\begin{aligned} \frac{U_1^{u+s} U_2^{v+s}X^{-s}}{(u+s)(v+s)} \frac{1}{u^2v^2} \frac{(u+2s)^2 (v+2s)^2}{s (2u+2s)^3 (2v+2s)^3 (u+v+2s)^4}{\mathcal {F}}(u,v,s). \end{aligned}$$

Clearly, \({\mathcal {F}}(u,v,s)\) is analytic in the region \({{\text {Re}}}(u+2s),{{\text {Re}}}(v+2s)>0\), \({{\text {Re}}}(u),{{\text {Re}}}(v)\ge -\frac{1}{8}\) and \(-\frac{1}{16} \le {{\text {Re}}}(s) \le \frac{1}{8} \). We have

$$\begin{aligned} I_2(u,s)= & {} \frac{U_1^{u+s} U_2^{s} X^{-s}}{ 16(u+2s)^3 (u+s)^4 s^4 u^2}\\&\times \left[ {\mathcal {F}} (u,0,s) ( us \log U_2 + 2s^2 \log U_2 -10s -3u) + {\mathcal {F}}^{(0,1,0)} (u,0,s) (us+2s^2) \right] . \end{aligned}$$

Move the line of the double integral below from \({{\text {Re}}}(u)= \frac{1}{100} \) to \({{\text {Re}}}(u)= -\frac{1}{100} + \frac{1}{\log X}\). There is one possible pole at \(u=0\). Hence,

$$\begin{aligned} \frac{1}{(2\pi i)^2} \int _{(\frac{1}{100})} \int _{(\frac{1}{100})} I_2(u,s) \ du\ ds = \frac{1}{2\pi i} \int _{(\frac{1}{100})} \underset{u=0}{{\text {Res}}} \left( I_2(u,s) \right) ds + O \left( U_2^{\frac{1}{100}}X^{-\frac{1}{100}} \log ^{8} X \right) . \end{aligned}$$
(5.24)

Note that

$$\begin{aligned}&\underset{u=0}{{\text {Res}}}\ I_2(u,s) = \frac{U_1^{s} U_2^s X^{-s}}{64 s^{11} } \Big ( {\mathcal {F}}(0,0,s)(s^2\log U_1 \log U_2 -5 s\log U_1 -5 s \log U_2 +26 )\\&\quad +{\mathcal {F}}^{(1,0,0)}(0,0,s)(s^2 \log U_2 -5 s) +{\mathcal {F}}^{(0,1,0)}(0,0,s)(s^2\log U_1 -5 s) + {\mathcal {F}}^{(1,1,0)}(0,0,s) s^2 \Big ). \end{aligned}$$

We see that the expression in the brackets above is analytic for \(-\frac{1}{16} \le {{\text {Re}}}(s) \le \frac{1}{8} \). Then we move the line of the integral below to \({{\text {Re}}}(s)=-\frac{1}{100}\) with only a possible pole at \(s=0\), and get that

$$\begin{aligned}&\frac{1}{2\pi i} \int _{(\frac{1}{100})} \underset{u=0}{{\text {Res}}} \left( I_2(u,s) \right) ds \nonumber \\&\quad = \frac{{\mathcal {F}}(0,0,0)}{64} \sum _{\begin{array}{c} j_1 + j_2 +j_3 +j_4 = 10 \\ j_1,j_2,j_3,j_4 \ge 0 \end{array}} \frac{(-1)^{j_3} B(j_4)}{j_1 ! j_2 ! j_3 ! j_4 !} (\log ^{j_1} U_1) (\log ^{j_2} U_2) (\log ^{j_3} X)\nonumber \\&\qquad + O \left( U_1^{-\frac{1}{100}} U_2^{-\frac{1}{100}} X^{\frac{1}{100}} \log ^2 X+ \log ^9 X\right) , \end{aligned}$$
(5.25)

where

$$\begin{aligned} \begin{aligned} B(j)=\left\{ \begin{array}[c]{ll} 26 &{} \quad \text {if } j=0,\\ -5 (\log U_1 + \log U_2) &{} \quad \text {if } j=1,\\ 2\log U_1 \log U_2 &{} \quad \text {if } j= 2,\\ 0 &{} \quad \text {if } j\ge 3. \end{array} \right. \end{aligned} \end{aligned}$$
(5.26)

Next we compute \({\mathcal {F}}(0,0,0)\) above. Note that \({\mathcal {F}}(0,0,0) = {\mathcal {J}}(0,1) g(0)^2 Z_4 (\frac{1}{2}, \frac{1}{2}, 0) = -\frac{1}{2}\tilde{\Phi }(1) Z_4 (\frac{1}{2}, \frac{1}{2}, 0)\). Recalling the definition of \(Z_4 (\alpha , \beta , \gamma )\) from Lemma 5.4, we have

$$\begin{aligned}&Z_4 (\tfrac{1}{2}, \tfrac{1}{2}, 0) \\&\quad = K_1 ( \tfrac{1}{2}, \tfrac{1}{2}, 0; 2 ) \prod _{p} \left( 1 - \frac{1}{p}\right) ^2 \prod _{(p,2)=1} \left( K_2 ( \tfrac{1}{2}, \tfrac{1}{2},0 ; p)- \frac{1}{p^2}K_1 (\tfrac{1}{2}, \tfrac{1}{2}, 0;p) \right) \\&\quad = \frac{1}{4} K_1 (\tfrac{1}{2}, \tfrac{1}{2}, 0;2 ) \prod _{(p,2)=1} \left( 1 - \frac{1}{p}\right) ^7 \left( 1 + \frac{7}{p} - \frac{3}{p^2} + \frac{6}{p^3} - \frac{4}{p^4} + \frac{1}{p^5}\right) \\&\quad = \frac{1}{4 \zeta _2 (2)} K_1 ( \tfrac{1}{2}, \tfrac{1}{2}, 0;2 ) \prod _{(p,2)=1} \frac{ ( 1 - \frac{1}{p})^6}{1+ \frac{1}{p}} \left( 1 + \frac{7}{p} - \frac{3}{p^2} + \frac{6}{p^3} - \frac{4}{p^4} + \frac{1}{p^5}\right) \\&\quad =\frac{32a_4 }{\pi ^2}. \end{aligned}$$

The last equality is due to (4.12). Thus,

$$\begin{aligned} {\mathcal {F}}(0,0,0) = - \frac{16 \tilde{\Phi }(1) a_4}{\pi ^2}. \end{aligned}$$

Combining (5.21) with (5.22)–(5.25), and the identity above, it follows that

Lemma 5.5

We have

$$\begin{aligned}&S_1(k=\Box ) \\&\quad = - \frac{a_4 \tilde{\Phi }(1) X}{2 \pi ^2} \sum _{j_1 + j_2 +j_3 +j_4 = 10} \frac{(-1)^{j_3} B(j_4)}{j_1 ! j_2 ! j_3 ! j_4 !} (\log ^{j_1} U_1) (\log ^{j_2} U_2) (\log ^{j_3} X) \\&\qquad + X \cdot O \Big ( \log ^{9} X + U_1^{\frac{1}{100}} X^{-\frac{1}{100}} ( \log ^5 X) \Phi _{(5)} + U_1^{\frac{1}{50}} U_2^{-\frac{1}{100}} X^{-\frac{1}{100}} (\log ^2 X) \Phi _{(5)}\\&\qquad + Y^{-1} (\log ^{21} X) \Phi _{(5)} \Big ) . \end{aligned}$$

6 Upper bounds for \(S_1(k \ne \Box )\)

In this section, we shall prove the following upper bounds for \(S_1(k \ne \square )\). The techniques applied here are from [17, Section 5.4] and the last part of [19, Section 3].

Lemma 6.1

Unconditionally,  we have

$$\begin{aligned} S_1(k \ne \Box ) \ll U_1^{\frac{1}{2}} U_2^{\frac{1}{2}}Y X^{\varepsilon } \Phi _{(5)}. \end{aligned}$$

Under GRH,  we have

$$\begin{aligned} S_1(k \ne \Box ) \ll U_1^{\frac{1}{2}} U_2^{\frac{1}{2}} Y (\log X)^{2^{17}} \Phi _{(5)}. \end{aligned}$$

Proof

It follows from (5.9) that

(6.1)

Separate the sum over \(k_1\) to the sum over \(|k_1| \le T:= U_1 U_2 Y^2 X^{-1}\), and that over \(|k_1| > T\). Clearly, \(X^{\frac{4}{5}} \le T \le X^3\) since \(X^{\frac{9}{10}} \le U_1 \le U_2 \le X\) and \( 1\le Y \le X\). For the first category, we move the lines of the integral to \({{\text {Re}}}(u)={{\text {Re}}}(v) = -\frac{1}{2}+ \frac{1}{4\log X}\), \({{\text {Re}}}(s)= \frac{3}{4}\), while for the second category, we move the lines to \({{\text {Re}}}(u)={{\text {Re}}}(v) = -\frac{1}{2}+ \frac{1}{4\log X}\), \({{\text {Re}}}(s)= \frac{5}{4}\).

By (5.6), the terms in the first category are bounded by

(6.2)

Note that

(6.3)

By (6.3) and Lemma 2.3, it follows that

(6.4)

This bound can be improved under GRH. In fact, we split the left-hand side of (6.4) into

By Theorem 2.4, we have for \(|{{\text {Im}}}(u)| \le X^{\frac{1}{5}}\),

Later in (8.10) of Sect. 8, under GRH, it will be proved that for \(-\frac{1}{2}\le {{\text {Re}}}(u) \le -\frac{1}{2} + \frac{1}{\log X}\) and \(|{{\text {Im}}}(u)|\le X\),

Using dyadic blocks and Cauchy-Schwarz inequality, combined with the above bound, we can deduce that for \(|{{\text {Im}}}(u)| \le X^{\frac{1}{5}}\),

Thus for \(|{{\text {Im}}}(u)| \le X^{\frac{1}{5}}\),

(6.5)

Recall the definition of T. Substituting both (6.4) and (6.5) in (6.2), we have proved the contribution of the terms in the first category is \( \ll U_1^{\frac{1}{2}} U_2^{\frac{1}{2}} Y (\log X)^{2^{17}} \Phi _{(5)}\). Similarly, we can deduce that the contribution of the terms in the second category is also \( \ll U_1^{\frac{1}{2}} U_2^{\frac{1}{2}} Y (\log X)^{2^{17}} \Phi _{(5)}\).

The conditional part of the lemma is proved now. The unconditional part can be proved similarly by substituting (6.4) in (6.2). \(\square \)

7 Proof of main theorems

In this section, we complete the proof of Theorems 1.1 and 1.2. The argument is similar to [19, Section 5].

7.1 Proof of Theorem 1.1

Recall the definition of \(S(U_1,U_2)\) from (3.3). Write \(U=\frac{X}{(\log X)^{2^{50}}}\). Take \(U_1=U_2= U\) and \(Y=X^{\frac{1}{2}}U_1^{-\frac{1}{4}}U_2^{-\frac{1}{4}}\).

Using these values, we can simplify Lemmas 3.1, 4.25.5 and 6.1. In the following, we give the detail of the simplification for Lemma 5.5. The summation in Lemma 5.5 is

$$\begin{aligned} \sum _{j_1 + j_2 +j_3 +j_4 = 10} \frac{(-1)^{j_3} B(j_4)}{j_1 ! j_2 ! j_3 ! j_4 !} (\log ^{j_1} U) (\log ^{j_2} U) (\log ^{j_3} X) . \end{aligned}$$
(7.1)

We consider the case \(j_4 = 0\), and other cases can be done similarly. Assume \(j_4 =0\) in (7.1). Then by (5.26), we have

$$\begin{aligned}&\sum _{j_1 + j_2 +j_3 = 10} \frac{(-1)^{j_3} B(0)}{j_1 ! j_2 ! j_3 ! } (\log ^{j_1} U) (\log ^{j_2} U) (\log ^{j_3} X) \\&\quad = 26 \sum _{j_1 + j_2 +j_3 = 10} \frac{(-1)^{j_3} }{j_1 ! j_2 ! j_3 ! } (\log ^{j_1} U) (\log ^{j_2} U) (\log ^{j_3} X) \\&\quad = 26(\log ^{10} X) \sum _{j_1 + j_2 +j_3 = 10} \frac{(-1)^{j_3} }{j_1 ! j_2 ! j_3 ! } + O \left( \log ^{9 + \varepsilon } X \right) \\&\quad =\frac{26}{10!} \log ^{10} X + O \left( \log ^{9 + \varepsilon } X \right) . \end{aligned}$$

The second last equality is due to \(\log ^j U = \log ^{j} X + O(\log ^{j-1+\varepsilon } X)\) for \(j\ge 0\). The last equality is obtained by

$$\begin{aligned} \sum _{j_1 + j_2 +j_3 = 10} \frac{(-1)^{j_3} }{j_1 ! j_2 ! j_3 ! } = \frac{1}{10!} \left. \frac{d^{10}}{dx^{10}} \right| _{x=0} (e^x e^x e^{-x} )= \frac{1}{10!}. \end{aligned}$$

Similarly, we can compute other cases in (7.1). Combining all cases we can show (7.1) is

$$\begin{aligned} \left( \frac{26}{10!} - \frac{10}{9!} + \frac{1}{8!}\right) \log ^{10} X + O \left( \log ^{9 + \varepsilon } X \right) = \frac{1}{2^4 \cdot 3^4 \cdot 5^2 \cdot 7}\log ^{10} X + O \left( \log ^{9 + \varepsilon } X \right) . \end{aligned}$$

Using this fact, Lemma 5.5 can be simplified to

$$\begin{aligned} S_1(k=\Box ) = - \frac{a_4 \tilde{\Phi }(1)}{2^5 \cdot 3^4 \cdot 5^2 \cdot 7 \cdot \pi ^2} X \log ^{10} X +O \left( X \log ^{9+\varepsilon } X + X (\log ^{-20} X) \Phi _{(5)} \right) . \end{aligned}$$

Now by (3.3), (3.6), combined with Lemmas 3.14.25.5 and 6.1, we can obtain that

(7.2)

Define \(B_U(\frac{1}{2};8d) = L(\tfrac{1}{2},\chi _{8d})^2 - A_U(\frac{1}{2};8d)\). We claim that

(7.3)

In fact, we have

$$\begin{aligned} B_U(\tfrac{1}{2};8d) =\frac{1}{\pi i} \int _{(c)} g(s) L(\tfrac{1}{2}+s,\chi _{8d})^2 \frac{(8d)^s-U^s}{s} ds. \end{aligned}$$

Since \(\frac{(8d)^s-U^s}{s}\) is entire, we move the line of the integral to \({{\text {Re}}}(s)=0\). By the bound \(| \frac{(8d)^{it}-U^{it}}{it}| \ll \log ( \frac{8d}{U} )\), \(t\in {\mathbb {R}}\), we get that

$$\begin{aligned} B_U(\tfrac{1}{2};8d) \ll \log \left( \frac{8d}{U} \right) \int _{-\infty }^{\infty } |g(it)| |L(\tfrac{1}{2}+it,\chi _{8d})|^2dt. \end{aligned}$$

This implies that the left-hand side of (7.3) is

(7.4)

Split the integral according to whether \(|t_1|,|t_2| \le X\). If \(|t_1|,|t_2| \le X\), then use Theorem 2.4. Otherwise, use Lemma 2.3. This will establish (7.3).

Note that

Using the Cauchy–Schwarz inequality on the third term, combined with (7.2) and (7.3), we obtain that

(7.5)

In the following we remove the function \(\Phi (\frac{d}{X})\) in the above summation. Choose \(\Phi \) such that \(\Phi (t) =1\) for all \(t \in (1+Z^{-1} , 2-Z^{-1})\), \(\Phi (t) =0\) for all \(t \notin (1,2) \), and \(\Phi ^{(\nu )} (t)\ll _{\nu } Z^{\nu }\) for all \(\nu \ge 0\). This implies that \(\Phi _{(\nu )} \ll _{\nu } Z^{\nu }\), and that \(\tilde{\Phi }(1) = \check{\Phi } (0) = 1 + O(Z^{-1})\). Then by (7.5), we get that

Take \(Z=\log X\). We have

(7.6)

Similarly, we can choose \(\Phi (t)\) in (7.5) such that \(\Phi (t) = 1 \) for all \(t \in [1 , 2]\), \(\Phi (t) =0\) for all \(t \notin (1-Z^{-1},2+Z^{-1}) \), and \(\Phi ^{(\nu )}(t) \ll _{\nu } Z^{\nu }\) for all \(\nu \ge 0\). Taking \(Z=\log X\), we can deduce that

(7.7)

Combining (7.6) and (7.7), we obtain that

Applying the above with \(X= \frac{x}{2}\), \(X= \frac{x}{4}\), \(\dots \), we have proved Theorem 1.1.

7.2 Proof of Theorem 1.2

Write \(U = X^{1-4\varepsilon }\). By the Cauchy–Schwarz inequality, we obtain that

(7.8)

Let \(A^2\) and B denote the numerator and denominator of the right-hand side in (7.8), respectively.

We first handle B. By (3.3) and (3.6), combined with Lemmas 3.14.2, 5.5 and 6.1, taking \(Y=X^{\frac{1}{2}}U_1^{-\frac{1}{4}}U_2^{-\frac{1}{4}}\) and \( U_1=U_2= U\), we get that

$$\begin{aligned} B = S(U_1,U_2) = \frac{a_{4} \left( 1-\frac{80}{3}\varepsilon + O(\varepsilon ^2) \right) }{2^6 \cdot 3^3 \cdot 5^2 \cdot 7 \cdot \pi ^2} \tilde{\Phi }(1) X \log ^{10} X + O \left( X \log ^{9} X + X \Phi _{(5)}\right) , \end{aligned}$$

where the implied constant in \(O(\varepsilon ^2)\) is absolute.

For A, we have

where

$$\begin{aligned} h_1(x,y,z) := \Phi \left( \frac{x}{X}\right) \omega \left( \frac{y\pi }{U}\right) \omega \left( \frac{z\pi }{8x}\right) . \end{aligned}$$

Note that the difference between A and B lies in the difference between h(xyz) and \(h_1(x,y,z)\). By slightly modifying the argument for computing B, taking \(Y=X^{\frac{1}{2}}U^{-\frac{1}{4}} X^{-\frac{1}{4}}\), we can deduce that

$$\begin{aligned} A = \frac{a_{4} \left( 1-\frac{40}{3}\varepsilon + O(\varepsilon ^2) \right) }{2^6 \cdot 3^3 \cdot 5^2 \cdot 7 \cdot \pi ^2} \tilde{\Phi }(1) X \log ^{10} X + O \left( X \log ^{9} X+X \Phi _{(5)}\right) , \end{aligned}$$

where the implied constant in \(O(\varepsilon ^2)\) is absolute.

Choose \(\Phi \) such that \(\Phi (t) =1\) for all \(t \in (1+Z^{-1} , 2-Z^{-1})\), \(\Phi (t) =0\) for all \(t \notin (1,2) \), and \(\Phi ^{(\nu )} (t)\ll _{\nu } Z^{\nu }\) for all \(\nu \ge 0\). Take \(Z=\log X\). Combining (7.8) with the estimates for A and B, we have

Having summed this with \(X= \frac{x}{2}\), \(X= \frac{x}{4}\), \(\dots \), we obtain Theorem 1.2.

8 Proof of Theorem 2.4

In this section, we shall prove Theorem 2.4. The proof here closely follows [19, Section 6].

Let \(x\in {\mathbb {R}}\) with \(x \ge 10\), and \(z \in {\mathbb {C}}\). Define

$$\begin{aligned} {\mathcal {L}}(z,x):=\left\{ \begin{array}[c]{ll} {\text {log}}{\text {log}}x &{}\quad |z|\le ({\text {log}}x)^{-1},\\ -{\text {log}}|z|&{}\quad ({\text {log}}x)^{-1}< |z|\le 1,\\ 0&{}\quad |z| >1. \end{array} \right. \end{aligned}$$

Let \(z_1, z_2 \in {\mathbb {C}}\). We define

$$\begin{aligned} {\mathcal {M}}(z_1,z_2,x) :=\frac{1}{2} \left( {\mathcal {L}}(z_1,x)+{\mathcal {L}}(z_2,x) \right) , \end{aligned}$$

and

$$\begin{aligned}&{\mathcal {V}} (z_1,z_2,x)\\&\quad :=\frac{1}{2}\left( {\mathcal {L}}(2z_1,x)+{\mathcal {L}}(2z_2,x)+{\mathcal {L}}(2 {{\text {Re}}}(z_1),x)+{\mathcal {L}}(2{{\text {Re}}}(z_2),x)\right. \\&\left. \qquad +2{\mathcal {L}}(z_1+z_2,x)+2{\mathcal {L}}(z_1+\overline{z_2},x)\right) . \end{aligned}$$

Remark 8.1

We see that the definition of \({\mathcal {M}}(z_1,z_2,x)\) is different from that in [19, Section 6] by a factor \(-1\), while \({\mathcal {V}} (z_1,z_2,x)\) is the same. The difference is due to the different symmetry types of families of L-functions (see Katz–Sarnak [12]). The family of quadratic Dirichlet L-functions is symplectic, whereas the family of quadratic twists of a modular L-function in [19] is orthogonal. For further explanation, we refer readers to [19, p. 1111] and [18, p. 991].

Proposition 8.2

Assume GRH for \(L(s,\chi _d)\) for all fundamental discriminants d. Let X be large. Let \(z_1,z_2 \in {\mathbb {C}}\) with \(0 \le {{\text {Re}}}(z_1), {{\text {Re}}}(z_2) \le \frac{1}{\log X}\), and \(|{{\text {Im}}}(z_1)|, |{{\text {Im}}}(z_2)| \le X\). Let \({\mathcal {N}}(V;z_1,z_2,X)\) denote the number of fundamental discriminants \(|d|\le X\) such that

$$\begin{aligned} {\text {log}}|L(\tfrac{1}{2}+z_1,\chi _{d})L(\tfrac{1}{2}+z_2,\chi _{d})|\ge V +{\mathcal {M}}(z_1,z_2,X). \end{aligned}$$

Then for \(10\sqrt{{\text {log}}{\text {log}} X}\le V \le {\mathcal {V}}(z_1,z_2,X)\), we have

$$\begin{aligned} {\mathcal {N}}(V;z_1,z_2,X)\ll X{\text {exp}}\left( -\frac{V^2}{2{\mathcal {V}}(z_1,z_2,X)} \left( 1-\frac{25}{{\text {log}}{\text {log}}{\text {log}}X}\right) \right) ; \end{aligned}$$

for \({\mathcal {V}}(z_1,z_2,X)< V \le \frac{1}{16}{\mathcal {V}}(z_1,z_2,X){\text {log}}{\text {log}}{\text {log}}X\), we have

$$\begin{aligned} {\mathcal {N}}(V;z_1,z_2,X)\ll X{\text {exp}}\left( -\frac{V^2}{2{\mathcal {V}}(z_1,z_2,X)} \left( 1-\frac{15V}{{\mathcal {V}}(z_1,z_2,X){\text {log}}{\text {log}}{\text {log}}X}\right) ^2\right) ; \end{aligned}$$

finally, for \(\frac{1}{16}{\mathcal {V}}(z_1,z_2,X){\text {log}}{\text {log}} {\text {log}}X<V\), we have

$$\begin{aligned} {\mathcal {N}}(V;z_1,z_2,X)\ll X{\text {exp}}\left( -\frac{1}{1025}V{\text {log}}V\right) . \end{aligned}$$

Proof

It is helpful to keep in mind that \(\log \log X + O(1) \le {\mathcal {V}}(z_1,z_2,x) \le 4\log \log X \). By slightly modifying the proof of the main proposition in [18], we obtain that for any \(2 \le x \le X\),

$$\begin{aligned}&\log |L(\tfrac{1}{2}+z_i,\chi _d)| \\&\quad \le {{\text {Re}}}\left( \sum _{2 \le n \le x} \frac{ \Lambda (n) \chi _d (n)}{n^{\frac{1}{2}+\frac{\lambda _0}{\log x}+z_i} \log n} \frac{\log (\frac{x}{n})}{\log x} \right) + (1+\lambda _0)\frac{\log X}{\log x} +O \left( \frac{1}{\log x} \right) ,\quad i=1,2, \end{aligned}$$

where \(\lambda _0 = 0.56 \dots \) is the unique real number satisfying \(e^{-\lambda _0} = \lambda _0\). It follows that

$$\begin{aligned}&\log |L(\tfrac{1}{2}+z_1 , \chi _d)||L(\tfrac{1}{2}+z_2,\chi _d)| \nonumber \\&\quad \le {{\text {Re}}}\left( \sum _{\begin{array}{c} p^l \le x \\ l \ge 1 \end{array}} \frac{\chi _d (p^l)}{l p^{l(\tfrac{1}{2}+\frac{\lambda _0}{\log x})}} (p^{-lz_1} + p^{-lz_2}) \frac{\log (\frac{x}{p^l})}{\log x} \right) + 2 (1+\lambda _0)\frac{\log X}{\log x} +O \left( \frac{1}{\log x} \right) . \end{aligned}$$
(8.1)

The terms with \(l \ge 3\) in the above sum contribute O(1). Using the fact \(\sum _{p|d} \frac{1}{p} \ll \log \log \log d\), we get that

$$\begin{aligned}&{{\text {Re}}}\left( \sum _{p^2 \le x } \frac{\chi _d (p^2)}{2 p^{1+\frac{2\lambda _0}{\log x}}} (p^{-2z_1} + p^{-2z_2}) \frac{\log (\frac{x}{p^2})}{\log x} \right) \nonumber \\&\quad = {{\text {Re}}}\left( \sum _{p \le \sqrt{x} } \frac{1}{2 p^{1+\frac{2\lambda _0}{\log x}}} (p^{-2z_1} + p^{-2z_2}) \frac{\log (\frac{x}{p^2})}{\log x} \right) + O(\log \log \log X). \end{aligned}$$
(8.2)

By RH, we can deduce that

$$\begin{aligned} \sum _{p\le y}(p^{-2z_1}+p^{-2z_2})\log p = \frac{y^{1-2z_1}}{1-2z_1} +\frac{y^{1-2z_2}}{1-2z_2}+O \left( \sqrt{y} (\log Xy)^2 \right) . \end{aligned}$$
(8.3)

The above sum also has a trivial bound \(\ll y\). Combining (8.2) with these two bounds, by partial summation, we have

$$\begin{aligned} \sum _{p\le \sqrt{x}} \frac{1}{2 p^{1+\frac{2\lambda _0}{\log x}}}(p^{-2z_1}+p^{-2z_2}) \frac{\log (\frac{x}{p^2})}{\log x}={\mathcal {M}}(z_1,z_2,x)+O (\log \log \log X). \end{aligned}$$

Inserting above estimates into (8.1), by \({\mathcal {M}}(z_1,z_2,x) \le {\mathcal {M}}(z_1,z_2,X)\), we obtain that

$$\begin{aligned}&\log |L (\tfrac{1}{2}+z_1 , \chi _d)||L(\tfrac{1}{2}+z_2,\chi _d)| \nonumber \\&\quad \le {{\text {Re}}}\left( \sum _{2<p \le x} \frac{\chi _d (p)}{p^{\frac{1}{2}+\frac{\lambda _0}{\log x}}} (p^{-z_1} + p^{-z_2}) \frac{\log (\frac{x}{p})}{\log x} \right) \nonumber \\&\qquad +{\mathcal {M}}(z_1,z_2,X)+ \frac{4 \log X}{\log x} + O(\log \log \log X). \end{aligned}$$
(8.4)

For brevity, put \({\mathcal {V}} := {\mathcal {V}} (z_1,z_2,X)\). Set

$$\begin{aligned} A:=\left\{ \begin{array}[c]{ll} \frac{1}{2}\log \log \log X &{}\quad 10 \sqrt{\log \log X}\le V\le {\mathcal {V}},\\ \frac{{\mathcal {V}}}{2V}\log \log \log X &{}\quad {\mathcal {V}}<V\le \frac{1}{16}{\mathcal {V}}\log \log \log X,\\ 8 &{}\quad V > \frac{1}{16}{\mathcal {V}}\log \log \log X. \end{array} \right. \end{aligned}$$

By taking \(x = \log X\) in (8.4) and bounding the sum over p in (8.4) trivially, we know that \({\mathcal {N}} (V; z_1,z_2,X) =0\) for \(V > \frac{5\log X}{\log \log X} \). Thus, we can assume \(V \le \frac{5\log X}{\log \log X} \).

From now on, we set \(x=X^{A/V}\) and \(z=x^{1/\log \log X}\). Let \(S_1\) be the sum in (8.4) truncated to \(p \le z\), and \(S_2\) be the sum over \(z < p \le x\). It follows from (8.4) that

$$\begin{aligned} \log |L (\tfrac{1}{2}+z_1 , \chi _d)||L(\tfrac{1}{2}+z_2,\chi _d)| \le S_1 + S_2 + {\mathcal {M}}(z_1,z_2,X) + \frac{5V}{A}. \end{aligned}$$

Note that if d satisfies \(\log |L (\frac{1}{2}+z_1 , \chi _d)||L(\tfrac{1}{2}+z_2,\chi _d)| \ge V + {\mathcal {M}} (z_1,z_2,X)\), then either

$$\begin{aligned} S_2 \ge \tfrac{V}{A}, \text { or } S_1 \ge V_1 := V(1-\tfrac{6}{A}). \end{aligned}$$

Write

$$\begin{aligned} {\text {meas}}(X;S_1)&:= \# \{|d| \le X \ : \ d \text { is a fundamental discriminant, } S_1 \ge V_1 \},\\ {\text {meas}}(X;S_2)&:= \# \{|d| \le X \ : \ d \text { is a fundamental discriminant, } S_2 \ge \tfrac{V}{A} \}. \end{aligned}$$

For any \(m \le \frac{V}{2A} -1\), by [19, Lemma 6.3], we have

By choosing \(m = \lfloor \frac{V}{2A}\rfloor -1\), we get that

$$\begin{aligned} {\text {meas}}(X;S_2) \ll X{\text {exp}}\left( -\frac{V}{4A}\log V\right) . \end{aligned}$$
(8.5)

We next estimate \({\text {meas}}(X;S_1)\). For any \(m \le \frac{\frac{1}{2}\log X - \log \log X}{ \log z}\), by [19, Lemma 6.3], we obtain that

(8.6)

where

$$\begin{aligned} a(p)=\frac{{{\text {Re}}}(p^{-z_1}+p^{-z_2})\log (\frac{x}{p})}{p^{\frac{\lambda _0}{\log x}}\log x}. \end{aligned}$$

By using (8.3) and the partial summation, we can show that

$$\begin{aligned} \sum _{p\le z}\frac{|a(p)|^2}{p} \le \frac{1}{4}\sum _{p\le \sqrt{X}} \frac{1}{p}(p^{-z_1}+p^{-\overline{z_1}}+p^{-z_2}+p^{-\overline{z_2}})^2 ={\mathcal {V}}(z_1,z_2,X)+O(\log \log \log X). \end{aligned}$$

Together with (8.6), this yields

$$\begin{aligned} {\text {meas}}(X ; S_1) \ll X V_1^{-2m} \frac{(2m)!}{m!2^m} ({\mathcal {V}} + O(\log \log \log X))^m \ll X\left( \frac{2m}{e} \cdot \frac{{\mathcal {V}}+O(\log \log \log X)}{V_1^2}\right) ^m. \end{aligned}$$

Taking \(m = \lfloor \frac{V_1^2}{ 2{\mathcal {V}}} \rfloor \) when \(V \le \frac{(\log \log X)^2}{\log \log \log X}\), and taking \( m = \lfloor 10V \rfloor \) otherwise, we obtain that

$$\begin{aligned} {\text {meas}}(X ; S_1) \ll X{\text {exp}}\left( -\frac{V_1^2}{2{\mathcal {V}}}\left( 1+O\left( \frac{\log \log \log X}{\log \log X}\right) \right) \right) +X{\text {exp}}\left( -V\log V\right) . \end{aligned}$$
(8.7)

Using the estimates (8.5) and (8.7), we can establish Proposition 8.2. This completes the proof. \(\square \)

For convenience, in the following we show a rough form of Proposition 8.2. Let \(k \in {\mathbb {R}}_{>0}\) be fixed. For \(10\sqrt{{\text {log}}{\text {log}} X} \le V \le 4k {\mathcal {V}}(z_1,z_2,X)\), we have

$$\begin{aligned} {\mathcal {N}}(V;z_1,z_2,X)\ll X({\text {log}}X)^{o(1)}{\text {exp}}\left( -\frac{V^2}{2{\mathcal {V}}(z_1,z_2,X)}\right) , \end{aligned}$$
(8.8)

and for \(V > 4k {\mathcal {V}}(z_1,z_2,X)\), we have

$$\begin{aligned} {\mathcal {N}}(V;z_1,z_2,X)\ll X({\text {log}}X)^{o(1)}{\text {exp}}(-4kV). \end{aligned}$$
(8.9)

Observe that

Inserting the rough bounds (8.8) and (8.9) into the integral above, we can deduce that

Theorem 8.3

Assume GRH for \(L(s,\chi _d)\) for all fundamental discriminants d. Let X be large. Let \(z_1,z_2 \in {\mathbb {C}}\) with \(0 \le {{\text {Re}}}(z_1), {{\text {Re}}}(z_2) \le \frac{1}{\log X},\) and \(|{{\text {Im}}}(z_1)|, |{{\text {Im}}}(z_2)| \le X.\) Then for any positive real number k and any \(\varepsilon >0,\) we have

In the rest of this section, we complete the proof of Theorem 2.4.

Proof of Theorem 2.4

By Theorem 8.3 and the fact that \({\mathcal {L}}(z,x) \le \log \log x\) for \(z \in {\mathbb {C}}, x \ge 10\), we can trivially get that

(8.10)

Now we assume \(|{{\text {Im}}}(z_1) - {{\text {Im}}}(z_2)| \ge \frac{1}{\log X}\). Write \(t_1 = {{\text {Im}}}(z_1)\) and \(t_2 = {{\text {Im}}}(z_2)\).

If \(t_1t_2 \ge 0\), then \(|t_1-t_2| \le |t_1+t_2| \le \max (2|t_1|, 2|t_2|)\), say \(|t_1+t_2| \le 2|t_1|\). Note that \({\mathcal {L}}(y,X\)) is a decreasing function for \(y \ge 0 \). Thus, we have

$$\begin{aligned} {\mathcal {L}}(z_1,X),\ {\mathcal {L}}(2z_1,X),\ {\mathcal {L}}(z_1+z_2,X), \ {\mathcal {L}}(z_1+\overline{z_2},X)&\le {\mathcal {L}}(|t_1-t_2|,X) + O(1) \\&\le \max (0, -\log |t_1-t_2|) +O(1). \end{aligned}$$

This together with

$$\begin{aligned} {\mathcal {L}}(z_2,X),\ {\mathcal {L}}(2z_2,X),\ {\mathcal {L}}(2 {{\text {Re}}}(z_1),X),\ {\mathcal {L}}(2 {{\text {Re}}}(z_2),X) \le \log \log X \end{aligned}$$

implies

$$\begin{aligned} 2{\mathcal {M}}(z_1,z_2,X) + 2{\mathcal {V}}(z_1,z_2,X) \le 4\log \log X + \max \{0,- 6\log |t_1-t_2|\}+O(1). \end{aligned}$$
(8.11)

On the other hand, if \(t_1t_2 < 0\), then \(|t_1-t_2| = |t_1|+|t_2|\le \max \{|2t_1|,|2t_2|\}\), say \(|t_1-t_2| \le |2t_2|\). It implies that \(|t_1| \le |t_2|\) and that \({\mathcal {L}}(2t_2,X)\le {\mathcal {L}}(|t_1-t_2|,X)\). Note \(|t_1-t_2|=2|t_1|+|t_1+t_2|\), so \(|t_1-t_2| \le \max \{4|t_1|, 2|t_1+t_2|\}\). In fact, if \(|t_1-t_2| > 4 |t_1|\), then \(2|t_1|+|t_1+t_2| > 4|t_1|\), which implies \(|t_1| \le \frac{1}{2} |t_1+t_2| \). It means \(|t_1-t_2|=2|t_1|+|t_1+t_2| \le 2 |t_1 +t_2|\). Without loss of generality, we can say \(|t_1-t_2| \le 4|t_1|\). It follows that \({\mathcal {L}}(z_1,X), {\mathcal {L}}(2z_1,X)\le {\mathcal {L}}(|t_1-t_2|,X)+O(1)\). Now we have

$$\begin{aligned}&{\mathcal {L}}(z_1,X),\ {\mathcal {L}}(2z_1,X),\ {\mathcal {L}}(z_2 ,X), \ {\mathcal {L}}(2z_2 ,X), \ {\mathcal {L}}(z_1+\overline{z_2},X)\le {\mathcal {L}}(|t_1-t_2|,X) + O(1) \\&\quad \le \max (0, -\log |t_1-t_2|) +O(1). \end{aligned}$$

This combined with

$$\begin{aligned} {\mathcal {L}}(2 {{\text {Re}}}(z_1),X),\ {\mathcal {L}}(2 {{\text {Re}}}(z_2),X),\ {\mathcal {L}}(z_1+z_2,X) \le \log \log X \end{aligned}$$

also implies (8.11).

By inserting (8.11) into Theorem 8.3, we can show for \(|{{\text {Im}}}(z_1) - {{\text {Im}}}(z_2)| \ge \frac{1}{\log X}\),

(8.12)

By combining (8.12) and (8.10) with \(k=2\), we have proved Theorem 2.4. \(\square \)