1 Introduction

Let \(k \ge 2 \) be an integer and g be a weight \(k+ \tfrac{1}{2}\) cusp form for \(\Gamma _0(4)\). Every such g has a Fourier expansion

$$\begin{aligned} g(z)=\sum _{n \ge 1} c(n) n^{\frac{(k-1/2)}{2}}e(nz). \end{aligned}$$

The Fourier coefficients c(n) encode arithmetic information. For instance under certain hypotheses, Waldspurger’s Theorem shows that for fundamental discriminants d, the value \(|c(|d|)|^2\) is proportional to the central value of an L-function, so that the magnitude of the L-function essentially determines the size of the coefficient c(n). However for g with real Fourier coefficients, their signs remain mysterious. In this article we contribute towards understanding the sign of such coefficients at fundamental discriminants through examining the number of coefficients which are positive (respectively negative) as well as the number of sign changes in-between.

Signs of Fourier coefficients of half-integral weight forms have been studied by many authors following the works of Knopp–Kohnen–Pribitkin [13] and Bruinier–Kohnen [3], the former of which showed that such forms have infinitely many sign changes. Subsequent works [9, 17, 20] showed that the sequence \(\{c(n)\}\) exhibits many sign changes under suitable conditions (such as the form having real Fourier coefficients). Notably, Jiang–Lau–Lü–Royer–Wu [11] showed for suitable g that for every \(\varepsilon > 0\) there are more than \(\gg X^{2/9 - \varepsilon }\) sign changes along square-free integers \(n \in [1, X]\). They also showed this result can be improved assuming the Generalized Lindelöf HypothesisFootnote 1 with an exponent of 1/4 in place of 2/9.

For an integral weight Hecke cusp form f the second named author and Matomäki [22] proved a stronger result, establishing a positive proportion of sign changes along the positive integers. This uses the multiplicativity of the Fourier coefficients of f in a fundamental way. Fourier coefficients of half-integral weight Hecke cusp forms lack this property, except at squares. So one may wonder whether the Fourier coefficients of half-integral weight Hecke cusp forms also exhibit a positive proportion of sign changes, along the sequence of fundamental discriminants.

In this article we answer this question in the affirmative. We show that under the assumption of the Generalized Riemann Hypothesis (GRH) there exists a positive proportion of fundamental discriminants at which the Fourier coefficients of a suitable half-integral weight form are positive as well as a positive proportion at which the coefficients are negative. Moreover, we show under GRH that the coefficients exhibit a positive proportion of sign changes along the sequence of fundamental discriminants.

For simplicity, our results are stated for the Kohnen space \(S_{k+1/2}^+\), which consists of all weight \(k+1/2\) modular forms on \(\Gamma _0(4)\) whose nth Fourier coefficient equals zero whenever \((-1)^k n \equiv 2,3 \pmod {4}\). In this space Shimura’s correspondence between half-integral weight forms and integral weight forms is well understood. Kohnen proved [14] there exists a Hecke algebra isomorphism between \(S_{k+1/2}^+\) and the space of level 1 cusp forms of weight 2k. Also, every HeckeFootnote 2 cusp form \(g \in S_{k+1/2}^+\) can be normalized so that it has real coefficientsFootnote 3 and from here on we assume that g has been normalized in this way.

Let \({\mathbb {N}}^{\flat }\) denote the set of fundamental discriminants of the form 8n with \(n > 0\) odd, square-free. Also, let \({\mathbb {N}}_g^{\flat }(X)=\{n \in {\mathbb {N}}^{\flat } \cap [1,X] : c(n) \ne 0 \}\).

Theorem 1

Assume the Generalized Riemann Hypothesis. Let \(k \ge 2\) be an integer and \(g \in S_{k+1/2}^+\) be a Hecke cusp form. Then for all X sufficiently large the number of sign changes of the sequence \(\{ c(n) \}_{n \in {\mathbb {N}}_g^{\flat }(X)}\) is \( \gg X\).

In particular, for all X sufficiently large we can find \(\gg X\) integers \(d \in {\mathbb {N}}^{\flat } \cap [1,X]\) such that \(c(d) < 0\), and we can find \(\gg X\) integers \(d \in {\mathbb {N}}^{\flat }\cap [1,X]\) such that \(c(d) > 0\).

The proof of Theorem 1 uses the explicit form of Waldspurger’s Theorem due to Kohnen and Zagier [18]. Given a Hecke cusp form \(g \in S_{k+1/2}^+\) they show that for each fundamental discriminant d with \((-1)^k d>0\) that

$$\begin{aligned} |c(|d|)|^2= L\left( \tfrac{1}{2}, f \otimes \chi _d\right) \cdot \frac{(k-1)!}{\pi ^k } \cdot \frac{\langle g,g \rangle }{\langle f,f \rangle }. \end{aligned}$$
(1.1)

Here f is a weight 2k Hecke cusp form of level 1 which corresponds to g as described above, \(L(s,f\otimes \chi _d)\) is the L-function

$$\begin{aligned} L(s,f\otimes \chi _d)=\sum _{n \ge 1} \frac{\lambda _f(n) \chi _d(n)}{n^s}, \quad {\text {Re}}(s)>1 \end{aligned}$$

where \(\lambda _f(n)\) are the Hecke eigenvalues of f, normalized so that \(\lambda _f(1) = 1\) and \(|\lambda _f(n)| \le d(n)\) for all \(n \ge 1\), and \(\chi _d(\cdot )\) is the Kronecker symbol. Also,

$$\begin{aligned} \langle f,f \rangle = \int _{{\text {SL}}_2({\mathbb {Z}}) \backslash {\mathbb {H}}} y^{2k}|f(z)|^2 \, \frac{dx dy}{y^2}, \quad \qquad \langle g,g \rangle = \frac{1}{6} \int _{\Gamma _0(4) \backslash {\mathbb {H}}} y^{k+1/2}|g(z)|^2 \, \frac{dx dy}{y^2}. \end{aligned}$$

In Theorem 1 we assume GRH for \(L(s, f \otimes \chi _{d})\) for every fundamental discriminant d with \((-1)^k d>0\).

The restriction to \(d \in {\mathbb {N}}^{\flat }\) is important. As the proof of Theorem 3 below will show, it is easy to produce many positive (resp. negative) coefficients along the integers, assuming a suitable non-vanishing result.

1.1 Unconditional results

We also are able to prove a quantitatively weaker yet unconditional result. These results are significantly easier to obtain than our conditional result, Theorem 1.

Theorem 2

Let \(k \ge 2\) be an integer and \(g \in S_{k+1/2}^+\) be a Hecke cusp form. Then for any \(\varepsilon >0\) and all X sufficiently large the sequence \(\{ c(n) \}_{n \in {\mathbb {N}}_g^{\flat }(X)}\) has \(\gg X^{1-\varepsilon }\) sign changes.

Theorems 1 and 2 quantitatively match the best known non-vanishing results for Fourier coefficients of half-integral weight forms that are proved using analytic techniques, conditionally under GRH [8] and unconditionally [25] (resp.). In particular, Theorem 1 gives a different proof that a positive proportion of these coefficients are non-zero, for Hecke forms in the Kohnen space. It should be noted that Ono–Skinner [24] have shown that there exist \(\gg X/\log X\) fundamental discriminants at which these coefficients are non-zero for such forms.Footnote 4 However, their result does not give a quantitative lower bound on the size of the coefficients, whereas the analytic estimates do provide such information, which is crucial for our argument.

On the other hand, using the result of Ono–Skinner it is not difficult to produce both many positive Fourier coefficients and many negative ones, at integers.

Theorem 3

Let \(k \ge 2\) be an integer and \(g \in S_{k+1/2}^+\) be a Hecke cusp form. Then, for all sufficiently large X

$$\begin{aligned} \# \{ n \le X : c(n)>0 \} \gg \frac{X}{\log X} \quad \text {and} \quad \# \{ n \le X : c(n)<0 \} \gg \frac{X}{\log X}. \end{aligned}$$

1.2 Extensions beyond the Kohnen plus space

Since by now Shimura’s correspondence is fairly well-understood (see [2]) we show in the Appendix that the conclusion of Theorems 1 and 2 holds for every half-integral weight Hecke cusp form on \(\Gamma _0(4)\).Footnote 5 Additionally, we can prove analogs of Theorems 1 and 2 which hold for weight \(k+\tfrac{1}{2}\) (\(k \ge 2\)) cusp forms g of level 4N with N odd and square-free provided that g corresponds (through Shimura’s correspondence) to an integral weight newform. The necessary modifications to our argument and precise statements of the results are in the Appendix.

1.3 Numerical examples

To illustrate our results above with a concrete example consider the following weight \(\frac{13}{2}\) Hecke cusp form

$$\begin{aligned} \delta (z)=\frac{60}{2 \pi i} \left( 2 G_4(4z)\theta '(z)-G_4'(4z)\theta (z) \right) =\sum _{\begin{array}{c} n \ge 1 \\ n \equiv 0,1 \pmod {4} \end{array}} \alpha _{\delta }(n) e(nz), \end{aligned}$$

where

$$\begin{aligned} G_k(z)=\frac{1}{2} \cdot \zeta (1 - k) + \sum _{n \ge 1} \sigma _{k-1}(n)e(nz) \quad \text { and} \quad \theta (z)=\sum _{n \in {\mathbb {Z}}} e(n^2z). \end{aligned}$$

The modular form \(\delta (z)\) corresponds to the modular discriminant \(\Delta (z)\) under the Shimura lift. Assuming GRH for \(L(\tfrac{1}{2}, \Delta \otimes \chi _d)\) for every fundamental discriminant d, Theorem 1 implies that there is a positive proportion of sign changes of \(\alpha _{\delta }(n)\) along the sequence of fundamental discriminants of the form 8d. In fact numerical evidence below suggests that the Fourier coefficients of \(\delta (z)\) change sign approximately one half of the time. Given a subset \({\mathcal {L}}\), let \({\mathcal {S}}_{\delta , {\mathcal {L}}}(X)\) denote the number of sign changes of \(\alpha _{\delta }(n)\) along \(n \in {\mathcal {L}} \cap [1, X]\), and denote by \({\mathcal {N}}_{\delta , {\mathcal {L}}}(X)\) the cardinality of \({\mathcal {L}} \cap [1, X]\). We then have the following numerical data.

X

\(2\times 10^5\)

\(2 \times 10^6\)

\(2 \times 10^7\)

\(2 \times 10^8 \)

\(2 \times 10^9 \)

\({\mathcal {S}}_{\delta ,{\mathbb {N}}}(X)\)

50291

501163

5000867

50000368

500027782

\( \frac{1}{{\mathcal {N}}_{\delta , {\mathbb {N}}}(X) } {\mathcal {S}}_{\delta , {\mathbb {N}}}(X)\)

\(0.502915\ldots \)

\(0.501163\ldots \)

\(0.500086\ldots \)

\(0.500003\ldots \)

\(0.500027\ldots \)

If we restrict to \({\mathbb {N}}^{\flat } = \{ 8 d : d \text { odd, square-free}\}\) then we find the following data.

X

\(2\times 10^5\)

\(2 \times 10^6\)

\(2 \times 10^7\)

\(2 \times 10^8\)

\(2 \times 10^9\)

\({\mathcal {S}}_{\delta , {\mathbb {N}}^{\flat }}(X)\)

5049

50734

506589

5065686

50663938

\( \frac{1}{{\mathcal {N}}_{\delta , {\mathbb {N}}^{\flat }}(X) } {\mathcal {S}}_{\delta ,{\mathbb {N}}^{\flat }}(X)\)

\(0.498223\ldots \)

\(0.500740\ldots \)

\(0.499980\ldots \)

\(0.499963\ldots \)

\(0.500033\ldots \)

1.4 Main estimates

The main results follow from the following three propositions. The first two of the propositions allow us to control the size of \(c(\cdot )\) by introducing a mollifier \(M(\cdot ;\cdot )\) which is defined in Sect. 4.2. In our application the specific shape of the mollifier is crucial to the success of the method. We have constructed this mollifier to counteract the large values of

$$\begin{aligned} \exp \left( \sum _{p \le |d|^{\varepsilon }} \frac{\lambda _f(p)}{\sqrt{p}} \chi _d(p) \right) \end{aligned}$$

that contribute to the bulk of the moments of \(L(\tfrac{1}{2}, f\otimes \chi _d)\). Essentially, we are mollifying the L-function through an Euler product, as opposed to traditional methods which use a Dirichlet series. This approach was sparked by innovations in understanding of the moments of L-functions, such as the works of Soundararajan [30], Harper [6], and Radziwiłł -Soundararajan [26].

Proposition 1.1

Assume GRH. Let \(g \in S_{k+1/2}^+\) be a Hecke cusp form. Also, let \(M(\cdot ;\cdot )\) be as defined in Sect. 4.2. Then

$$\begin{aligned} \sum _{\begin{array}{c} n \le X \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)|^4 M\left( (-1)^k 8n; \tfrac{1}{2} \right) ^4 \ll X. \end{aligned}$$

Proposition 1.2

Let \(g \in S_{k+1/2}^+\) be a Hecke cusp form. Also, let \(M(\cdot ;\cdot )\) be as defined in Sect. 4.2. Then

$$\begin{aligned} \sum _{\begin{array}{c} n \le X \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)|^2 M\left( (-1)^k8 n; \tfrac{1}{2}\right) ^2 \asymp X. \end{aligned}$$

The other key ingredient of our results is an estimate for sums of Fourier coefficients summed against a short Dirichlet polynomial over short intervals. This is proved through estimates for shifted convolution sums of half-integral weight forms.

Proposition 1.3

Let g be a cusp form of weight \(k+\tfrac{1}{2}\) on \(\Gamma _0(4)\). Let \((\beta (n))_{n \ge 1}\) be complex coefficients such that \(|\beta (n)| \ll _{\varepsilon } n^{\frac{1}{2}+\varepsilon }\) for all \(\varepsilon > 0\). Let

$$\begin{aligned} M((-1)^k n) := \sum _{m \le M} \frac{\beta (m) \chi _{(-1)^k n}(m)}{\sqrt{m}} \end{aligned}$$

where \(\chi _{(-1)^k n}(m)\) denotes the Kronecker symbol. Uniformly for \(1 \le y, M \le X^{\frac{1}{1092}}\)

$$\begin{aligned}&\sum _{X \le x \le 2X} \left| \sum _{\begin{array}{c} x \le 8n \le x + y \\ 2n \text { is } \square \text {-free} \end{array}} c(8n) M((-1)^k 8 n) \right| \\&\quad \ll _{k} X \sqrt{y} \cdot \left( \frac{1}{X^{k + \frac{1}{2}}} \sum _{\begin{array}{c} 2n \text { is } \square \text {-free} \end{array}} |c(8 n) M((-1)^k 8 n)|^2 \cdot n^{k - \frac{1}{2}} e^{- \frac{4\pi n}{X}} \right) ^{1/2} + X^{1 - \frac{1}{2184} + \varepsilon }. \end{aligned}$$

In particular, Proposition 1.3 holds for \(M(\cdot )=M(\cdot ;\tfrac{1}{2})\) as defined in Sect. 4.2.

2 The proof of Theorem 1

The basic method of proof follows a straightforward approach. Observe that since \(M((-1)^k n; \tfrac{1}{2})>0\) (see the discussion before and after (4.18)), if

$$\begin{aligned} \left| \sum _{\begin{array}{c} x \le 8n \le x+y\\ 2n \text { is } \square \text {-free} \end{array}} c(8n) M((-1)^k 8n; \tfrac{1}{2}) \right| < \sum _{\begin{array}{c} x \le 8n \le x+y\\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)| M\left( (-1)^k 8n; \tfrac{1}{2}\right) \end{aligned}$$

then the sequence \(\{ \mu ^2(2n)c(8n) \}\) must have at least one sign change in the interval \([x, x+y]\). To analyze the sums above we use a direct approach, which was developed in [22], where sign changes of integral weight forms was studied. The main inputs are Propositions 1.1, 1.2 and 1.3.

Lemma 2.1

Let \(\Lambda \ge 1\). There exists \(\delta >0\) such that for \(2 \le y \le X^{\delta }\) we have for all but at most \(\ll X/\Lambda \) integers \(X \le x \le 2X\) that

$$\begin{aligned} \left| \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \end{array}} c(8n) M((-1)^k 8n; \tfrac{1}{2}) \right| \le \Lambda \sqrt{y}. \end{aligned}$$

Proof

This follows from Markov’s inequality combined with Propositions 1.2 and 1.3, which holds for \(M(\cdot )=M(\cdot ;\tfrac{1}{2})\).\(\square \)

Lemma 2.2

Assume GRH. Let \(2 \le y \le X/2\). Then for all sufficiently small \(\varepsilon >0\) there exists a subset of integers \(X\le x \le 2X\) which contains \( \gg \varepsilon X\) integers such that

$$\begin{aligned} \sum _{ \begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)|M\left( (-1)^k 8n; \tfrac{1}{2}\right) > \varepsilon y. \end{aligned}$$

Proof

For sake of brevity write \(C(n)=|c(8n)|M((-1)^k8 n; \tfrac{1}{2})\). By Hölder’s inequality

$$\begin{aligned} \sum _{ \begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \end{array} } C(n)^2 \le \left( \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} C(n) \right) ^{2/3} \left( \sum _{ \begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} C(n)^4 \right) ^{1/3}. \end{aligned}$$
(2.1)

Applying Proposition 1.2 it follows that the LHS is \(\gg X\). Applying Proposition 1.1 the second sum on the RHS is \(\ll X\). Hence, we conclude that

$$\begin{aligned} \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} C(n) \gg X. \end{aligned}$$

Also, by Proposition 1.2 we have

$$\begin{aligned} \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \\ C(n) > 1/\varepsilon \end{array}} C(n) < \varepsilon \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} C(n)^2 \ll \varepsilon X. \end{aligned}$$

So that for \(\varepsilon \) sufficiently small

$$\begin{aligned} \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \\ C(n) \le 1/\varepsilon \end{array}} C(n) \gg X. \end{aligned}$$
(2.2)

Let U denote the subset of integers \(X \le x \le 2X\) such that

$$\begin{aligned} \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \\ C(n) \le 1/ \varepsilon \end{array}} C(n) \le \varepsilon y . \end{aligned}$$

Using (2.2) we get that

$$\begin{aligned} X \ll \sum _{\begin{array}{c} X+y \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \\ C(n) \le 1/\varepsilon \end{array}} C(n) \le \frac{1}{y} \sum _{X \le x \le 2X} \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \\ C(n) \le 1/\varepsilon \end{array}} C(n) \end{aligned}$$
(2.3)

where to get the last inequality note that each C(n) which appears in the sum on the LHS is counted \(\lfloor y \rfloor +1\) times in the sums on the RHS. The RHS equals

$$\begin{aligned} \begin{aligned}&= \frac{1}{y} \left( \sum _{x \in U} +\sum _{ \begin{array}{c} X \le x \le 2X \\ x \notin U \end{array}} \right) \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \\ C(n) \le 1/\varepsilon \end{array}} C(n) \\&\ll \frac{1}{y} \cdot \left( (\varepsilon y) X + \frac{y}{\varepsilon } \cdot \sum _{ \begin{array}{c} X \le x \le 2X \\ x \notin U \end{array}} 1 \right) . \end{aligned} \end{aligned}$$

Since the first term above is of size \(\varepsilon X\) and using (2.3) we must have that the second term is \(\gg X\) since \(\varepsilon \) is sufficiently small. So \(\# \{ X \le x \le 2X : x \notin U\} \gg \varepsilon X\).\(\square \)

Proof of Theorem 1

In Lemma 2.1 take \(\Lambda =\frac{1}{\varepsilon ^2}, y=\frac{1}{\varepsilon ^6}\) so for except at most \(\ll \varepsilon ^2 X\) integers \(X \le x \le 2X\) we have that

$$\begin{aligned} \left| \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \end{array}} c(8n) M((-1)^k 8n; \tfrac{1}{2}) \right| \le \Lambda \sqrt{y} =\frac{1}{\varepsilon ^5}. \end{aligned}$$
(2.4)

In Lemma 2.2 take \( y=\frac{1}{\varepsilon ^6}\) so there are \(\gg \varepsilon X\) integers \(X \le x \le 2X\) such that

$$\begin{aligned} \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)| M\left( (-1)^k 8n; \tfrac{1}{2}\right) > \varepsilon y=\frac{1}{\varepsilon ^5}. \end{aligned}$$
(2.5)

Combining (2.4) and (2.5) we get that there are \(\gg \varepsilon X\) integers \(X \le x \le 2X\) such that

$$\begin{aligned} \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)| M\left( (-1)^k 8n; \tfrac{1}{2}\right) > \left| \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \end{array}} c(8n) M\left( (-1)^k 8n; \tfrac{1}{2}\right) \right| . \end{aligned}$$

Since \(M>0\) (see the discussion after (4.18)) this implies there exists at least \(\gg \varepsilon X\) integers \(X \le x \le 2X\) such that \([x,x+y]\) contains a sign change of the sequence \(\{\mu ^2(2n)c(8n)\}\). Since every sign change of \(\{\mu ^2(2n)c(8n)\}\) on [X, 2X] yields at most \(\lfloor y \rfloor +1\) intervals \([x,x+y]\) which contain a sign change it follows that there are at least \( \gg \varepsilon \frac{X}{y}=\varepsilon ^7 X\) sign changes in [X, 2X], which completes the proof of Theorem 1. \(\square \)

3 The proofs of Theorems 2 and 3

3.1 The proof of Theorem 2

Throughout we will need the following estimate.

Lemma 3.1

We have

$$\begin{aligned} \sum _{\begin{array}{c} X \le n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)|^2 \asymp X. \end{aligned}$$

Proof

This follows immediately by applying (1.1) along with Proposition 5.1 below with \(u=1\). \(\square \)

We are now ready to start the preparations for the proof of Theorem 2, which as it turns out is considerably easier to prove than Theorem 1.

Lemma 3.2

Let \(\Lambda \ge 1\). There exists \(\delta > 0\) such that for all \(2 \le y \le X^{\delta }\) we have for all but at most \(\ll X/\Lambda \) integers \(X \le x \le 2X\) that

$$\begin{aligned} \left| \sum _{\begin{array}{c} x \le 8n \le x + y \\ 2n \text { is } \square \text {-free} \end{array}} c(8n) \right| \le \Lambda \sqrt{y}. \end{aligned}$$

Proof

This follows from Markov’s inequality combined with Proposition 1.3 (with the choice \(\beta (1) = 1\) and \(\beta (m) = 0\) for all \(m \ge 2\)) and Lemma 3.1. \(\square \)

Lemma 3.3

Let \(\varepsilon >0\) and \(2 \le y \le X/2\). Then there exist \(\gg X^{1-\frac{3}{2} \varepsilon }\) integers \(X \le x \le 2X\) such that

$$\begin{aligned} \sum _{\begin{array}{c} x \le 8n \le x + y \\ 2n \text { is } \square \text {-free} \end{array}} |c(8 n)| > \frac{y}{X^{\varepsilon }}. \end{aligned}$$

Proof

Note that using (1.1) and Heath-Brown’s result [7, Theorem 2] we get that

$$\begin{aligned} \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)|^4 \ll X^{1+\varepsilon }. \end{aligned}$$

Hence, using the above estimate along with Lemma 3.1 we can apply Hölder’s inequality as in (2.1) to get

$$\begin{aligned} \sum _{\begin{array}{c} X \le n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)| \gg X^{1-\varepsilon /2}. \end{aligned}$$
(3.1)

Also, using Lemma 3.1 we have

$$\begin{aligned} \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \\ |c(8n)| > X^{\varepsilon } \end{array}} |c(8n)| < X^{-\varepsilon } \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)|^2 \ll X^{1-\varepsilon }. \end{aligned}$$

So combining this along with (3.1) we get

$$\begin{aligned} \sum _{\begin{array}{c} X \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \\ |c(8n)| \le X^{\varepsilon } \end{array}} |c(8n)| \gg X^{1-\varepsilon /2}. \end{aligned}$$
(3.2)

Let U denote the subset of integers \(X \le x \le 2X\) such that

$$\begin{aligned} \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \\ |c(8n)| \le X^{\varepsilon } \end{array}} |c(8n)| \le \frac{y}{X^{\varepsilon }} . \end{aligned}$$

Using (3.2) and arguing as in (2.3) we get that

$$\begin{aligned} \begin{aligned} X^{1-\varepsilon /2} \ll \sum _{\begin{array}{c} X+y \le 8n \le 2X \\ 2n \text { is } \square \text {-free} \\ |c(8n)| \le X^{\varepsilon } \end{array}} |c(8n)|&\le \frac{1}{y} \sum _{X \le x \le 2X} \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \\ |c(8n)| \le X^{\varepsilon } \end{array}} |c(8n)| \\&= \frac{1}{y} \left( \sum _{x \in U} +\sum _{ \begin{array}{c} X \le x \le 2X \\ x \notin U \end{array}} \right) \sum _{\begin{array}{c} x \le 8n \le x+y \\ 2n \text { is } \square \text {-free} \\ |c(8n)| \le X^{\varepsilon } \end{array}} |c(8n)| \\&\ll \frac{1}{y} \cdot \left( \frac{y}{X^{\varepsilon }} X + y X^{\varepsilon } \cdot \sum _{ \begin{array}{c} X \le x \le 2X \\ x \notin U \end{array}} 1 \right) . \end{aligned} \end{aligned}$$

Since the first term is of size \(X^{1-\varepsilon }\) we must have that the second term is \(\gg X^{1-\varepsilon /2}\) so that \(\# \{ X \le x \le 2X : x \notin U\} \gg X^{1-\frac{3}{2} \varepsilon }\). \(\square \)

We are now ready to prove Theorem 2.

Proof of Theorem 2

Let \(y = X^{6 \varepsilon }\) and \(\Lambda =\frac{y^{1/2}}{X^{\varepsilon }}\). By Lemma 3.2 we have

$$\begin{aligned} \left| \sum _{\begin{array}{c} x \le 8n \le x + y \\ 2n \text { is } \square \text {-free} \end{array}} c(8 n) \right| \le \frac{y}{X^{\varepsilon }} \end{aligned}$$

for all \(X \le x \le 2X\) with at most \(X^{1+\varepsilon } y^{-1/2} = X^{1 - 2 \varepsilon }\) exceptions. On the other hand, by Lemma 3.3 we have

$$\begin{aligned} \sum _{\begin{array}{c} x \le 8n \le x + y \\ 2n \text { is } \square \text {-free} \end{array}} |c(8 n)| > \frac{y}{X^{\varepsilon }} \end{aligned}$$

on a subset of cardinality at least \(X^{1 - 3\varepsilon /2}\). Therefore the two subsets intersect on at least \(\gg X^{1 - 3 \varepsilon /2}\) values of x, and therefore give rise to at least \(X^{1 - 15 \varepsilon /2}\) sign changes in [X, 2X]. \(\square \)

3.2 The proof of Theorem 3

The proof of Theorem 3 is completely elementary and does not depend on any of the other techniques developed here.

Proof of Theorem 3

Let \(g \in S_{k+1/2}^+\) be a Hecke cusp form and f denote the weight 2k Hecke cusp form of level 1 that corresponds to g. For d a fundamental discriminant with \((-1)^k d>0\)

$$\begin{aligned} c(n^2|d|)=c(|d|) \sum _{r|n} \frac{\mu (r) \chi _d(r) }{\sqrt{r}}\lambda _f\left( \frac{n}{r}\right) , \end{aligned}$$
(3.3)

where \(\lambda _f(n)\) denotes the nth Hecke eigenvalue of f (see [18, Eqn (2)]). In particular if p is prime this becomes

$$\begin{aligned} c(|d|p^2)=c(|d|)\left( \lambda _f(p)-\frac{\chi _d(p) }{\sqrt{p}}\right) . \end{aligned}$$

Since there exists p which depends at most on k such thatFootnote 6\(\lambda _f(p) < -2/\sqrt{p}\) it follows that if \(c(|d|) \ne 0\) then c(|d|) and \(c(|d|p^2)\) have opposite signs. By Ono and Skinner’s result there are \(\gg X/(p^2 \log (X/p^2)) \gg X/\log X\) fundamental discriminants \(|d| \le X/p^2\) such that \(c(|d|) \ne 0\). So by considering the signs of the Fourier coefficients c(n) at \(n=|d| \le X/p^2\) with \(c(|d|) \ne 0\) and at \(m=|d|p^2 \le X\) we arrive at the claimed result. \(\square \)

4 Upper bounds for mollified moments

Let f be a level 1, Hecke cusp form of weight 2k. The aim of this section is to compute an upper bound for mollified moments of \(L(\tfrac{1}{2},f \otimes \chi _d)\), conditionally under GRH. This gives an upper bound for the mean square of the mollified Fourier coefficients of \(g \in S_{k+1/2}^+\).

The second moment \(L(\tfrac{1}{2}, f \otimes \chi _d)\) has been asymptotically computed assuming GRH by Soundararajan and Young [31]. However, a direct adaptation of their method cannot handle the introduction of a mollifier of length \(\gg |d|^{\varepsilon }\). For this reason we use a different approach, which uses the refinement of Soundararajan’s [30] method for upper bounds on moments due to Harper [6] as well as the construction of an appropriate mollifier, which is based on an iterative construction and roughly has the structure of an Euler product. A similar mollifier and iterative approach was developed by Soundararajan and Radziwiłł [26].

The main result is

Proposition 4.1

Assume GRH. Let \(l, \kappa >0\) such that \(l \cdot \kappa \in {\mathbb {N}}\) and \( \kappa \cdot l \le C\). Also, let \(M(\cdot ;\tfrac{1}{\kappa })=M(\cdot ;\tfrac{1}{\kappa },x,C)\) be as in Sect. 4.2. Then

where the sum is over fundamental discriminants and the implied constant depends on \(f,l,\kappa \).

Note that by Waldspurger’s formula (see (1.1)), we know \(L(\tfrac{1}{2}, f \otimes \chi _d) \ge 0\), so that \(L(\tfrac{1}{2}, f \otimes \chi _d)^l\) is unambiguous.

Using the proposition above we can easily deduce Proposition 1.1.

Proof of Proposition 1.1

] Using (1.1) it follows that

where the sum is over all fundamental discriminants. \(\square \)

4.1 Preliminary results

In this section we introduce our mollifier for the Fourier coefficients of g at fundamental discriminants. The shape of the mollifier is motivated by Harper’s refinement [6] of Soundararajan’s [30] bounds for moments.

Notation. Let \(\lambda (n)=(-1)^{\Omega (n)}\) denote the Liouville function (which should not be confused with \(\lambda _f(n)\)). Denote by \(\nu (n)\) the multiplicative function with \(\nu (p^a)=\frac{1}{a!}\) and write \(\nu _{j}(n)=(\nu *\cdots *\nu )(n)\) for the j-fold convolution of \( \nu \). A useful observation is that

$$\begin{aligned} \nu _j(p^a)=\frac{j^a}{a!}, \end{aligned}$$
(4.1)

which may be proved by induction or otherwise. Also for an interval I, \(m \in {\mathbb {Z}}\) and \(a(\cdot )\) a real-valued completely multiplicative function let

$$\begin{aligned} P_{I}(m; a( \cdot ) )=\sum _{\begin{array}{c} p \in I \end{array}} \frac{a(p)}{\sqrt{p}} \left( \frac{m}{p}\right) . \end{aligned}$$

Also, given a statement S we let \(1_S\) equal one if S is true and zero otherwise.

An L-function inequality. We now prove an inequality in the spirit of Harper’s work on sharp upper bounds for moments of L-functions, in the context of quadratic twists of L-functions attached to Hecke cusp forms. The upshot of the inequality is it essentially allows us to almost always bound the L-function by a very short Dirichlet polynomial.

Let us now introduce the following notation, which will be used throughout this section. Let \(l, \kappa >0\) be such that \(l \cdot \kappa \in {\mathbb {N}}\) and suppose that \(1 \le l \cdot \kappa \le C\). Also, let \(\eta _1, \eta _2>0\) be sufficiently small in terms of C. For \(j=0, \ldots , J\) let

$$\begin{aligned} \theta _j= \eta _1 \frac{e^j}{(\log \log x)^{5}} \qquad \text{ and } \qquad \ell _j=2 \lfloor \theta _j^{-3/4} \rfloor , \end{aligned}$$
(4.2)

where J is chosen so that \( \eta _2 \le \theta _J \le e \eta _2 \) (so \(J \asymp \log \log \log x\)). For \(j=1, \ldots , J\) let \(I_j=(x^{\theta _{j-1}}, x^{\theta _j}]\) and set \(I_0=(c, x^{\theta _0}]\), where \(c \ge 2\) is sufficiently large in terms of \(\kappa \) and C. Note that the choice of parameters \(\theta _{j}, \ell _j\) depends on C and is independent of \(l, \kappa \) satisfying \(1 \le l \cdot \kappa \le C\).

For \(j=0, \ldots , J\) and \(t>0\) let

$$\begin{aligned} w(t;j)=\frac{1}{t^{1/(\theta _j \log x)}} \left( 1-\frac{\log t}{\theta _j \log x} \right) \end{aligned}$$

and define the completely multiplicative function \(a(\cdot ; j)\) by

$$\begin{aligned} a(p;j)=\lambda _f(p) w(p;j), \end{aligned}$$
(4.3)

and note \(|a(p;j)| \le 2\). The smooth weights \(w(\cdot ; j)\) appear for technical reasons and their effect is mild.

Let \(\ell \) be an positive even integer. For \(t \in {\mathbb {R}}\), let

$$\begin{aligned} E_{\ell }(t)=\sum _{s \le \ell } \frac{t^s}{s!}. \end{aligned}$$

Note \(E_{\ell }(t) \ge 1\) if \(t \ge 0\) and \(E_{\ell }(t)>0\) for any \(t \in {\mathbb {R}}\) since \(\ell \) is even; the latter inequality may be seen using the Taylor expansion for \(e^t\). Moreover, using the Taylor expansion it follows for \(t \le \ell /e^2\) that

$$\begin{aligned} e^t \le (1+e^{-\ell })E_{\ell }(t) \end{aligned}$$
(4.4)

(see [26, Lemma 1]).

For each \(j=0,\ldots , J\) let

$$\begin{aligned} D_j(m;l)=\prod _{r=0}^j (1+e^{-\ell _j}) E_{\ell _r}(lP_{I_r}(m;a( \cdot ;j))) \end{aligned}$$
(4.5)

and note \(D_j(m;l)>0\), since each term in the product is \(>0\). A useful observation is that for a positive integer s

$$\begin{aligned} \begin{aligned} P_I(m; a(\cdot ))^s&=\sum _{p_1, \ldots , p_s \in I} \frac{a(p_1 \cdots p_s)}{\sqrt{p_1 \cdots p_s}} \left( \frac{m}{p_1 \cdots p_s}\right) \\&=\sum _{\begin{array}{c} p|n \Rightarrow p \in I \\ \Omega (n)=s \end{array}} \frac{a(n)}{\sqrt{n}} \left( \frac{m}{n} \right) \sum _{p_1\cdots p_s=n} 1 \\&= s! \sum _{\begin{array}{c} p|n \Rightarrow p \in I \\ \Omega (n)=s \end{array}} \frac{a(n)}{\sqrt{n}} \left( \frac{m}{n} \right) \nu (n). \end{aligned} \end{aligned}$$
(4.6)

Additionally, for any real number \(l \ne 0\)

$$\begin{aligned} \begin{aligned} E_{\ell }(l P_{I}(m; a( \cdot )))&=\sum _{s \le \ell } \frac{l^s}{s!} P_{I}(m)^s\\&=\sum _{\begin{array}{c} p|n \Rightarrow p \in I \\ \Omega (n) \le \ell \end{array}} \frac{ l^{\Omega (n)} a(n) \nu (n)}{\sqrt{n}} \left( \frac{m}{n} \right) . \end{aligned} \end{aligned}$$
(4.7)

We are now ready to state our main inequality for \(L(\tfrac{1}{2},f\otimes \chi _d)\).

Proposition 4.2

Assume GRH. Suppose that \( 1 \le |d| \le x\) is a fundamental discriminant and \(l>0\) is a real number. Also let

$$\begin{aligned} A(d)=A(d;f)=\prod _{\begin{array}{c} p|d \\ p>3 \end{array}}\left( 1+ \frac{\lambda _f(p^2)-1}{p}\right) . \end{aligned}$$

Let \(\ell _j,\theta _j, I_j\) and \(a(\cdot ,j)\) be as in (4.2) and (4.3) (resp.). Then there exists a sufficiently large real number \(C_1=C_1(l)>0\) such that for each \(|d| \le x\) either:

$$\begin{aligned} |P_{I_{0}}(d;a(\cdot , j))| \ge \frac{ \ell _0}{l e^2} \end{aligned}$$
(4.8)

for some \(0 \le j \le J\) or

$$\begin{aligned} \begin{aligned}&\left( A(d) \log x \right) ^{l/2} L(\tfrac{1}{2}, f\otimes \chi _d)^l \\&\quad \ll D_J(d;l)+ \sum _{\begin{array}{c} 0 \le j \le J-1 \\ j+1 \le u \le J \end{array}} \left( \frac{1}{\theta _{j}}\right) ^{C_1} \exp \left( {\frac{3l}{\theta _{j}}} \right) D_{j}(d;l)\\&\qquad \times \left( \frac{ e^2 l P_{I_{j+1}}(d; a( \cdot , u))}{ \ell _{j+1}}\right) ^{ s_{j+1}} , \end{aligned} \end{aligned}$$
(4.9)

for any even integers \(s_1,\ldots ,s_{J}\), where the implied constant depends on f and l.

Proof

Applying Theorem 2.1 of Chandee [4] gives, for any \(X \ge 10\), that

$$\begin{aligned} L\left( \tfrac{1}{2}, f \otimes \chi _d\right) \le \exp \left( \sum _{p^n \le X} \frac{\chi _d(p^n) (\alpha _p^n +\beta _p^n)}{n p^{n(\frac{1}{2} +\frac{1}{\log X})}} \frac{\log X/p^n}{\log X}+3 \cdot \frac{\log |d|}{\log X}+O(1) \right) ,\nonumber \\ \end{aligned}$$
(4.10)

where \(\alpha _p,\beta _p\) are the Satake parameters (note \(\alpha _p^n+\beta _p^n\) is real-valued see [21, Remark 2]). In the sum over primes, the contribution from the prime powers with \(n \ge 3\) is bounded so that it may be included in the O(1) term. Also, noting that \(\alpha _p^2+\beta _p^2=\lambda _f(p^2)-1\) the squares of primes contribute

$$\begin{aligned} \frac{1}{2} \cdot \sum _{\begin{array}{c} p \le X \\ p \not \mid d \end{array}} \frac{(\lambda _f(p^2)-1)}{p^{1+\frac{2}{\log X}}} \frac{\log X/p^2}{\log X}=-\frac{1}{2}\log \log X-\sum _{\begin{array}{c} p \le X \\ p|d \end{array}} \frac{(\lambda _f(p^2)-1)}{2p}+O\left( 1\right) \nonumber \\ \end{aligned}$$
(4.11)

where the implied constant depends on f.

For \(r=0, \ldots , J\), let \({\mathcal {E}}_r\) be the set of fundamental discriminants d such that \(\max _{r \le u \le J} |P_{I_r}(d;a(\cdot ; u))| < \frac{ \ell _r}{ l e^2}\). For each d we must have one of the following: (i) \(d \notin {\mathcal {E}}_0\); (ii) \(d \in {\mathcal {E}}_r\) for each \(0 \le r \le J\); (iii) there exists \(0 \le j \le J-1\) such that \(d \in {\mathcal {E}}_r\) for \(0 \le r \le j\) and \(d \notin {\mathcal {E}}_{j+1}\). Hence, we get for each fundamental discriminant with \(|d| \le x\) either:

$$\begin{aligned} \max _{0 \le u \le J} |P_{I_0}(d;a(\cdot ; u))|\ge & {} \frac{ \ell _0}{ l e^2}; \end{aligned}$$
(4.12)
$$\begin{aligned} \max _{j \le u \le J} |P_{I_j}(d;a(\cdot ; u))|< & {} \frac{ \ell _j}{ l e^2} \qquad \text { for each } \qquad j =0, \ldots , J; \end{aligned}$$
(4.13)

or for some \(j=0, \ldots , J-1\)

$$\begin{aligned} \max _{r \le u \le J} |P_{I_r}(d;a(\cdot ; u))| < \frac{ \ell _r}{l e^2} \qquad \text {for each} \qquad r \le j \end{aligned}$$
(4.14)

and

$$\begin{aligned} \max _{j+1 \le u \le J} |P_{I_{j+1}}(d;a(\cdot ; u))| \ge \frac{ \ell _{j+1}}{ l e^2}. \end{aligned}$$
(4.15)

Here (4.12), (4.13) correspond to possibilities (i) and (ii) above (resp.), while (4.14) and (4.15) corresponds to (iii).

If (4.12) holds for d then we are done. If (4.13) holds, we apply (4.10) with \(X=x^{\theta _J}\) and so the term \(3 \cdot \frac{\log |d|}{\log X}\) is \(\ll 1\). Also, the contribution from (4.11) is

$$\begin{aligned} -\tfrac{1}{2}\log \log x-\sum _{\begin{array}{c} p \le X\\ p|d \end{array}} \frac{(\lambda _f(p^2)-1)}{2p}+O(1). \end{aligned}$$

Hence, applying these estimates along with (4.4) we get that

$$\begin{aligned} \begin{aligned} \left( A(d) \log x \right) ^{l/2} L(\tfrac{1}{2}, f\otimes \chi _d)^l&\ll \exp \left( l \sum _{p \le x^{\theta _J}} \frac{a(p;J)}{\sqrt{p}} \chi _d(p)\right) \\&\ll \prod _{j=0}^{J} \exp \left( l P_{I_j}(d;a(\cdot ;J)) \right) \\&\le \prod _{j=0}^J (1+e^{-\ell _j}) E_{\ell _j}(lP_{I_j}(m;a( \cdot ;J))) = D_J(d;l).\\ \end{aligned} \end{aligned}$$
(4.16)

Finally, if (4.14) and (4.15) hold we apply (4.10) with \(X=x^{\theta _j}\) and for each \(0 \le r \le j\) we argue as above and bound the term \(\exp (lP_{I_r}(d; a(\cdot ; j)))\) by \((1+e^{-\ell _r})E_{\ell _j}(lP_{I_r}(d;a(\cdot , j)))\). In (4.10) we use the inequality \(3 \cdot \frac{\log |d|}{\log X}\le \frac{3}{\theta _j}\) and note that the contribution from the squares of primes (4.11) is

$$\begin{aligned} -\tfrac{1}{2}\log \log x-\sum _{\begin{array}{c} p|d \end{array}} \frac{(\lambda _f(p^2)-1)}{2p}+O\left( \log \frac{1}{\theta _j}\right) . \end{aligned}$$

So that applying these estimates, we get that for any non-negative, even integer \(s_{j+1}\)

$$\begin{aligned} \begin{aligned}&\left( A(d) \log x \right) ^{l/2} L(\tfrac{1}{2}, f\otimes \chi _d)^l \\&\qquad \ll \left( \frac{1}{\theta _{j}}\right) ^{C_1} \exp (3l/\theta _{j}) D_{j}(d;l) \max _{j+1 \le u \le J}\left( \frac{ e^2 l P_{I_{j+1}}(d; a( \cdot , u))}{ \ell _{j+1}}\right) ^{ s_{j+1}} , \end{aligned} \end{aligned}$$
(4.17)

where we have included the extra factor

$$\begin{aligned} \max _{j+1 \le u \le J}\left( \frac{ e^2 l P_{I_{j+1}}(d; a( \cdot , u))}{ \ell _{j+1}}\right) ^{ s_{j+1}} \ge 1. \end{aligned}$$

Combining (4.16) and (4.17) and using the inequality \(\max (a,b) \le a+b\) for \(a,b \ge 0\) gives (4.9). \(\square \)

4.2 The definition of the mollifier

With Proposition 4.2 in mind we now choose our mollifier so that it will counteract the large values of \(D_J(d;l)\). For \(j=0, \ldots , J\) let

$$\begin{aligned} M_j(m;\tfrac{1}{\kappa })=\sum _{\begin{array}{c} p|n \Rightarrow p \in I_j \\ \Omega (n) \le \ell _j \end{array}} \frac{\kappa ^{-\Omega (n)} a(n;J) \lambda (n)}{\sqrt{n}} \nu (n) \left( \frac{m}{n}\right) , \end{aligned}$$

where \(\ell _j,\theta _j\) and \(I_j\) are as in (4.2). Let

$$\begin{aligned} M(m; \tfrac{1}{\kappa }) = (\log x)^{1/(2\kappa )}\prod _{0\le j \le J} M_j\left( m;\tfrac{1}{\kappa }\right) . \end{aligned}$$
(4.18)

A useful observation is that \(M(m;\tfrac{1}{\kappa })>0\), which can be seen by using (4.7) along with the fact that \(E_{\ell }(t)>0\) for even \(\ell \) and \(t\in {\mathbb {R}}\). Also, let \(\delta _0=\sum _{j \le J } \ell _j \theta _j\). Observe that by construction \(\delta _0 \asymp 1\) is sufficiently small and the length of the Dirichlet polynomial \(M(m;\frac{1}{\kappa })\) is \(x^{\delta _0}\). Also,

$$\begin{aligned} M(m;\tfrac{1}{\kappa })^{l \cdot \kappa }=(\log x)^{l/2} \sum _{n \le x^{l \cdot \kappa \delta _0}} \frac{h(n) a(n;J) \lambda (n)}{\kappa ^{\Omega (n) } \sqrt{n}} \left( \frac{m}{n}\right) \end{aligned}$$
(4.19)

where

$$\begin{aligned} h(n)=\sum _{\begin{array}{c} n_0 \cdots n_J=n \\ p|n_0 \Rightarrow p \in I_0, \ldots , p|n_J \Rightarrow p \in I_J \\ \Omega (n_0) \le l \cdot \kappa \ell _0,\ldots , \Omega (n_J) \le l \cdot \kappa \ell _J \end{array}} \nu _{l \cdot \kappa }(n_0; \ell _0) \cdots \nu _{l \cdot \kappa }(n_J; \ell _J). \end{aligned}$$
(4.20)

and for \(n,r, \ell \in {\mathbb {N}}\)

$$\begin{aligned} \nu _{r}(n;\ell )= \sum _{\begin{array}{c} n_1 \cdots n_r= n \\ \Omega (n_1) \le \ell , \ldots , \Omega (n_r) \le \ell \end{array}} \nu (n_1) \cdots \nu (n_r). \end{aligned}$$
(4.21)

Note that \(\nu _r(n;\ell ) \le \nu _r(n)\) and if \(\Omega (n) \le \ell \) then \(\nu _r(n;\ell )=\nu _r(n)\). Also,

$$\begin{aligned} M(m;\tfrac{1}{\kappa })^{l \cdot \kappa } \ll x^{(l \cdot \kappa ) \delta _0} (\log x)^{l/2}, \end{aligned}$$
(4.22)

where the implied constant depends on \(\kappa \) (note that \(\sum _{n \le y} \kappa ^{-\Omega (n)} \ll y( \log y)^{\frac{1}{\kappa }-1}\) where the implied constant depends on \(\kappa \), for any \(y \ge 3\).)

4.3 The proof of Proposition 4.1

We first require the following fairly standard lemma, which follows from Poisson summation.

Lemma 4.1

Let F be a Schwartz function such that its Fourier transform \({{\widehat{F}}}\) has compact support in \((-A,A)\), for some fixed \(A>0\). Also, let \(I_0,\ldots , I_J \subset [1,x]\) be disjoint intervals of the form \(I_0=(c, x^{\theta _0}]\), \(I_j=(x^{\theta _{j-1}}, x^{\theta _j}]\) where \(\theta _0,\ldots , \theta _J \in {\mathbb {R}}\) and \(c \ge 1\) is fixed. Suppose \(\ell _0, \ldots , \ell _J\ge 1\) are real numbers such that \(\sum _{j=0}^J \ell _j \theta _j <1/2\). Then for any arithmetic function g we have

$$\begin{aligned} \sum _{m \in {\mathbb {Z}}} \prod _{0 \le j \le J} \sum _{ \begin{array}{c} p| n \Rightarrow p \in I_j \\ \Omega (n) \le \ell _j \end{array} } \frac{g(n) \left( \frac{m}{n}\right) }{\sqrt{n}} F\left( \frac{m}{x}\right) ={{\widehat{F}}}(0) x \prod _{0 \le j \le J} \sum _{\begin{array}{c} p| n \Rightarrow p \in I_j \\ \Omega (n^2) \le \ell _j \end{array} } \frac{g(n^2)}{n} \frac{\varphi (n^2)}{n^2}.\nonumber \\ \end{aligned}$$
(4.23)

Proof

The LHS of (4.23) equals

$$\begin{aligned} \sum _{ \begin{array}{c} n_0, \ldots , n_J \in {\mathbb {N}}\\ p | n_0 \Rightarrow p \in I_0, \ldots , p|n_J \Rightarrow p \in I_j\\ \Omega (n_0) \le \ell _0, \ldots , \Omega (n_J) \le \ell _J \end{array}} \frac{g(n_0) \cdots g(n_J)}{\sqrt{n_0 \cdots n_J}} \sum _m \left( \frac{m}{n_0 \cdots n_J} \right) F\left( \frac{m}{x} \right) . \end{aligned}$$
(4.24)

Using Poisson summation, see Remark 1 of [21], we get that for \(n \le X^{1/2}\) if \(n=\square \) that

$$\begin{aligned} \sum _{m} \left( \frac{m}{n} \right) F\left( \frac{m}{x} \right) = {{\widehat{F}}}(0) x \frac{\varphi (n)}{n} \end{aligned}$$

and for \(n \ne \square \) the above sum equals zero. By assumption \(n_0 \cdots n_J \le x^{\ell _0 \theta _0} \cdots x^{\ell _J \theta _J} < x^{1/2}\). Hence, the inner sum in (4.24) equals zero unless \(n_0 \cdots n_J =\square \) and since \((n_j,n_i)=1\) for \(i \ne j\) in this case \(n_0, \ldots , n_J =\square \). We conclude that the inner sum in (4.24) equals

$$\begin{aligned} {{\widehat{F}}}(0) x \frac{\varphi (n_0 \cdots n_J)}{n_0 \cdots n_J}={{\widehat{F}}}(0) x \frac{\varphi (n_0) \cdots \varphi (n_J)}{n_0 \cdots n_J} \end{aligned}$$

when \(n_0, \ldots , n_J=\square \) and is zero otherwise, thereby giving the claim. \(\square \)

To prove Proposition 4.1 we will use Proposition 4.2 and then apply Lemma 4.1. This leaves us with the problem of bounding the resulting sum. This task will be accomplished in the next two lemmas.

Lemma 4.2

Let \(a(\cdot ),b(\cdot )\) be real-valued, completely multiplicative functions with \(|a(p)|,|b(p)| \le 2\). Then for each \(j=0, \ldots , J\)

$$\begin{aligned} \begin{aligned}&\sum _{\begin{array}{c} mn=\square \\ p|mn \Rightarrow p \in I_j \\ \Omega (m) \le (l \cdot \kappa ) \ell _j, \Omega (n) \le \ell _j \end{array}} \frac{l^{\Omega (n)} a(m)b(n) \lambda (m)}{\kappa ^{\Omega (m)} \sqrt{mn}} \nu _{l \cdot \kappa }(m; \ell _j) \nu (n) \frac{\varphi (mn)}{mn} \\&\qquad = \left( 1+O\left( \frac{1_{j=0} \cdot (\log x)^{O(1)}+1}{2^{\ell _j}} \right) \right) \prod _{\begin{array}{c} p \in I_j \end{array}} \left( 1+l^2\frac{\alpha (p)}{2p}+O\left( \frac{1}{p^2}\right) \right) , \end{aligned} \end{aligned}$$
(4.25)

where

$$\begin{aligned} \alpha (p)=\alpha (p;a(\cdot ),b(\cdot ))= (a(p)-b(p))^2, \end{aligned}$$
(4.26)

and the implied constants depend on \(\kappa \) and l.

Remark 1

Later we will take \(a(\cdot )=a(\cdot ;J)\) and \(b=a(\cdot ;j)\) with \(j < J\) (see (4.3)). Observe that

$$\begin{aligned} \begin{aligned} \sum _{p \le x^{\theta _j}} \frac{\alpha (p)}{p}=\sum _{p \le x^{\theta _j}} \frac{\lambda _f(p)^2}{p}\left( w(p;J)-w(p;j)\right) ^2 \ll \sum _{p \le x^{\theta _j}} \frac{1}{p} \cdot \frac{\log p}{\theta _j \log x}\ll 1. \end{aligned}\nonumber \\ \end{aligned}$$
(4.27)

Proof

In the sum over mn on the LHS of (4.25) write \(mn=r^2\) and let

$$\begin{aligned} f_1(m)=\frac{a(m)\lambda (m)\nu _{l \cdot \kappa }(m)}{\kappa ^{\Omega (m)}} \quad \text { and } \quad f_2(n)=l^{\Omega (n)}b(n) \nu (n). \end{aligned}$$

We will proceed by estimating the sum on the LHS of (4.25) in terms of an Euler product. To this end, observe that if \(\max \{\Omega (n),\Omega (m)\} \ge \ell _j\) then \(2^{\Omega (m)+\Omega (n)}/2^{\ell _j} \ge 1\); so using this along with the remarks following (4.21) the sum on the LHS of (4.25) equals

$$\begin{aligned} \begin{aligned} \sum _{\begin{array}{c} p|r \Rightarrow p \in I_j \end{array}} \frac{1}{r} (f_1 *f_2)(r^2) \frac{\varphi (r^2)}{r^2} +O\left( \frac{1}{2^{\ell _j}} \sum _{\begin{array}{c} p|r \Rightarrow p \in I_j \end{array}} \frac{(|f_1| *|f_2|)(r^2)}{r} \right) . \end{aligned} \end{aligned}$$
(4.28)

The error term in (4.28) is

$$\begin{aligned} \ll \frac{1}{2^{\ell _j}} \prod _{p \in I_j} \left( 1+O\left( \frac{1}{p} \right) \right) \asymp {\left\{ \begin{array}{ll} \frac{1}{2^{\ell _j}} \left( \frac{\theta _{j}}{\theta _{j-1}}\right) ^{O(1)} \asymp \frac{1}{2^{\ell _j}} &{}\quad \text { if } j \ne 0,\\ \frac{(\log x)^{O(1)}}{2^{\ell _0}} &{}\quad \text { if } j = 0. \end{array}\right. } \end{aligned}$$
(4.29)

Recalling (4.1), the main term in (4.28) is

$$\begin{aligned} = \prod _{p \in I_j} \left( 1- \frac{l^2a(p)b(p)}{p}+ \frac{l^2 a(p)^2}{2p}+\frac{l^2b(p)^2}{2p}+O\left( \frac{1}{p^2}\right) \right) . \end{aligned}$$

\(\square \)

Lemma 4.3

Let \(a(\cdot ), b(\cdot )\) be real-valued, completely multiplicative functions with \(a(p), b(p) \ll 1\). Then for each \(j=0, \ldots , J\) and any even integer \(s \ge 4(l \cdot \kappa ) \ell _j\)

$$\begin{aligned} \begin{aligned}&\left| \sum _{\begin{array}{c} mn=\square \\ p|mn \Rightarrow p \in I_{j} \\ \Omega (m) \le (l \cdot \kappa )\ell _j, \Omega (n)=s \end{array}} \frac{a(m)b(n) \lambda (m)}{\kappa ^{\Omega (m)} \sqrt{mn}} \nu _{\kappa \cdot l}(m; \ell _j) \nu (n) \frac{\varphi (mn)}{mn} \right| \\&\quad \ll \frac{1_{j=0} \cdot (\log x)^{O(1)}+1}{2^{s/2} \lfloor \frac{3}{8}s \rfloor !} \left( 1+\sum _{p \in I_j} \frac{b(p)^2}{p} \right) ^{s/2}, \end{aligned} \end{aligned}$$
(4.30)

where the implied constant depends on \(\kappa \) and l.

Proof

In the sum on the LHS of (4.30) write \(m=gm_1\), \(n=gn_1\) where \(g=(m,n)\), so that \(mn =\square \) implies that \(m_1=\square \) and \(n_1=\square \). Also recall that \(\nu _{\kappa \cdot l}(m;\ell _j) \le \nu _{\kappa \cdot l}(m)\). Hence, this sum is

$$\begin{aligned} \ll \sum _{\begin{array}{c} p|gmn \Rightarrow p \in I_j \\ \Omega (g) \le (l \cdot \kappa )\ell _j, \Omega (gn^2)=s \end{array}} \frac{|a(g)b(g)| a(m)^2 b(n)^2}{ \kappa ^{2\Omega (m)+\Omega (g)}gmn} \nu _{l \cdot \kappa }(g) \nu _{l \cdot \kappa }(m^2) \nu (n^2), \end{aligned}$$
(4.31)

where we have also used the estimates \(\nu _r(ab) \le \nu _r(a)\nu _r(b)\) and \(\nu (a) \le 1\), for \(a,b, r \in {\mathbb {N}}\), which follow from (4.1). The sum over m is

$$\begin{aligned} \ll \sum _{p|m \Rightarrow p \in I_j} \frac{a(m)^2 \nu _{l \cdot \kappa }(m^2)}{\kappa ^{2\Omega (m) }m}&\ll \prod _{p \in I_j} \left( 1+ \frac{(l \cdot \kappa )^2}{2} \cdot \frac{a(p)^2}{\kappa ^2 p} \right) \nonumber \\&\ll {\left\{ \begin{array}{ll} \left( \frac{\theta _{j}}{\theta _{j-1}}\right) ^{O(1)} \asymp 1 &{}\quad \text { if } j \ne 0,\\ (\log x)^{O(1)} &{}\quad \text { if } j = 0. \end{array}\right. } \end{aligned}$$
(4.32)

Hence, using (4.32) along with the inequality \(\nu (n^2) \le \nu (n) 2^{-\Omega (n)}\) it follows that (4.31) is

$$\begin{aligned} \begin{aligned}&\ll (1_{j=0} (\log x)^{O(1)} +1) \sum _{\begin{array}{c} p|g \Rightarrow p \in I_j \\ \Omega (g) \le (l \cdot \kappa )\ell _j \end{array}} \frac{|a(g)b(g)|}{\kappa ^{\Omega (g)} g} \nu _{l \cdot \kappa }(g) \sum _{\begin{array}{c} p|n \Rightarrow p \in I_j \\ \Omega (n)=(s-\Omega (g))/2 \end{array}} \frac{b(n)^2}{2^{\Omega (n)}n} \nu (n)\\&= (1_{j=0} (\log x)^{O(1)} +1) \sum _{\begin{array}{c} p|g \Rightarrow p \in I_j \\ \Omega (g) \le (l \cdot \kappa ) \ell _j \\ 2| \Omega (g) \end{array}} \frac{|a(g)b(g)|}{\kappa ^{\Omega (g)} g} \nu _{l \cdot \kappa }(g) \left[ \frac{1}{((s-\Omega (g))/2)!}\right. \\&\quad \times \left. \left( \frac{1}{2} \sum _{p \in I_j} \frac{b(p)^2}{p}\right) ^{(s-\Omega (g))/2}\right] , \end{aligned} \end{aligned}$$
(4.33)

by (4.6). Using the assumption that \(s \ge 4(l \cdot \kappa ) \ell _j\) gives \(s-\Omega (g) \ge \frac{3}{4}s\) for g with \(\Omega (g) \le (l \cdot \kappa ) \ell _j\). This allows us to bound the bracketed term on the RHS of (4.33) by

$$\begin{aligned} 2^{\Omega (g)/2} \cdot \frac{1}{2^{s/2} \lfloor \frac{3}{8}s \rfloor !} \left( 1+\sum _{p \in I_j} \frac{b(p)^2}{p} \right) ^{s/2}. \end{aligned}$$

Applying this estimate in (4.33) it follows that the RHS of (4.33) is bounded by

$$\begin{aligned} \begin{aligned}&\ll \frac{(1_{j=0} (\log x)^{O(1)} +1)}{2^{s/2} \lfloor \frac{3}{8}s \rfloor !} \left( 1+\sum _{p \in I_j} \frac{b(p)^2}{p} \right) ^{s/2} \sum _{\begin{array}{c} p|g \Rightarrow p \in I_j \end{array}} \frac{(4 l)^{\Omega (g)}}{g}\\&\ll \frac{(1_{j=0} (\log x)^{O(1)} +1)}{2^{s/2} \lfloor \frac{3}{8}s \rfloor !} \left( 1+\sum _{p \in I_j} \frac{b(p)^2}{p} \right) ^{s/2}. \end{aligned} \end{aligned}$$

\(\square \)

In the next lemma we estimate averages of our mollifier M as defined in Sect. 4.2 against the terms which appear in Proposition 4.2.

Lemma 4.4

For \(j=0,\ldots , J\) let \(s_{j}\) be an even integer with \(4(l\cdot \kappa ) \ell _j \le s_j \le \frac{2}{5\theta _j}\). Then we have the following estimates:

(4.34)
(4.35)
(4.36)

for each \(j=0, \ldots , J-1\). The implied constants depend at most on \(f,\kappa ,l\) (and not on ju).

Proof

We will first prove (4.36), which is the most complicated of the bounds, and at the end of the proof we will indicate how to modify the argument to establish (4.34) and (4.35). Recall that \(D_j\) and M are positive (see the remarks after (4.5) and (4.18)). So for any Schwartz function F which majorizes \(1_{[-1,1]}\), such that \({{\widehat{F}}}\) has compact support in \((-A,A)\) the LHS of (4.36) is

$$\begin{aligned} \begin{aligned} \le \sum _{m \in {\mathbb {Z}}} D_j(m;l) P_{I_{j+1}}(m;a(\cdot ; u))^{s_{j+1}} M(m; \tfrac{1}{\kappa })^{l \cdot \kappa } F\left( \frac{m}{x}\right) . \end{aligned} \end{aligned}$$

The Dirichlet Polynomial above is supported on integers \(n \le x^{\theta }\) where \(\theta = l \cdot \kappa \sum _{0 \le r \le J} \theta _r \ell _r+ \sum _{0 \le r \le j} \theta _r\ell _r+s_{j+1} \theta _{j+1} <1/2\). Hence, using (4.5), (4.6), (4.7), (4.19), (4.20) and applying Lemma 4.1 the above equation is bounded by

$$\begin{aligned} \begin{aligned} \le x (\log x)^{l/2} {{\widehat{F}}}(0) \prod _{0 \le r \le J} \sum _{\begin{array}{c} mn=\square \\ p|mn \Rightarrow p \in I_r \\ \Omega (m) \le (l \cdot \kappa ) \ell _r \end{array}} \frac{a(m;J) g(n;u,r) \lambda (m)}{\kappa ^{\Omega (m)} \sqrt{mn}} \nu _{\kappa \cdot l}(m;\ell _r) \nu (n) \frac{\varphi (mn)}{mn} \end{aligned}\nonumber \\ \end{aligned}$$
(4.37)

where

$$\begin{aligned} g(n;u,r)= {\left\{ \begin{array}{ll} 1_{\Omega (n) \le \ell _r} \cdot l^{\Omega (n)} \cdot a(n;j)(1+e^{-\ell _r}) &{}\quad \text { if } 0 \le r \le j, \\ 1_{\Omega (n)=s} \cdot s! \cdot a(n;u) &{}\quad \text { if } r=j+1, \\ 1_{n=1} &{}\quad \text { if } j +1 < r \le J. \end{array}\right. } \end{aligned}$$

Let \(\alpha (\cdot )\) be as in (4.26) and take \(a(\cdot )=a(\cdot ;J)\), \(b(\cdot )=a(\cdot ;j)\). Applying Lemma 4.2, the contribution to (4.37) from the product over \(0 \le r \le j\) is bounded in absolute value by

$$\begin{aligned} \ll \prod _{0 \le r \le j} \left( 1+O\left( \frac{1_{r=0} \cdot (\log x)^{O(1)}+1}{2^{\ell _r}}\right) \right) \prod _{p \in I_j}\left( 1+l^2\frac{\alpha (p)}{2p}+O \left( \frac{1}{p^2}\right) \right) \ll 1,\nonumber \\ \end{aligned}$$
(4.38)

where in the last step we applied (4.27). Applying Lemma 4.3 with \(a(\cdot )=a(\cdot ;J)\) and \(b(\cdot )=a( \cdot ;u)\) the term in (4.37) with \(r=j+1\) contributes

$$\begin{aligned} \ll \frac{s_{j+1}!}{2^{s_{j+1}/2}\lfloor \frac{3}{8} s_{j+1} \rfloor !} \left( \sum _{p \in I_{j+1}} \frac{a(p;u)^2}{p}\right) ^{s_{j+1}/2}. \end{aligned}$$
(4.39)

It remains to handle the factors in the product in (4.37) with \(j+1< r \le J\). For such factors, m is a square so these terms are bounded by

$$\begin{aligned} \begin{aligned}&\ll \prod _{j+1< r \le J} \sum _{\begin{array}{c} p|m \Rightarrow p \in I_r \end{array}} \frac{a(m;J)^2}{\kappa ^{2\Omega (m)} m} \nu _{l \cdot \kappa }(m^2) \\&\ll \prod _{x^{\theta _{j}} < p \le x^{\theta _J}} \left( 1+ \frac{(l \cdot \kappa )^2}{2} \cdot \frac{\lambda _f(p)^2}{\kappa ^2 p} \right) \ll \left( \frac{\theta _J}{\theta _j}\right) ^{2l^2}=e^{2l^2(J-j)}, \end{aligned} \end{aligned}$$
(4.40)

where we used (4.1) and the bound \(|\lambda _f(p)| \le 2\), in the last steps.

Using (4.38), (4.39) and (4.40) in (4.37) completes the proof of (4.36). To establish (4.34) we repeat the same argument, the only differences are that in (4.38) the product is over all \(0 \le r \le J\) and the terms estimated in (4.39) and (4.40) do not appear. To establish (4.35) note that the term estimated in (4.38) does not appear and in the bound (4.40) the only difference is that \(j=0\), so we bound this term by \(O((\log x)^{O(1)})\). Finally in place of (4.39) we get by using Lemma 4.3 the bound

$$\begin{aligned} (\log x)^{O(1)}\frac{s_{0}!}{2^{s_{0}/2}\lfloor \frac{3}{8} s_{0} \rfloor !} \left( \sum _{p \in I_{0}} \frac{a(p;u)^2}{p}\right) ^{s_{0}/2}. \end{aligned}$$

From these estimates (4.35) follows. \(\square \)

Proof of Proposition 4.1

Let A(d) be as in the statement of Proposition 4.2. In particular, using \(|\lambda _f(p^2)|\le d(p^2)=3\) and \(\lambda _f(p^2) =\lambda _f(p)^2 -1\ge -1\) it follows that

$$\begin{aligned} \left( \frac{\varphi (d)}{d} \right) ^2 \ll A(d) \ll \left( \frac{d}{\varphi (d)} \right) ^2. \end{aligned}$$

Using this observation we note that it suffices to prove that

(4.41)

for \(l>0\) (note the definition of M is independent of l, for \(1 \le l \cdot \kappa \le C\)), since by Cauchy–Schwarz (4.41) implies

We will now establish (4.41). For \(j=0,\ldots , J\), let \(s_j=2 \lfloor \frac{1}{5 \theta _j} \rfloor \). We first divide the sum over \(|d| \le x\) into two sums depending on whether

$$\begin{aligned} |P_{I_0}(d;a(\cdot ;u))| \ge \ell _0/(le^2) \end{aligned}$$
(4.42)

for some \(0 \le u \le J\). To bound the contribution of the terms to the LHS of (4.41) with \(|d| \le x\) for which (4.42) holds, we use the bound \(A(d) \ll (\log \log x)^2\), Chebyshev’s inequality and then apply Cauchy–Schwarz to see that

On the RHS, the first sum is \(\ll x (\log x)^{O(1)}\) by Soundararajan’s [30] method for upper bounds for moments (see the examples in [30, Section 4]). Using Lemma 4.4, (4.35), applying Stirling’s formula and recalling the definition of \(\ell _0,\theta _0\) (see (4.2)) the second sum on the RHS is

$$\begin{aligned} \begin{aligned}&\ll x (\log x)^{O(1)} \left( \frac{100 l^2 s_0^{5/4}}{\ell _0^2} \right) ^{s_0}\left( \sum _{p \le x} \frac{\lambda _f(p)^2}{p}\right) ^{s_0} \\&\ll x (\log x)^{O(1)} \left( 100 l^2 \theta _0^{1/4} \log \log x \right) ^{s_0} \ll x (\log x)^{O(1)} \exp \left( -(\log \log x)^5 \right) \ll \frac{x}{(\log x)^A} \end{aligned} \end{aligned}$$

for any \(A \ge 1\). Hence, the contribution to (4.41) from \( |d| \le x\) satisfying (4.42) for some \(u \le J\) is \( \ll J \frac{x}{(\log x)^A} \ll \frac{x}{(\log x)^A} \log \log \log x \) for any \(A \ge 1\).

For the remaining fundamental discriminants \(|d| \le x\) we apply (4.9) to see that their contribution to (4.41) is bounded by

(4.43)

To complete the proof it suffices to show that the expression above is \(\ll x\). Applying (4.34) the first term in (4.43) is

(4.44)

Using (4.36) the second term in (4.43) is bounded by

$$\begin{aligned} \begin{aligned} \ll x \sum _{\begin{array}{c} 0 \le j \le J-1 \\ j+1 \le u \le J \end{array}} \left( \frac{1}{\theta _{j}}\right) ^{C_1} \exp \left( {\frac{3l}{\theta _{j}}} \right) \left( \frac{ e^2 l }{ \ell _{j+1}}\right) ^{ s_{j+1}} \cdot e^{2l^2(J-j)} \frac{(s_{j+1})!}{2^{s_{j+1}/2}\lfloor \frac{3}{8} s_{j+1} \rfloor !} \left( \sum _{p \in I_{j+1}} \frac{a(p;u)^2}{p}\right) ^{s_{j+1}/2} . \end{aligned} \end{aligned}$$

Applying Stirling’s formula and estimating the inner sum over primes trivially as \(\le 5 \log (\frac{\log x^{\theta _{j+1}}}{\log x^{\theta _j}})=5\), we see that the above is

$$\begin{aligned} \ll x \sum _{0 \le j \le J-1} (J-j) \left( \frac{1}{\theta _{j}}\right) ^{C_1} e^{2l^2(J-j)} \exp \left( {\frac{3l}{\theta _{j}}} \right) \left( \frac{e^2l}{\ell _{j+1}} \cdot \left( \frac{8}{3} \right) ^{3/8} \cdot \frac{ s_{j+1}^{5/8}}{ \sqrt{2} e^{5/8}} \cdot 5\right) ^{s_{j+1}}.\nonumber \\ \end{aligned}$$
(4.45)

By construction \( \displaystyle \frac{s_{j+1}^{5/8}}{\ell _{j+1}} \ll \theta _{j+1}^{1/8}. \) Hence, there exists \(c>0\) (which may depend on \(l, \kappa \)) such that (4.45) is

$$\begin{aligned} \begin{aligned}&\ll x \sum _{0 \le j \le J-1} (J-j) e^{2l^2(J-j)} \exp \left( -\frac{c}{\theta _j} \log \frac{1}{\theta _j}+O\left( \frac{1}{\theta _j} \right) \right) \\&\ll x \sum _{1 \le j \le J} j e^{2l^2j} \exp \left( -\frac{c}{2} \cdot \frac{je^{j}}{\theta _J} \right) \ll x, \end{aligned} \end{aligned}$$
(4.46)

where we used that \(\theta _J/\theta _j=e^{J-j}\) in the last step. Combining (4.46) with (4.44), gives that (4.43) is \(\ll x\), which completes the proof. \(\square \)

5 The proof of Proposition 1.2

The main input into the proof of Proposition 1.2 is a twisted first moment of \(L(\tfrac{1}{2},f \otimes \chi _d)\). Similar moment estimates were established in [26, 29, 31] and our proof closely follows the methods developed in those papers. We will include a proof of the following result for completeness.

Proposition 5.1

Let \(\phi \) be a Schwartz function with compact support in the positive reals. Also, let \(u=u_1u_2^2\), be odd where \(u_1\) is square-free. Then

$$\begin{aligned} \begin{aligned} \sum _{\begin{array}{c} m \\ 2m \text { is } \square \text {-free} \end{array}} L\left( \tfrac{1}{2}, f \otimes \chi _{8m}\right) \chi _{8m}(u) \, \phi \left( \frac{(-1)^k 8m}{x}\right)&= C \int _{0}^{\infty } \phi (\xi ) d\xi \cdot \frac{x}{u_1^{1/2}} \cdot \vartheta (u) \\&\quad +O\left( x^{7/8+\varepsilon } u^{3/8+\varepsilon } \right) \end{aligned} \end{aligned}$$
(5.1)

where \(C>0\) depends only on f and \(\vartheta (\cdot )\) is a multiplicative function with \(\vartheta (p^{2j+1})=\lambda _f(p)+O(1/p)\) and \(\vartheta (p^{2j})=1+O(1/p)\).

The constant C is explicitly given in the proof below, see (5.30). Before proving Proposition 5.1, we will use the result to deduce Proposition 1.2.

5.1 The proof of Proposition 1.2

We will only prove the lower bound

$$\begin{aligned} \sum _{\begin{array}{c} n \le x \\ 2n \text { is } \square \text {-free} \end{array}} |c(8n)|^2 M\left( (-1)^k 8n;\tfrac{1}{2}\right) ^2 \gg x \end{aligned}$$

since the proof of the upper bound is similar. Using (1.1) it follows that for a Schwartz function \(\phi (\cdot )\) which minorizes \(1_{[1/2,1]}(\cdot )\) with \({{\widehat{\phi }}}(0)>0\) the sum above is

$$\begin{aligned} \ge \frac{(k-1)!}{\pi ^k}\cdot \frac{\langle g,g\rangle }{\langle f, f \rangle } \sum _{\begin{array}{c} m \\ 2m \text { is } \square \text {-free} \end{array}} L\left( \tfrac{1}{2}, f\otimes \chi _{8m}\right) M\left( 8m;\tfrac{1}{2}\right) ^2 \phi \left( \frac{(-1)^k 8m}{x} \right) .\nonumber \\ \end{aligned}$$
(5.2)

To proceed we now expand \(M(8m;\tfrac{1}{2})^2\) and see that it equals

$$\begin{aligned} M(8m;\tfrac{1}{2})^2=(\log x)^{1/2} \sum _{n \le x^{2 \delta _0}} \frac{h(n) a(n;J) \lambda (n)}{2^{\Omega (n) } \sqrt{n}} \left( \frac{8m}{n}\right) \end{aligned}$$
(5.3)

where h(n) is as in (4.20) (note that here \(l \cdot \kappa =2)\). Applying Proposition 5.1 gives that the RHS of (5.2) equals

$$\begin{aligned} \begin{aligned}&C^{'} x (\log x)^{1/2} \sum _{\begin{array}{c} n_1n_2^2 \le x^{2\delta _0} \\ n_1 \text { is } \square \text {-free} \end{array}} \frac{h(n_1n_2^2) a(n_1n_2^2;J) \lambda (n_1) \vartheta (n_1n_2^2)}{2^{\Omega (n_1)+2\Omega (n_2)} n_2n_1} +O(x^{9/10}) \\&\quad = C^{'} x (\log x)^{1/2} \prod _{0 \le j \le J} \sum _{\begin{array}{c} p|mn^2 \Rightarrow p \in I_j \\ \Omega (mn^2) \le 2\ell _j \end{array}} \frac{a(m n^2;J) \lambda (m) \vartheta (mn^2) \mu (m)^2}{2^{\Omega (m)+2\Omega (n)} mn} \nu _2(mn^2; \ell _j)+O(x^{9/10}), \end{aligned} \end{aligned}$$
(5.4)

where \( C^{'} = C^{'} (f,g,k, \phi )>0\) and in the last step we used that \(\vartheta \) is a multiplicative function.

We will now estimate the inner sum on the RHS of (5.4). First note that \(\vartheta (mn^2) \ll d(m) (\frac{mn^2}{\varphi (m)\varphi (n^2)})^{O(1)}\) and recall the remarks after (4.21), so we get that the sum equals

$$\begin{aligned} \begin{aligned}&\sum _{\begin{array}{c} p|mn^2 \Rightarrow p \in I_j \end{array}} \frac{a(m n^2;J) \lambda (m) \vartheta (mn^2) \mu (m)^2}{2^{\Omega (m)+2\Omega (n)} mn} \nu _2(mn^2) \\&\qquad +O\left( \frac{1}{4^{\ell _j}} \sum _{p|nm \Rightarrow p \in I_j} \frac{a(m;J)a(n;J)^2 d(m) \nu _2(m)\nu _2(n^2)}{mn} \cdot \left( \frac{mn^2}{\varphi (m)\varphi (n^2)}\right) ^{O(1)} \right) . \end{aligned}\nonumber \\ \end{aligned}$$
(5.5)

The error term is

$$\begin{aligned} \ll \frac{1}{4^{\ell _j}} \prod _{p \in I_j} \left( 1+O\left( \frac{1}{p} \right) \right) \ll \frac{1_{j=0} \cdot (\log x)^{O(1)} +1}{4^{\ell _j}}. \end{aligned}$$
(5.6)

To estimate the main term in (5.5) consider

$$\begin{aligned} s(p;a)= \sum _{t \ge 0} \frac{a(p;J)^{2t}}{4^t p^t} \vartheta (p^{2t+a})\nu _2(p^{2t+a}). \end{aligned}$$

Recall \(\vartheta (p)=\lambda _f(p)+O(1/p)\) and \(\vartheta (p^2)=1+O(1/p)\). Evaluating the sum over n in the main term of (5.5) we see that it equals

$$\begin{aligned} \begin{aligned}&\left( \prod _{p \in I_j} s(p;0)\right) \sum _{p|m \Rightarrow p \in I_j} \frac{a(m;J)\mu (m) }{2^{\Omega (m)} m} \prod _{p^a || m} \frac{s(p;a)}{s(p;0)}\\&\quad = \prod _{p \in I_j} \left( 1+\frac{a(p;J)^2}{2p}-\frac{\lambda _f(p)a(p;J)}{p}+O\left( \frac{1}{p^2} \right) \right) . \end{aligned} \end{aligned}$$
(5.7)

Using (5.6), (5.7) along with the estimates \(a(p;J)=\lambda _f(p)+O\left( \frac{\log p}{\theta _J \log x}\right) \) and

$$\begin{aligned} \prod _{p \in I_j} \left( 1+\frac{a(p;J)^2}{2p}-\frac{\lambda _f(p)a(p;J)}{p}+O\left( \frac{1}{p^2} \right) \right) ^{-1} \ll 1_{j=0} \cdot (\log x)^{O(1)}+1 \end{aligned}$$

we get that the RHS of (5.4) equals

$$\begin{aligned} \begin{aligned}&C' x(\log x)^{1/2}\prod _{c< p \le x^{\theta _J}}\left( 1-\frac{\lambda _f(p)^2}{2p}+O\left( \frac{1}{\theta _J\log x} \cdot \frac{ \log p}{p }+\frac{1}{p^2} \right) \right) \\&\quad \times \prod _{0 \le j \le J} \left( 1+O\left( \frac{1_{j=0} \cdot (\log x)^{O(1)}+1}{4^{\ell _j}} \right) \right) . \end{aligned} \end{aligned}$$
(5.8)

To estimate the second product above note that

$$\begin{aligned} \prod _{0 \le j \le J}\left( 1+O\left( \frac{1_{j=0} \cdot (\log x)^{O(1)}+1}{4^{\ell _j}} \right) \right) =1+O\left( \frac{1}{4^{\ell _J}}\right) =1+O(\eta _2) \ge \frac{1}{2},\nonumber \\ \end{aligned}$$
(5.9)

since \(\eta _2\) is sufficiently small. Also, there exists some constant \(C''>0\) such that the Euler product over \(c< p \le x^{\theta _J}\) in (5.8) is

$$\begin{aligned} \ge \prod _{c<p \le x^{\theta _J}} \left( 1-\frac{\lambda _f(p)^2}{2p}-C''\left( \frac{1}{\theta _J\log x} \cdot \frac{ \log p}{p }+\frac{1}{p^2} \right) \right) \gg (\log x)^{-1/2}, \end{aligned}$$

since c is sufficiently large (so each term in the Euler product is positive). Hence, using this and (5.9) we get that (5.8) is \( \gg x (\log x)^{1/2} \cdot (\log x)^{-1/2} = x\), which completes the proof.

5.2 The proof of Proposition 5.1

Let f be a weight 2k, level 1, Hecke cusp form. For a fundamental discriminant d, let

$$\begin{aligned} \Lambda (s,f \otimes \chi _d)=\left( \frac{|d|}{2\pi } \right) ^s \Gamma \left( s+\tfrac{2k-1}{2}\right) L(s,f \otimes \chi _d). \end{aligned}$$

The functional equation for \(\Lambda (s, f\otimes \chi _d)\) is given by

$$\begin{aligned} \Lambda (s,f \otimes \chi _d)=(-1)^k {\text {sgn}}(d) \Lambda (1-s,f \otimes \chi _d). \end{aligned}$$

Note that the central value vanishes when \((-1)^k d <0\).

For \(c >0\) and \(x>0\) let

$$\begin{aligned} W_{z}(x)=\frac{1}{2\pi i} \int _{(c)} \frac{\Gamma (z+s+k-\tfrac{1}{2})}{\Gamma (z+k-\tfrac{1}{2})} \left( 2\pi x\right) ^{-s} \, \frac{ds}{s}. \end{aligned}$$

Our starting point in the proof of Proposition 5.1 is the following approximate functional equation for \(L(s, f\otimes \chi _d)\). Also, define \(W =W_{1/2}\).

Lemma 5.1

Let f be a level 1, Hecke cusp form with weight 2k. For \(s\in {\mathbb {C}}\) with \(0 \le {\text {Re}}(s) \le 1\) and d a fundamental discriminant

$$\begin{aligned} \begin{aligned} L(s,f \otimes \chi _d)&=\sum _{n \ge 1} \frac{\lambda _f(n) \chi _d(n)}{n^s} W_{s}\left( \frac{n}{|d|}\right) \\&\quad +(-1)^k {\text {sgn}}(d) \left( \frac{ |d|}{2\pi } \right) ^{1-2s} \frac{\Gamma (1-s)}{\Gamma (s)} \sum _{n \ge 1} \frac{\lambda _f(n) \chi _d(n)}{n^{1-s }} W_{1-s}\left( \frac{n}{|d|}\right) . \end{aligned} \end{aligned}$$

Moreover, the function \(W=W_{1/2}\) satisfies \( \xi ^j W^{(j)}(\xi ) \ll \xi ^{-A}\) for any \(A \ge 1\) and \(W(\xi )=1+O(\xi ^{k-\varepsilon })\) as \(\xi \rightarrow 0\), for any \(\varepsilon >0\).

Proof

See Lemma 5 of [26] and Lemma 2.1 of [31]. \(\square \)

Since we will sum over fundamental discriminants we introduce a new parameter Y with \(1 \le Y \le x\) to be chosen later. Also, write \(F(\xi ;x,y)=\phi \left( \frac{\xi }{x}\right) W\left( \frac{y}{\xi }\right) \). Applying Lemma 5.1 the LHS of (5.1) equals

$$\begin{aligned} \begin{aligned}&2 \sum _{ (m,2)=1 } \sum _{a^2 | m} \mu (a) \sum _{n \ge 1} \frac{\lambda _f(n) }{\sqrt{n}} \left( \frac{ 8m}{nu}\right) F\left( (-1)^k 8m; x,n \right) \\&\quad =2 \left( \sum _{\begin{array}{c} a \le Y \\ (a,2u)=1 \end{array}}+\sum _{\begin{array}{c} a>Y \\ (a,2u)=1 \end{array}}\right) \mu (a) \sum _{\begin{array}{c} (m,2)=1 \\ a^2 |m \end{array}} \sum _{n \ge 1} \frac{\lambda _f(n)}{\sqrt{n}} \left( \frac{ 8m}{nu}\right) F\left( (-1)^k 8m; x,n\right) . \end{aligned} \end{aligned}$$
(5.10)

The terms with \(a>Y\). Write \(m=r^2e\) where e is square-free, and note since in the sum in (5.10) \(a^2|m\) it follows that a|r. So the second sum in (5.10) equals

$$\begin{aligned} \begin{aligned}&2 \sum _{(r,2u)=1} \sum _{\begin{array}{c} a>Y \\ a|r \end{array}} \mu (a) \sum _{\begin{array}{c} e \text { is } \square \text {-free} \\ (e,2)=1 \end{array}}\sum _{(n,r)=1} \frac{\lambda _f(n)}{\sqrt{n}} \left( \frac{ 8e}{nu}\right) F\left( (-1)^k 8 r^2 e; x,n\right) \\&\quad \ll \sum _{|r | \le x^{1/2+\varepsilon }} \sum _{\begin{array}{c} a>Y \\ a|r, (a,2)=1 \end{array}} \sum _{\begin{array}{c} 1 \le (-1)^k e \le x^{1+\varepsilon }/r^2 \\ e \text { is } \square \text {-free} \\ (e,2)=1 \end{array}} \left| \sum _{(n,r)=1} \frac{\lambda _f(n)}{\sqrt{n}} \left( \frac{ 8e}{n}\right) W\left( \frac{n}{8r^2|e|}\right) \right| +\frac{1}{x}, \end{aligned}\nonumber \\ \end{aligned}$$
(5.11)

where in the second line we have used the rapid decay of W. Using the definition of W and for \({\text {Re}}(s)>1\), writing \(L(s,f\otimes \chi _{8e})=\prod _p L_p(s)\) where \(L_p(s)=\left( 1-\frac{\lambda _f(p)\left( \frac{8e}{p}\right) }{p^s}+\frac{\left( \frac{8e}{p}\right) ^2}{p^{2s}}\right) ^{-1}\) we get for \(c>1/2\) that

$$\begin{aligned} \begin{aligned} \sum _{(n,r)=1} \frac{\lambda _f(n)}{\sqrt{n}} \left( \frac{ 8e}{n}\right) W\left( \frac{n}{8r^2|e|}\right)&= \frac{1}{2\pi i} \int _{(c)} \frac{\Gamma (s+k)}{\Gamma (k)} \left( \frac{8r^2e}{2\pi }\right) ^s \frac{L(s+\frac{1}{2},f \otimes \chi _{8e})}{\prod _{p | r} L_p\left( s+\frac{1}{2}\right) } \, \frac{ds}{s}. \end{aligned}\nonumber \\ \end{aligned}$$
(5.12)

The integrand is holomorphic for \(1/\log x \le {\text {Re}}(s) \le 2\) and in this region bounded by (note \(r^2|e| \le x^2\))

$$\begin{aligned} \begin{aligned}&\ll \prod _{p|r}\left( 1+\frac{O(1)}{\sqrt{p}} \right) (r^2|e|)^{{\text {Re}}(s)}|\Gamma (s+k)| |L\left( s+\tfrac{1}{2}, f\otimes \chi _{8e}\right) | \cdot \frac{1}{|s|} \\&\ll x^{\varepsilon } (r^2|e|)^{{\text {Re}}(s)} \exp (-|s|) |L\left( s+\tfrac{1}{2}, f\otimes \chi _{8e}\right) |. \end{aligned} \end{aligned}$$

Hence, shifting contours on the RHS of (5.12) to \(\varepsilon \) and applying the above estimate we get that the LHS of (5.12) is bounded by

$$\begin{aligned} \ll x^{\varepsilon } \int _{(\varepsilon )} \exp (-|s|) \left| L\left( s+\tfrac{1}{2}, f \otimes \chi _{8e}\right) \right| \, |ds|. \end{aligned}$$

Also note, that by Cauchy–Schwarz and Corollary 2.5 of [31] (which follows from Heath-Brown’s result [7])

$$\begin{aligned} \sum _{\begin{array}{c} 1 \le (-1)^k e \le x^{1+\varepsilon }/r^2 \\ e \text { is } \square \text {-free} \\ (e,2)=1 \end{array}} \left| L\left( s+\tfrac{1}{2}, f \otimes \chi _{8e}\right) \right| \ll \frac{x^{1+\varepsilon }}{r^2} (1+|{\text {Im}}(s)|)^{1/2+\varepsilon }, \end{aligned}$$

for \({\text {Re}}(s) \ge 0\). Applying this estimate in (5.11) it follows that the second sum in (5.10) is bounded by

$$\begin{aligned} \ll x^{1+\varepsilon } \sum _{|r| \le x^{1/2+\varepsilon }} \sum _{\begin{array}{c} a>Y \\ a| r \end{array}} \frac{1}{r^2} \ll \frac{x^{1+\varepsilon }}{Y}. \end{aligned}$$
(5.13)

The terms with \(a<Y\): preliminary lemmas It remains to estimate the first sum on the LHS of (5.10). This will be done by applying Poisson summation to the character sum, as developed in [29].

Let \(\ell \in {\mathbb {Z}}, n \in {\mathbb {N}}\). Define

$$\begin{aligned} G_{\ell }(n)=\left( \frac{1-i}{2}+\left( \frac{-1}{n}\right) \frac{1+i}{2} \right) \sum _{a \pmod {n}} \left( \frac{a}{n}\right) e\left( \frac{a\ell }{n}\right) . \end{aligned}$$

In Lemma 2.3 of [29] it is shown that \(G_{\ell }\) is a multiplicative function. Moreover, \(G_0(n)=\varphi (n)\) if n is a square and is identically zero otherwise. Also, for \(p^{\alpha } || \ell \), \(\ell \ne 0\)

$$\begin{aligned} G_{\ell }(p^{\beta })= {\left\{ \begin{array}{ll} 0 &{}\quad \text {if } \, \beta \le \alpha \text { is odd},\\ \varphi (p^{\beta }) &{} \quad \text {if } \,\beta \le \alpha \text { is even}, \\ -p^{\alpha } &{}\quad \text {if } \, \beta = \alpha +1 \text { is even},\\ \left( \frac{\ell p^{-\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}$$
(5.14)

Lemma 5.2

Let F be a Schwartz function. Then for any odd integer n

$$\begin{aligned} \sum _{(d,2)=1} \left( \frac{d}{n} \right) F\left( d\right) = \frac{1}{2n} \left( \frac{2}{n} \right) \sum _{\ell } (-1)^{\ell } G_{\ell }(n) {{\widetilde{F}}}\left( \frac{\ell }{2n} \right) , \end{aligned}$$

where

$$\begin{aligned} {{\widetilde{F}}}(\lambda )=\int _{{\mathbb {R}}}(\cos (2\pi \lambda \xi )+\sin (2\pi \lambda \xi ))F(\xi ) \, d\xi . \end{aligned}$$

Proof

This is established in the proof of Lemma 2.6 of [29], in particular see the last equation of the proof. \(\square \)

Using Lemma 5.1 it follows that \(F( \cdot ; x,n)\) is a Schwartz function, since \(\phi \) and its derivatives decay rapidly. Hence, applying Lemma 5.2 the first sum on the RHS of (5.10) equals (note u is odd)

$$\begin{aligned} \begin{aligned}&2\sum _{\begin{array}{c} a \le Y \\ (a,2u)=1 \end{array}} \mu (a) \sum _{(n,a)=1} \frac{\lambda _f(n)}{\sqrt{n}} \left( \frac{8}{nu} \right) \sum _{(m,2)=1} \left( \frac{m}{nu} \right) F\left( m;\frac{(-1)^k x}{8a^2},\frac{(-1)^kn}{8a^2} \right) \\&\quad =2\sum _{\begin{array}{c} a \le Y \\ (a,2u)=1 \end{array}} \mu (a) \sum _{(n,a)=1} \frac{\lambda _f(n)}{\sqrt{n}} \cdot \frac{1}{2nu} \left( \frac{16}{nu} \right) \sum _{\ell \in {\mathbb {Z}}} (-1)^{\ell } G_{\ell }(nu) {{\widetilde{F}}}\left( \frac{\ell }{2nu}; \frac{ x}{8a^2},\frac{ n}{8a^2} \right) , \end{aligned}\nonumber \\ \end{aligned}$$
(5.15)

where

$$\begin{aligned} {{\widetilde{F}}}\left( \lambda ; x, y\right) =\int _{{\mathbb {R}}}(\cos (2\pi \lambda \xi )+(-1)^k\sin (2\pi \lambda \xi ))F(\xi ;x,y) \, d\xi . \end{aligned}$$

Note that for odd k after applying Lemma 5.2 in (5.15) we also made the change of variables \(\xi \rightarrow -\xi \).

Before proceeding we require several estimates for \({{\widetilde{F}}}\). The first such result is a basic estimate on the rate of decay of \({{\widetilde{F}}}\).

Lemma 5.3

Let \(x,y>0\) and \(\lambda \in {\mathbb {R}}\). We have for any \(\theta \ge \varepsilon >0\) that

$$\begin{aligned} {{\widetilde{F}}}(\lambda ;x,y) \ll x \left( \frac{x}{y}\right) ^{\theta } \end{aligned}$$

where the implied constant depends on \(\varepsilon \). Additionally, we have for any integer \(A \ge 1\) that

$$\begin{aligned} {{\widetilde{F}}}(\lambda ;x,y) \ll x \cdot \frac{1}{|y\lambda |^A} \end{aligned}$$

where the implied constant depends on A.

Proof

Using the definition of W and shifting contours of integration to \({\text {Re}}(s)=\theta \ge \varepsilon >0\) we have that

$$\begin{aligned} W\left( \frac{y}{x \xi }\right) \ll \left( \frac{x \xi }{y} \right) ^{\theta } \end{aligned}$$

so that

$$\begin{aligned} {{\widetilde{F}}}(\lambda ;x,y) \ll x \left( \frac{x}{y} \right) ^{\theta } \int _{{\mathbb {R}}} \xi ^{\theta } |\phi (\xi )| \, d\xi \ll x \left( \frac{x}{y} \right) ^{\theta }. \end{aligned}$$

Let \({\mathcal {W}}(\xi )=W(\frac{y}{x\xi })\phi (\xi )\). For each integer \(0 \le B \le A\), we get by shifting the contour of integration to \({\text {Re}}(s)=A\) and switching the order of differentiation and integration that

$$\begin{aligned} \frac{d^B}{d\xi ^B} W\left( \frac{y}{x\xi }\right) \ll \left( \frac{x}{y} \right) ^A \xi ^{A-B}. \end{aligned}$$

Using this and the fact that \(\phi \) has compact support it follows that

$$\begin{aligned} {\mathcal {W}}^{(A)}(\xi ) \ll \left( \frac{x}{y} \right) ^{A} \cdot \frac{1}{1+|\xi |^2}. \end{aligned}$$

Hence, integrating by parts and using the above bound it follows that

$$\begin{aligned} {{\widetilde{F}}}(\lambda ;x,y) \ll x \cdot \frac{1}{|x\lambda |^A} \int _{{\mathbb {R}}} \left| {\mathcal {W}}^{(A)}(\xi ) \right| \, d \xi \ll x \cdot \frac{1}{|y\lambda |^A}. \end{aligned}$$

\(\square \)

We also require the following information about the Mellin transform of \({{\widetilde{F}}}\). Let

$$\begin{aligned} \Phi (s)=\int _{0}^{\infty } \phi (t) t^{-s} \, dt. \end{aligned}$$

Lemma 5.4

For \(\ell \in {\mathbb {Z}}\) with \(\ell \ne 0\), let

$$\begin{aligned} \breve{F}(s;\ell ,u, a^2)=\int _0^{\infty } {{\widetilde{F}}}\left( \frac{\ell }{2tu}; \frac{ x}{8a^2}, \frac{t}{8a^2}\right) \, t^{s-1} \, dt. \end{aligned}$$

Then for \({\text {Re}}(s)>0\)

$$\begin{aligned} \breve{F}(s;\ell ,u, a^2)&= \frac{x^{1+s}}{8a^2} \Phi (-s) \int _{0}^{\infty } W\left( \frac{1}{y}\right) \left( \cos \left( \pi y \cdot \frac{\ell }{8ua^2} \right) \right. \nonumber \\&\quad \left. +(-1)^k\sin \left( \pi y \cdot \frac{\ell }{8ua^2} \right) \right) \, \frac{dy}{y^{s+1}}. \end{aligned}$$
(5.16)

Moreover, the function \(\breve{F}(s;\ell ,u, a^2)\) extends to an entire function in the half-plane \({\text {Re}}(s)\ge -1+\varepsilon \) and in this region

$$\begin{aligned} \breve{F}(s;\ell ,u, a^2) \ll \frac{x^{1+{\text {Re}}(s)}}{a^2(1+|s|)^A}\left( \left( \frac{|\ell |}{ua^2}\right) ^{{\text {Re}}(s)}+1\right) \end{aligned}$$

for any \(A \ge 1\).

Proof

Changing the order of integration and making a change of variables \(x\xi /t \rightarrow t\) in the integral over t it follows that \(\breve{F}(s;\ell ,u, a^2)\) equals

$$\begin{aligned} \begin{aligned}&\frac{x}{8a^2}\int _0^{\infty } \int _{{\mathbb {R}}} \left( \cos \left( \pi \frac{\ell }{8ua^2} \cdot \frac{x \xi }{t} \right) +(-1)^k\sin \left( \pi \frac{\ell }{8ua^2} \cdot \frac{x \xi }{t} \right) \right) W\left( \frac{t}{x \xi }\right) \phi (\xi ) t^{s-1} \, d\xi \, dt\\&\quad =\frac{x^{1+s}}{8a^2} \int _{{\mathbb {R}}}\int _0^{\infty } \phi (\xi ) \xi ^s \cdot W\left( \frac{1}{t}\right) \left( \cos \left( \pi t \cdot \frac{\ell }{8ua^2} \right) +(-1)^k\sin \left( \pi t \cdot \frac{\ell }{8ua^2} \right) \right) \frac{dt}{t^{s+1}}d\xi , \end{aligned} \end{aligned}$$

which establishes the first claim.

The function

$$\begin{aligned} w(s)=\int _{0}^{\infty } W\left( \frac{1}{y}\right) \left( \cos \left( \pi y \cdot \frac{\ell }{8ua^2} \right) +(-1)^k\sin \left( \pi y \cdot \frac{\ell }{8ua^2} \right) \right) \, \frac{dy}{y^{s+1}} \end{aligned}$$

is holomorphic in the region \({\text {Re}}(s) \ge \varepsilon \). Write \(w(s)=I_1(s)+I_2(s)\) where \(I_1\) is the portion of the integral over \([0, \tfrac{8au^2}{|\ell |}]\) and \(I_2\) is the rest. Due to the rapid decay of W, \(I_1(s)\) is holomorphic in the region \({\text {Re}}(s) \ge -1\) and in this region

$$\begin{aligned} I_1(s) \ll \int _0^{\frac{8ua^2}{|\ell |}} |W(1/y)| \, y^{-{\text {Re}}(s)-1} dy \ll \left( \frac{|\ell |}{ua^2}\right) ^{{\text {Re}}(s)}+1. \end{aligned}$$
(5.17)

Next, write

$$\begin{aligned} I_2(s) \!=\! \left( \frac{|\ell |}{8ua^2} \right) ^s \int _1^{\infty } \left( \cos \left( \pi y \right) \!+\!(-1)^k{\text {sgn}}(\ell )\cdot \sin \left( \pi y \right) \right) \, \frac{dy}{y^{s+1}} \!+\!I_3(s). \end{aligned}$$
(5.18)

The integral \(I_3(s)\) is holomorphic in \({\text {Re}}(s) \ge -1\) and uniformly in this region we have by Lemma 5.1, that \(W(1/y)=1+O(y^{-k+\varepsilon })\) we get

$$\begin{aligned} I_3(s) \ll \int _{\frac{8au^2}{|\ell |}}^{\infty }\left| 1-W\left( \frac{1}{y} \right) \right| \, \frac{dy}{y^{{\text {Re}}(s)+1}} \ll \left( \frac{|\ell |}{u a^2} \right) ^{{\text {Re}}(s)}+1. \end{aligned}$$

The first integral on the RHS of (5.18) can be analytically continued to \({\text {Re}}(s)>-1\) by integrating by parts. This provides the analytic continuation of \(I_2(s)\) to \({\text {Re}}(s)\ge -1+\varepsilon \), and shows that in this region

$$\begin{aligned} I_2(s) \ll (|s|+1)\left( \left( \frac{|\ell |}{ua^2} \right) ^{{\text {Re(s)}}}+1\right) . \end{aligned}$$

Hence applying this estimate along with (5.17) in (5.16) and noting \(\Phi \) decays rapidly establishes the claim. \(\square \)

The terms with \(a<Y\): main term analysis i.e. \(\ell =0\) Recall that \(G_0(n)=\varphi (n)\) if \(n=\square \) and is zero otherwise. So using Lemma 5.3 the term with \(\ell =0\) in (5.15) equals

$$\begin{aligned} \begin{aligned}&\sum _{(a,2u)=1} \mu (a) \sum _{\begin{array}{c} (n,2a)=1 \\ nu=\square \end{array}} \frac{\lambda _f(n)}{\sqrt{n}} \frac{\varphi (nu)}{nu} {{\widetilde{F}}}\left( 0; \frac{x}{8a^2},\frac{n}{8a^2} \right) +O\left( \frac{x^{1+\varepsilon }}{Y}\right) \\&\quad =\frac{x}{8} \frac{1}{2\pi i} \int _{(c)} \left( \frac{x}{2\pi } \right) ^s \frac{\Gamma (s+k)}{\Gamma (k)} \left( \sum _{\begin{array}{c} a \\ (a,2u)=1 \end{array}} \frac{\mu (a)}{a^2} \sum _{\begin{array}{c} (n,2a)=1 \\ nu=\square \end{array}} \frac{\lambda _f(n)}{n^{s+1/2}} \frac{\varphi (nu)}{nu} \right) \, \Phi (-s) \frac{ds}{s} \\&\qquad +O\left( \frac{x^{1+\varepsilon }}{Y}\right) . \end{aligned}\nonumber \\ \end{aligned}$$
(5.19)

We now evaluate the inner sum on the RHS of (5.19) (note \({\text {Re}}(s)=c>0\)). Since \(nu=\square \) write \(n=e^2 u_1\), (recall \(u=u_1u_2^2\)) so

$$\begin{aligned} \sum _{(a,2u)=1} \frac{\mu (a)}{a^2} \sum _{\begin{array}{c} (n,2a)=1 \nonumber \\ nu=\square \end{array}} \frac{\lambda _f(n)}{n^{s+1/2}} \frac{\varphi (nu)}{nu}= & {} \sum _{(e,2)=1} \frac{\lambda _f(u_1 e^2)}{(u_1e^2)^{s+1/2}} \frac{\varphi (e^2u_1u)}{e^2u_1u} \sum _{(a,2eu)=1} \frac{\mu (a)}{a^2} \\\!=\! & {} \frac{4}{3\zeta (2) u_1^{s+\frac{1}{2}}} \sum _{(e,2)=1} \frac{\lambda _f(u_1 e^2)}{e^{2s+1}} \prod _{p|eu}\frac{1-\frac{1}{p}}{1-\frac{1}{p^2}}. \end{aligned}$$
(5.20)

The sum on the RHS can be expressed as an Euler product as follows. Let \(r(n)=\prod _{p|n} \frac{1-\frac{1}{p}}{1-\frac{1}{p^2}}\). Also, let

$$\begin{aligned} {{\widetilde{\sigma }}}_p(z;\alpha ,\beta )=\sum _{j=0}^{\infty } \frac{\lambda _f(p^{2j+\alpha })}{p^{jz}} r(p^{j+\beta }), \quad {\mathcal {G}}(z;u)= \prod _{p|u_1} \frac{{{\widetilde{\sigma }}}_p(z;1,1)}{{{\widetilde{\sigma }}}_p(z;0,0)} \prod _{\begin{array}{c} p|u_2 \\ p \not \mid u_1 \end{array}} \frac{{{\widetilde{\sigma }}}_p(z;0,1)}{{{\widetilde{\sigma }}}_p(z;0,0)}, \end{aligned}$$

and

$$\begin{aligned} {\mathcal {H}}(z)= \prod _{p} \frac{{{\widetilde{\sigma }}}_p(z;0,0)}{L_p(z, {\text {sym}}^2 f)}, \end{aligned}$$

where \(L_p(z, {\text {sym}}^2 f)^{-1}=(1-\frac{\alpha _p^2}{p^s})(1-\frac{1}{p^s})(1-\frac{\beta _p^2}{p^s})\) and \(\alpha _p, \beta _p\) are the Satake parameters of f (i.e. \(\alpha _p+\beta _p=\lambda _f(p)\) and \(\alpha _p \beta _p=1\)). It follows that

$$\begin{aligned} \sum _{(e,2)=1} \frac{\lambda _f(u_1 e^2)}{e^{2s+1}} \prod _{p|eu}\frac{1-\frac{1}{p}}{1-\frac{1}{p^2}}= L(1+2s, {\text {sym}}^2 f)\frac{{\mathcal {G}}(1+2s;u)}{{{\widetilde{\sigma }}}_2(1+2s;0,0)} {\mathcal {H}}(1+2s).\nonumber \\ \end{aligned}$$
(5.21)

Note for each prime p that \(L_p(1, {\text {sym}}^2 f) >0\) and \(0<r(p)<1\) so that \({{\widetilde{\sigma }}}_p(1;0,0)>0 \) for each p.

Also, \(\frac{{\mathcal {G}}(1+2s;u)}{{{\widetilde{\sigma }}}_2(1+2s;0,0)} {\mathcal {H}}(1+2s) \ll u^{\varepsilon } \) for \({\text {Re}}(s) \ge -\frac{1}{4}+\varepsilon \) and is analytic in this region. Hence, applying (5.20) and (5.21) in the RHS of (5.19) then shifting contours \({\text {Re}}(s)=-\tfrac{1}{4}+\varepsilon \), collecting the residue at \(s=0\) we see that the RHS of (5.19) equals

$$\begin{aligned} \frac{x}{\pi ^2 u_1^{1/2}} \cdot L(1, {\text {sym}}^2 f)\frac{{\mathcal {G}}(1;u)}{{{\widetilde{\sigma }}}_2(1;0,0)} {\mathcal {H}}(1) \cdot \Phi (0) +O\left( u^{\varepsilon } x^{3/4+\varepsilon } \right) +O\left( \frac{x^{1+\varepsilon }}{Y}\right) .\nonumber \\ \end{aligned}$$
(5.22)

Finally, note \({\mathcal {G}}(1;\cdot )\) is a multiplicative function satisfying \({\mathcal {G}}(1;p^{2j+1})=\lambda _f(p)+O(1/p)\) and \({\mathcal {G}}(1;p^{2j})=1+O(1/p)\). Set \(\vartheta (n)={\mathcal {G}}(1;n)\).

The terms with \(a \le Y\): Off-diagonal analysis i.e. \(\ell \ne 0\) In (5.15) it remains to bound

$$\begin{aligned} \sum _{\ell \ne 0}\sum _{\begin{array}{c} a \le Y \\ (a,2u)=1 \end{array}} \left| \sum _{(n,2a)=1} \frac{\lambda _f(n)}{n^{1/2}} \left( \frac{4}{n} \right) \frac{G_{\ell }(nu)}{nu} {{\widetilde{F}}}\left( \frac{\ell }{2nu}; \frac{ x}{8a^2}, \frac{n}{8a^2} \right) \right| . \end{aligned}$$
(5.23)

First, note that by Lemma 5.3 the contribution from the terms with \(|\ell | \ge Y^2 u x^{\varepsilon }\) to (5.23) is bounded by

$$\begin{aligned} \ll \sum _{|\ell | \ge Y^2 u x^{\varepsilon }} \sum _{a \le Y} \frac{x}{a^2}\left( \sum _{n \le |\ell |^{\varepsilon } x} \left( \frac{a^2 u}{ |\ell |} \right) ^A+\sum _{n > |\ell |^{\varepsilon } x} \left( \frac{x}{n} \right) ^{\theta } \right) \ll \frac{1}{x} \end{aligned}$$
(5.24)

where \(A, \theta \) have been chosen sufficiently large with respect to \(\varepsilon \).

It remains to estimate the terms in (5.23) with \(|\ell | \le Y^2 u x^{\varepsilon } \). Let \(\psi _{4\ell }(n)=\left( \frac{4\ell }{n}\right) \) and note that \(\psi _{4\ell }\) is a character of modulus at most \(4|\ell |\). Using that \(G_{\ell }\) is a multiplicative function, and using (5.14) we can write

$$\begin{aligned} \sum _{(n,2a)=1} \frac{\lambda _f(n)}{n^{s}} \left( \frac{4}{n} \right) \frac{G_{\ell }(nu)}{ u\sqrt{n}}=L(s,f \otimes \psi _{4\ell }) R(s;\ell ,u,a), \qquad {\text {Re}}(s)>1,\nonumber \\ \end{aligned}$$
(5.25)

where

$$\begin{aligned} R(s;\ell ,u,a)=\prod _{p} R_p(s;\ell ,u,a). \end{aligned}$$

It follows that for \((p,4au\ell )=1\)

$$\begin{aligned} R_p(s;\ell ,u,a)&=\left( 1+\frac{\lambda _f(p)}{p^s}\left( \frac{4\ell }{p} \right) \right) \cdot \left( 1- \frac{\lambda _f(p)}{p^s} \left( \frac{4\ell }{p}\right) +\frac{1}{p^{2s}}\right) \\&=1+O\left( \frac{1}{p^{2{\text {Re}}(s)}}\right) . \end{aligned}$$

For \(p |au \ell \) and \({\text {Re}}(s) \ge \tfrac{1}{2}+\varepsilon \), writing \(p^{\theta } || u\), we have that

$$\begin{aligned} \begin{aligned} |R_p(s;\ell ,u,a)|&=\left| \left( 1+O\left( \frac{1}{p^{1/2}} \right) \right) \cdot \left( \frac{G_{\ell }(p^{\theta })}{p^{\theta }}+O\left( \sum _{j \ge 1} \frac{p^{j+\theta }}{p^{j(\frac{1}{2}+\varepsilon )} p^{j/2+\theta }} \right) \right) \right| \\&\le \left( 1+O\left( \frac{1}{p^{\varepsilon }}\right) \right) . \end{aligned} \end{aligned}$$

Also \(R_2(s;\ell ,u,a) \ll 1\) for \({\text {Re}}(s) \ge \frac{1}{2}\). Hence, for \(0<a, u, |\ell | \le x^2\) and \({\text {Re}}(s) \ge \tfrac{1}{2}+\varepsilon \)

$$\begin{aligned} R(s;\ell ,u,a)\ll \prod _{p|au\ell } \left( 1+\frac{O(1)}{p^{\varepsilon }} \right) \ll x^{\varepsilon }. \end{aligned}$$
(5.26)

So \(R(\cdot ; \ell , u,a)\) is an absolutely convergent Euler product and thereby defines a holomorphic function in the half-plane \({\text {Re}}(s)\ge \frac{1}{2}+\varepsilon \). Hence, applying Mellin inversion and (5.25) we get for \(c>0\) that

$$\begin{aligned} \begin{aligned}&\sum _{(n,2a)=1} \frac{\lambda _f(n)}{n} \left( \frac{4}{n} \right) \frac{G_{\ell }(nu)}{u\sqrt{n}} {{\widetilde{F}}}\left( \frac{\ell }{2nu}; \frac{ x}{8a^2}, \frac{n}{8a^2} \right) \\&\quad =\frac{1}{2\pi i} \int _{(c)} \breve{F}(s; \ell ,u, a^2) L(1+s,f \otimes \psi _{4\ell }) R(1+s;\ell ,u,a)\, ds . \end{aligned} \end{aligned}$$
(5.27)

Using Lemma 5.4 and (5.26) we can shift contours in the integral above to \({\text {Re}}(s)=-\tfrac{1}{2}+\varepsilon \), since the integrand is holomorphic in this region. Using the convexity bound

$$\begin{aligned} L(\tfrac{1}{2}+\varepsilon +it, f \otimes \psi _{4\ell }) \ll (1+|t|)^{1/2+\varepsilon } |\ell |^{1/2+\varepsilon } \end{aligned}$$

along with Lemma 5.4 and (5.26) it follows that for \(|\ell |,u,a \le x\)

$$\begin{aligned}&\frac{1}{2\pi i} \int _{(-\frac{1}{2}+\varepsilon )} \breve{F}(s; \ell ,u, a^2) L(1+s,f \otimes \psi _{4\ell }) R(1+s;\ell ,u,a)\, ds \nonumber \\&\quad \ll \frac{x^{\frac{1}{2}+\varepsilon }}{a^2} \cdot \left( \left( \frac{ua^2}{|\ell |} \right) ^{1/2}+1 \right) |\ell |^{1/2}. \end{aligned}$$
(5.28)

Applying (5.27) and (5.28) in (5.23) the terms with \(|\ell | \le Y^2 x^{\varepsilon } u\) in (5.23) are bounded by

$$\begin{aligned} x^{\frac{1}{2}+\varepsilon } \sum _{1 \le |\ell | \le Y^2 x^{\varepsilon } u}\sum _{a \le Y}\frac{1}{a^2}\left( \left( \frac{ua^2}{|\ell |}\right) ^{1/2}+1\right) |\ell |^{1/2} \ll x^{\frac{1}{2}+\varepsilon } Y^3 u^{3/2}. \end{aligned}$$
(5.29)

Completion of the proof of Proposition5.1 Applying (5.22), (5.24), (5.29) in (5.15) and then using the resulting formula along with (5.13) in (5.10) it follows that

$$\begin{aligned} \begin{aligned}&\sum _{\begin{array}{c} m \\ 2m \text { is } \square \text {-free} \end{array}} L(\tfrac{1}{2}, f \otimes \chi _{8m}) \chi _{8m}(u) \, \phi \left( \frac{(-1)^k 8m}{x}\right) \\&\quad = \frac{x}{\pi ^2 u_1^{1/2}} \cdot L(1, {\text {sym}}^2 f)\frac{{\mathcal {G}}(1;u)}{{{\widetilde{\sigma }}}_2(1;0,0)} {\mathcal {H}}(1) \cdot \Phi (0)+O\left( \frac{x^{1+\varepsilon }}{Y}+x^{\frac{1}{2}+\varepsilon } Y^3 u^{3/2}\right) . \end{aligned} \end{aligned}$$
(5.30)

Choosing \(Y=x^{1/8}u^{-3/8}\) and recalling the estimates given for \({\mathcal {G}}(1;\cdot )\) after (5.22) completes the proof with \(C= \frac{1}{\pi ^2} \cdot L(1, {\text {sym}}^2 f)\frac{{\mathcal {H}}(1)}{{{\widetilde{\sigma }}}_2(1;0,0)}\). By the comment directly after (5.21) it follows that \(C>0\).

6 The proof of Proposition 1.3

In order to establish Proposition 1.3 we will need the following variant of the shifted convolution problem for coefficients of half-integral weight forms.

Proposition 6.1

Uniformly in \(1 \le \Delta \le X^{\frac{1}{52}}\), \(0< |h| < X^{\frac{1}{2}}\) and \((v, \Delta ) = 1\), we have for every \(\varepsilon > 0\)

$$\begin{aligned} \frac{1}{X^{k - 1/2}} \left| \sum _{n} c(n) n^{\frac{k - 1/2}{2}} e \left( \frac{n v}{\Delta } \right) e^{- \frac{2\pi n}{X}} c(n + h) (n + h)^{\frac{k - 1/2}{2}} e^{- \frac{2\pi (n + h)}{X} } \right| \ll X^{1 - \frac{1}{104} + \varepsilon }.\nonumber \\ \end{aligned}$$
(6.1)

6.1 The shifted convolution problem

We begin with a proof of Proposition 6.1. The proof is based on the by now standard combination of the circle method and modularity. Recall that a weight \(k+\tfrac{1}{2}\) modular form (with trivial character) transforms under \(\Gamma _0(4)\) in the following way

$$\begin{aligned} g ( \gamma z) = \nu (\gamma ) j_{\gamma }(z)^{k + \frac{1}{2}}g(z), \qquad \forall \gamma \in \Gamma _0(4), \end{aligned}$$
(6.2)

where for \(\gamma = \begin{pmatrix} a &{} b \\ c&{} d \end{pmatrix}\) we set \( j_{\gamma }(z)=cz+d\) and \(\nu (\gamma )= \left( \frac{c}{d}\right) \overline{\varepsilon _d}\), where \(\left( \frac{\cdot }{\cdot }\right) \) denotes the quadratic residue symbol in the sense of Shimura [27] (see Notation 3) and

$$\begin{aligned} \varepsilon _{d} := {\left\{ \begin{array}{ll} 1 &{}\quad \text { if } d \equiv 1 \pmod {4}, \\ i^{2k + 1} &{}\quad \text { if } d \equiv - 1 \pmod {4}. \end{array}\right. } \end{aligned}$$

Also, we record the following estimate for the Fourier coefficients of g

$$\begin{aligned} \sum _{n \le X} |c(n)|^2 \ll X \end{aligned}$$
(6.3)

(see [10, Theorem 5.1] and use partial summation). This implies that

$$\begin{aligned} |c(n)| \ll n^{1/2+\varepsilon }. \end{aligned}$$
(6.4)

We record below a few standard lemmas.

Lemma 6.1

Let \(\eta \in (0, 1]\) and \(Q \ge 1\) be given. Let \(Q^{\eta / 2} \ge \Delta \ge 1\) be an integer. Let \(I_{d/q}(\cdot )\) denote the indicator function of the interval \([d / q - Q^{- 2 + \eta }; d / q + Q^{-2 + \eta }]\). Let \({\mathcal {Q}}\) denote the set of integers \(n \in [Q, 2Q]\) that can be written as \(4 \Delta r\) with \(r \equiv 1 \pmod {4}\) prime. For \(\alpha \in {\mathbb {R}}\), put

Finally let \(I(\cdot )\) denote the indicator function of the interval [0, 1]. Then, for every \(\varepsilon > 0\)

$$\begin{aligned} \int _{{\mathbb {R}}} (I(\alpha ) - {\widetilde{I}}(\alpha ))^2 d \alpha \ll _{\varepsilon } Q^{-\eta / 2 + \varepsilon }. \end{aligned}$$

Proof

This is a consequence of a result of Jutila (see [12] or [5, Proposition 2]). In the notation of [5, Proposition 2] we specialize to \(\delta = Q^{-2 + \eta }\) and notice that \(L \asymp \frac{\varphi (4 \Delta )}{\Delta ^2} \cdot \frac{Q^2}{\log Q}\). \(\square \)

Crucial to our analysis is the following consequence of the modularity of g.

Lemma 6.2

Let g be a cusp form of weight \(k + \tfrac{1}{2}\) of level 4 where \(k \ge 2\) is an integer. Let \((d,q) = 1\) and \((v,\Delta ) = 1\) be two pairs of co-prime integers. Suppose that \(q = 4 \Delta r\) with \(r > 4 \Delta \) a prime congruent to \(1 \pmod {4}\). Write \(d = r b + 4 \Delta \ell \) with \((b, 4 \Delta ) = 1\) and \((\ell , r) = 1\). Let \(\Delta ^{\star } = \Delta / (4 v + b, \Delta )\) and \((4v + b)^{\star } = (4 v + b) / (4v + b, \Delta )\). Then, for any \(\beta \in {\mathbb {R}}\) and any real \(X \ge 1\)

$$\begin{aligned}&g \left( \frac{d}{q} + \frac{v}{\Delta } + \beta + \frac{i}{X} \right) = \overline{\varepsilon _{(4 v + b)^{\star }}}\chi _{4 \Delta ^{\star }} ( (4 v + b)^{\star } r ) \chi _{r} ( 4 \Delta ^{\star } \ell ) \\&\quad \times \left( \frac{X}{4 \Delta ^{\star } r} \right) ^{k + \frac{1}{2}} \left( \frac{i}{1 - i \beta X} \right) ^{k + \frac{1}{2}}g \left( - \frac{\overline{r^2 (4 v + b)^{\star }}}{4 \Delta ^{\star }} - \frac{\overline{16 (\Delta ^{\star })^2 \ell }}{r} + \frac{i}{(4 \Delta ^{\star } r)^2 ( \frac{1}{X} - i \beta )} \right) , \end{aligned}$$

where \(\chi _{t}(\cdot )\) denotes a real Dirichlet character of modulus t. Finally whenever we write \(\frac{{\overline{a}}}{q}\) we denote by \({\overline{a}}\) an integer such that \({\overline{a}} a \equiv 1 \pmod {q}\).

Remark 2

By inspection of the proof below, the conclusion of the lemma also holds when \(v=0\) and we will use this later.

Proof

Since \(q = 4 \Delta r\) we can write

$$\begin{aligned} \frac{d}{q} + \frac{v}{\Delta } = \frac{d + 4 v r}{4 \Delta r} . \end{aligned}$$

Notice that \((d + 4 v r, 4 \Delta r) = (d + 4 v r, \Delta )\) since \((d, 4 r) = 1\) by assumption. Therefore the above is equal to

$$\begin{aligned} \frac{(4 v + b)^{\star } r + 4 \Delta ^{\star } \ell }{4 \Delta ^{\star } r}. \end{aligned}$$
(6.5)

Throughout set \(w := (4 v + b)^{\star } r + 4 \Delta ^{\star } \ell \). We now consider

$$\begin{aligned} z = - \frac{{\overline{w}}}{4 \Delta ^{\star } r} + \frac{i}{(4 \Delta ^{\star } r)^2 (\frac{1}{X} - i \beta )} \end{aligned}$$

and the matrix

$$\begin{aligned} \gamma = \begin{pmatrix} w &{} \star \\ 4 \Delta ^{\star } r &{} {\overline{w}} \end{pmatrix} \in \Gamma _0(4) \end{aligned}$$

where \(\star \) is uniquely determined by the choice of \({\overline{w}} \in {\mathbb {Z}}\). A slightly tedious computation using (6.5) reveals that

$$\begin{aligned} \gamma z = \left( \frac{d}{q} + \beta \right) + \frac{v}{\Delta } + \frac{i}{X}. \end{aligned}$$
(6.6)

We also find that

$$\begin{aligned} j_{\gamma }(z) = \frac{i}{\frac{4 \Delta ^{\star } r}{X} - i (4 \Delta ^{\star } r) \beta } = \frac{1}{4 \Delta ^{\star } r} \cdot \frac{i X}{1 - i X \beta } \end{aligned}$$
(6.7)

and that

$$\begin{aligned} \nu (\gamma ) = \overline{\varepsilon _{(4 v + b)^{\star }}} \cdot \left( \frac{4 \Delta ^{\star } r}{{\overline{w}}} \right) , \end{aligned}$$
(6.8)

where \(\left( \frac{\cdot }{\cdot } \right) \) denotes the extended quadratic residue symbol in the sense of Shimura [27, Notation 3]. In particular since \(4 \Delta ^{\star } r\) is divisible by four, this extended quadratic residue symbol coincides with \(\chi _{4 \Delta ^{\star } r}(w)\), a real Dirichlet character of modulus \(4 \Delta ^{\star } r\), so that \(\chi _{4 \Delta ^{\star } r}({\overline{w}}) = \chi _{4 \Delta ^{\star } r}(w)\). Moreover by multiplicativity of the Jacobi symbol

$$\begin{aligned} \chi _{4 \Delta ^{\star } r}(w) = \left( \frac{4 \Delta ^{\star } r}{w} \right) = \left( \frac{4 \Delta ^{\star }}{w} \right) \left( \frac{r}{w} \right) . \end{aligned}$$

Since \(4 \Delta ^{\star }\) is divisible by 4 and r is congruent to \(1 \pmod {4}\) both expressions are Dirichlet characters of modulus \(4 \Delta ^{\star }\) and modulus r respectively. In particular the above expression is equal to

$$\begin{aligned} \chi _{4 \Delta ^{\star }}(w) \chi _{r}(w) = \chi _{4 \Delta ^{\star }} ( ( 4 v + b)^{\star } r ) \chi _{r} (\Delta ^{\star } \ell ). \end{aligned}$$

Using the modularity of g, (6.2), and combining this with (6.6), (6.7), (6.8) we conclude that

$$\begin{aligned} g \left( \frac{d}{q} + \frac{v}{\Delta } + \beta + \frac{i}{X} \right)&= \overline{\varepsilon _{(4 v + b)^{\star }}} \chi _{4 \Delta ^{\star }} ( (4 v + b)^{\star } r ) \chi _{r} ( 4 \Delta ^{\star } \ell ) \cdot \left( \frac{X}{4 \Delta ^{\star } r} \right) ^{k+ \frac{1}{2}} \cdot \\&\quad \times \left( \frac{i}{1 - i X \beta } \right) ^{k + \frac{1}{2}} g \left( - \frac{{\overline{w}}}{4 \Delta ^{\star } r} + \frac{i}{(4 \Delta ^{\star } r)^2 \cdot ( \frac{1}{X} - i \beta )} \right) . \end{aligned}$$

Write \(({\overline{a}})_{b}\) for the inverse of a modulo b. Also, let \(a_1=(\overline{r \cdot (4 v + b)^{\star }})_{4 \Delta ^{\star }}\) and \(a_2=(\overline{4 \Delta ^{\star } \cdot \ell })_{r}\). Observe

$$\begin{aligned} ({\overline{w}})_{4\Delta ^{\star }r} \equiv a_1 \pmod {4\Delta ^{\star }} \quad \text { and } \quad ({\overline{w}})_{4\Delta ^{\star }r} \equiv a_2 \pmod {r}. \end{aligned}$$

So by the Chinese Remainder Theorem

$$\begin{aligned} ({\overline{w}})_{4 \Delta ^{\star } r} \equiv a_1 ({\overline{r}})_{4 \Delta ^{\star }} r + a_2 (\overline{4 \Delta ^{\star }})_{r} 4 \Delta ^{\star } \pmod {4 \Delta ^{\star } r}. \end{aligned}$$

It follows that

$$\begin{aligned} \frac{{\overline{w}}}{4 \Delta ^{\star } r} \equiv \frac{\overline{r^2 (4 v + b)^{\star }}}{4 \Delta ^{\star }} + \frac{\overline{16 (\Delta ^{\star })^2 \ell }}{r} \pmod {1} \end{aligned}$$

and since \(g(x + i y)\) is 1-periodic in x the claim follows. \(\square \)

We are now ready to prove the main proposition of this section.

Proof of Proposition 6.1

Using the circle method we can re-write the LHS of (6.1) as

$$\begin{aligned} \frac{1}{X^{k - \frac{1}{2}}} \left| \int _{0}^{1} g \left( \alpha + \frac{v}{\Delta } + \frac{i}{X} \right) g \left( - \alpha + \frac{i}{X} \right) e( - \alpha h) d \alpha \right| . \end{aligned}$$

Let \(Q = X^{1/2 + 2 \eta }\) and \(\eta \in (0, 1]\) to be determined later (we will choose \(\eta = \frac{1}{13}\)). Let \(1 \le \Delta \le X^{\eta / 4} \le Q^{\eta / 2}\). By Lemma 6.1 the above expression is equal to

(6.9)

plus an error term of size \(\ll X Q^{-\eta /4} \le X^{1 - \eta / 8}\), where in the estimation of the error term we have used the bound \( |g(\alpha +i/X)| \ll X^{\frac{k+\frac{1}{2}}{2}} \) which holds uniformly for all \(\alpha \in {\mathbb {R}}\). This follows from the fact that \(y^{(k+\frac{1}{2})/2}|g(z)|\) is bounded on \({\mathbb {H}}\) since g is a cusp form.

We now write \(q = 4 \Delta r\) with r a prime congruent to \(1 \pmod {4}\) and just as in Lemma 6.2 we write, \(d = (4 \Delta ) \ell + r b\) with \((\ell , r) = 1\) and \((b, 4 \Delta ) = 1\). Then by Lemma 6.2 and the triangle inequality, (6.9) is less than

(6.10)

where

(6.11)

and where we applied Lemma 6.2 with \(v = 0\) in second appearance of g. Notice now that for any \(q \ge 1\),

$$\begin{aligned} \frac{i}{q^2 \left( \frac{1}{X} - i \beta \right) } = \frac{i X}{q^2 \cdot |1 - i \beta X|^2} - \frac{X^2 \beta }{q^2 |1 - i \beta X|^2}. \end{aligned}$$

Moreover since \(|\beta X| \le Q^{-2 + \eta } X \le X^{-\eta }\) the imaginary part of the above expression is \((1 + o(1)) X / q^2\). Therefore expanding in Fourier coefficients we can write, for any \(\varepsilon > 0\),

$$\begin{aligned}&g\left( - \frac{\overline{r^2 (4 v + b)^{\star }}}{4 \Delta ^{\star }} - \frac{\overline{16 (\Delta ^{\star })^2 \ell }}{r} + \frac{i}{(4 \Delta ^{\star } r)^2 (\frac{1}{X} - i \beta )} \right) \nonumber \\&\quad = \sum _{n \le X^{\varepsilon } (4 \Delta ^{\star } r)^2 / X} \alpha (n;\beta ) n^{\frac{k - \frac{1}{2}}{2}} e \left( - \frac{n \overline{16 \Delta ^{\star } \ell }}{r} \right) + O(X^{-A}) \end{aligned}$$
(6.12)

for any \(A \ge 1\), where the coefficients \(\alpha (n;\beta )\) are independent of \(\ell \) and \(|\alpha (n;\beta )| \ll |c(m)| \ll _{\varepsilon } n^{1/2 + \varepsilon }\) for all \(\varepsilon > 0\) and \(\beta \in {\mathbb {R}}\) by (6.4). Similarly we have for every \(\varepsilon > 0\)

$$\begin{aligned}&g \left( \frac{\overline{r^2 b}}{4 \Delta } + \frac{\overline{16 \Delta ^2 \ell }}{r} + \frac{i}{(4 \Delta r)^2 \left( \frac{1}{X} + i \beta \right) } \right) \nonumber \\&\quad = \sum _{m \le X^{\varepsilon } (4 \Delta r)^2 / X} \gamma (m;\beta ) m^{\frac{k - \frac{1}{2}}{2}} e \left( \frac{m \overline{16 \Delta ^2 \ell }}{r} \right) + O(X^{-A}) \end{aligned}$$
(6.13)

for any \(A \ge 1\), where the coefficients \(\gamma (m;\beta )\) are independent of \(\ell \) and \(|\gamma (m;\beta )| \ll |c(n)| \ll _{\varepsilon } m^{1/2 + \varepsilon }\) for all \(\varepsilon > 0\) and \(\beta \in {\mathbb {R}}\).

Applying (6.12) and (6.13) in (6.11) it follows that

$$\begin{aligned} S \ll \int _{-Q^{- 2 + \eta }}^{Q^{-2 + \eta }} \sum _{\begin{array}{c} m \le X^{\varepsilon } (4 \Delta r)^2 / X \\ n \le X^{\varepsilon } (4 \Delta ^{\star } r)^2 / X \end{array}} \left| \alpha (n; \beta ) \gamma (m; \beta ) (m n)^{\frac{k - \frac{1}{2}}{2}} S(m \overline{16 \Delta ^2} - n \overline{16 (\Delta ^{\star })^2}, -h; r) \right| d \beta + X^{-100}, \end{aligned}$$

where S(abc) is the standard Kloosterman sum. Since \(0< |h| < r\) and r is prime the Weil bound shows that the Kloosterman sum above is always \(\ll \sqrt{r} \ll \sqrt{ \frac{Q}{\Delta }} \). Therefore, applying Cauchy–Schwarz along with (6.3) in the above equation it follows that

$$\begin{aligned} \begin{aligned} S \ll X^{\varepsilon } \cdot Q^{-2+\eta } \cdot \left( \frac{(4 \Delta r)^2 }{X}\right) ^{\frac{k+\frac{3}{2}}{2}} \cdot \left( \frac{(4 \Delta r)^2 }{X}\right) ^{\frac{k+\frac{3}{2}}{2}} \cdot \sqrt{ \frac{Q}{\Delta }} . \end{aligned} \end{aligned}$$

Also, recall that \(Q=X^{\frac{1}{2}+2\eta }\), \(\Delta \le X^{\eta /4}\) and \(L \gg \frac{Q^2}{\Delta X^{\varepsilon }}\). We conclude that (6.10) is

$$\begin{aligned} \ll \frac{X^{1+\varepsilon }}{L} \cdot \Delta \cdot \frac{Q}{\Delta } \cdot \frac{Q^2}{X} \cdot \sqrt{\frac{Q}{\Delta }} \ll X^{\frac{3}{4}+\frac{25 \eta }{8}+\varepsilon }. \end{aligned}$$

We also recall that when using Lemma 6.1 in (6.9) we introduced an error of size \(X^{1 - \eta / 8}\). Picking \(\eta = \frac{1}{13}\) gives a total error of size \(\ll X^{1 - \frac{1}{104} + \varepsilon }\) and allows \(\Delta \) to go up to \(X^{\frac{1}{52}}\). \(\square \)

6.2 Proof of Proposition 1.3

We are now ready to prove Proposition 1.3. Let h be the indicator function of the integers that can be written as 8n with n odd and square-free. We find that

$$\begin{aligned} h(n) = \sum _{\begin{array}{c} 2^{\alpha + 3} d^2 | n \\ d \text { odd} \end{array}} \mu (d) \mu (2^{\alpha }). \end{aligned}$$

Let

$$\begin{aligned} h_{\le Y}(n) = \sum _{\begin{array}{c} n = 2^{\alpha + 3} d^2 m \\ d \le Y, \alpha \le 1 \\ d \text { odd} \end{array}} \mu (d) \mu (2^{\alpha }) \ , \ h_{> Y}(n) = \sum _{\begin{array}{c} n = 2^{\alpha + 3} d^2 m \\ d > Y, \alpha \le 1 \\ d \text { odd} \end{array}} \mu (d) \mu (2^{\alpha }). \end{aligned}$$

By the triangle inequality,

$$\begin{aligned} \sum _{X \le x \le 2X} \left| \sum _{x \le n \le x + y} c(n) M((-1)^k n) h_{>Y }(n) \right| \le y \sum _{n \le 4 X} |c(n) M((-1)^k n) h_{> Y}(n)| \end{aligned}$$

and by the definition of \(h_{> Y}(n)\) this is

$$\begin{aligned} \ll y \sum _{\begin{array}{c} d > Y \\ d \text { odd} \end{array}} \sum _{\begin{array}{c} n \le 4 X \\ d^2 | n \end{array}} |c(n) M((-1)^k n)| . \end{aligned}$$
(6.14)

A trivial bound gives \(M((-1)^k n) \ll _{\varepsilon } M X^{\varepsilon }\). By Shimura’s result (3.3) and Deligne’s bound, \( |c(d^2 n)| \ll _{\varepsilon } d^{\varepsilon } |c(n)| \) for all \(\varepsilon > 0\). Hence, we conclude after an application of Cauchy–Schwarz and (6.3) that

$$\begin{aligned} \sum _{\begin{array}{c} n \le X \\ d^2 | n \end{array}} |c(n)| \ll _{\varepsilon } d^{\varepsilon } \sum _{n \le X / d^2} |c(n)| \ll _{\varepsilon } d^{\varepsilon } \cdot \left\lfloor \frac{X}{d^2} \right\rfloor . \end{aligned}$$

Therefore (6.14) is bounded by

$$\begin{aligned} \ll _{\varepsilon } y \left( \frac{X}{Y} + 1 \right) M X^{\varepsilon }. \end{aligned}$$

This contributes \(\ll X^{1 - \delta + \varepsilon }\) provided that \(Y \ge X^{\delta } M y\).

Therefore after an application of Cauchy–Schwarz, it remains to obtain a non-trivial upper bound for

$$\begin{aligned} \sum _{X \le x \le 2 X} \left| \sum _{x \le n \le x + y} c(n) M((-1)^k n) h_{\le Y}(n) \right| ^2 . \end{aligned}$$

We introduce an auxiliary smoothing, and bound the above by

$$\begin{aligned} \ll \sum _{x \ge 1} \left| \sum _{x \le n \le x + y} c(n) M((-1)^k n) h_{\le Y}(n) \right| ^2 f \left( \frac{x}{ X}\right) ^2 \end{aligned}$$

where

$$\begin{aligned} f(u) = \exp (- 2\pi u) u^{\frac{k - 1/2}{2}}. \end{aligned}$$

We note that the implicit constant is allowed to depend on the weight \(k + \frac{1}{2}\). Let \(\alpha (n) = c(n) M((-1)^k n) h_{\le Y}(n)\). Expanding the square we re-write the above expression as

$$\begin{aligned} \sum _{0 \le h_1, h_2 \le y} \sum _{n \ge 1} \alpha (n + h_1) \alpha (n + h_2) f\left( \frac{n}{X} \right) ^2. \end{aligned}$$

Grouping terms together and using a Taylor expansion we can re-write the above as

$$\begin{aligned} \begin{aligned}&\sum _{\begin{array}{c} |h| \le y \end{array}} \sum _{\begin{array}{c} n \ge 1 \end{array}} \alpha (n) f\left( \frac{n}{X} \right) \alpha (n + h) f\left( \frac{n + h}{ X} \right) \sum _{\begin{array}{c} 0 \le h_1,h_2 \le y \\ h_1-h_2=h \end{array}} \left( 1+O\left( \frac{y}{n}+\frac{y}{X} \right) \right) + O(1) \\&\quad = \sum _{|h| \le y} (y + 1 - |h|) \sum _{n \ge 1} \alpha (n) f \left( \frac{n}{X} \right) \alpha (n + h) f \left( \frac{n + h}{X} \right) +O\left( y^3 M^2 X^{\varepsilon } \right) \end{aligned} \end{aligned}$$
(6.15)

where we set \(\alpha (n) := 0\) for \(n \le 0\) and where we used (6.3) in the estimation of the error term. The term \(h = 0\) contributes

$$\begin{aligned} \ll y \sum _{n \ge 1} |c(n) h_{\le Y}(n) M((-1)^k n)|^2 \cdot f \left( \frac{n}{X} \right) ^2 \end{aligned}$$
(6.16)

Repeating the same argument as before we see that

$$\begin{aligned} y \sum _{n \ge 1} |c(n) h_{> Y}(n) M((-1)^k n)|^2 \cdot f \left( \frac{n}{X} \right) ^2 \ll _{\varepsilon } y \left( \frac{X}{Y} + 1 \right) X^{\varepsilon } M^2. \end{aligned}$$

This gives a total contribution of \(\ll X^{1 - \delta +\varepsilon }\) provided that \(Y > X^{\delta } M^2 y\). It follows that (6.16) is bounded by

$$\begin{aligned} \ll y \sum _{\begin{array}{c} n \text { odd} \end{array}} \mu ^2(n) |c(8 n) M((-1)^k 8 n)|^2 \cdot f \left( \frac{n}{X} \right) ^2 +X^{1-\delta +\varepsilon } \end{aligned}$$

as needed.

We now focus on the terms with \(h\ne 0\) in (6.15). Opening \(h_{\le Y}\) and \(M((-1)^k n)\) we see that the RHS of (6.15) restricted to \(h \ne 0\) is bounded by

$$\begin{aligned}&\ll _{\varepsilon } y^2 M^2 Y^2 X^{\varepsilon } \\&\times \sup _{\begin{array}{c} 0 < |h| \le y \\ d_1, d_2 \le Y \\ \alpha _1, \alpha _2 \in \{0, 1\} \\ m_1, m_2 \le M \end{array}} \left| \sum _{\begin{array}{c} d_1^2 2^{\alpha _1 + 3} | n \\ d_2^2 2^{\alpha _2 + 3} | n + h \end{array}} c(n) \chi _{(-1)^k n}(m_1) f \left( \frac{n}{X} \right) c(n + h) \chi _{(-1)^k (n + h)}(m_2) f \left( \frac{n + h}{X} \right) \right| . \end{aligned}$$

By the Chinese Remainder Theorem the condition \(2^{\alpha _1 + 3} d_1^2 | n\) and \(2^{\alpha _2 + 3} d_2^2 | n + h\) can be re-written as a single congruence condition to a modulus of size \(\le 4 Y^4\). Moreover \(\chi _{(-1)^k n}(m_1)\) is \(4m_1\)-periodic in n, where-as \(\chi _{(-1)^k (n + h)}(m_2)\) is \(4m_2\)-periodic in n. Therefore fixing the congruence class of n modulo \(4 [m_1, m_2]\) fixes the value of \(\chi _{(-1)^k n}(m_1) \chi _{(-1)^k (n +h)}(m_2)\). Therefore we can bound the above supremum by

$$\begin{aligned} \sup _{\begin{array}{c} 0 < |h| \le y \\ 1 \le \Delta \le 4 Y^4 M^2 \\ \gamma \pmod {\Delta } \end{array}} \left| \sum _{n \equiv \gamma \pmod {\Delta }} c(n) f \left( \frac{n}{X} \right) c(n + h) f \left( \frac{n + h}{X} \right) \right| . \end{aligned}$$
(6.17)

Finally, we can write

$$\begin{aligned} {\mathbf {1}}_{n \equiv \gamma \pmod {\Delta }} = \frac{1}{\Delta } \sum _{0 \le v < \Delta } e \left( \frac{v n}{\Delta } \right) e \left( - \frac{v \gamma }{\Delta } \right) . \end{aligned}$$

Plugging this into (6.17) we see that it is

$$\begin{aligned} \le \sup _{\begin{array}{c} 0 < |h| \le y \\ 1 \le \Delta \le 4 Y^4 M^2 \\ v \pmod {\Delta } \end{array}} \left| \sum _{n \ge 1} c(n) e \left( \frac{n v}{\Delta } \right) f \left( \frac{n}{X} \right) c(n + h) f \left( \frac{n + h}{X} \right) \right| \end{aligned}$$

and without loss of generality we can also assume that \((v, \Delta ) = 1\). It follows that the RHS of (6.15) restricted to \(h \ne 0\) is bounded by

$$\begin{aligned} \ll _{\varepsilon } X^{\varepsilon } \cdot y^2 M^2 Y^2 \sup _{\begin{array}{c} 0 < |h| \le y \\ 1 \le \Delta \le 4 Y^4 M^2 \\ (v, \Delta ) = 1 \end{array}} \left| \sum _{n \ge 1} c(n) e \left( \frac{n v}{\Delta } \right) f\left( \frac{n}{X} \right) c(n + h) f \left( \frac{n + h}{X} \right) \right| . \end{aligned}$$

According to Proposition 6.1 the above expression is \(\ll _{\varepsilon } y^2 M^2 Y^2 X^{1 - \frac{1}{104} + \varepsilon }\) provided that \(4 Y^4 M^2 \le X^{\frac{1}{52}}\). Moreover we introduced earlier error terms that were \(\ll _{\varepsilon } X^{1 - \delta / 2 + \varepsilon }\) as long as \(Y \ge y X^{\delta } M\). Choosing \(Y = y X^{\delta } M\) we obtain the restriction \(y^4 X^{4 \delta } M^6 \le X^{\frac{1}{52}}\). We also decide to require that \(y^2 M^2 Y^2 X^{1 - \frac{1}{104}} \le X^{1 - \delta / 2}\) which gives \(y^2 M^2 Y^2 X^{\delta / 2} \le X^{\frac{1}{104}}\) and in particular \(y^4 X^{5 \delta / 2} M^4 \le X^{\frac{1}{104}}\). We posit (somewhat arbitrarily) that we will require \(y, M \le X^{\delta }\). In that case the previous two conditions are verified if \(X^{21 \delta / 2} \le X^{\frac{1}{104}}\) and if \(X^{14 \delta } \le X^{\frac{1}{52}}\). This leads to the choice of \(\delta = \frac{1}{1092}\), implying the restriction \(y, M \le X^{\frac{1}{1092}}\) and giving an error term of \(\ll X^{1 - \frac{1}{2148}}\).