1 Introduction and notation

Let \({\mathbb {N}}\), \({\mathbb {N}}_0\), \({\mathbb {Z}}\), \({\mathbb {Q}}\), \({\mathbb {C}}\), and \({\mathbb {H}}\) denote the sets of positive integers, non-negative integers, integers, rational numbers, complex numbers, and upper half-plane of complex numbers, respectively. Throughout the paper, z denotes a complex number in \({\mathbb {H}}\), p always denotes a prime number, all divisors considered are positive divisors, q stands for \(e^{2 \pi i z}\), and \(\chi _d(n)\) denotes the Kronecker symbol \(\displaystyle {\Bigl ({\frac{d}{n}}\Bigr )_{K} }\), where we use the subscript K to avoid confusion with fractions. Let \(N \in {\mathbb {N}}\) and \(\chi \) be a Dirichlet character modulo N. The space of modular forms of weight k for \(\Gamma _0(N)\) with character \(\chi \) is denoted by \(M_{k}(\Gamma _0(N),\chi )\); and \(E_{k}(\Gamma _0(N),\chi )\), \(S_{k}(\Gamma _0(N),\chi )\) denote its Eisenstein and cusp form subspaces, respectively. Then we have

$$\begin{aligned} M_k(\Gamma _0(N),\chi ) = E_k(\Gamma _0(N),\chi ) \oplus S_k(\Gamma _0(N),\chi ). \end{aligned}$$

That is, given \(f(z) \in M_k(\Gamma _0(N),\chi )\), we can write

$$\begin{aligned} f(z)=E_f(z) + S_f(z), \end{aligned}$$
(1)

where \(E_f(z) \in E_k(\Gamma _0(N),\chi )\) and \(S_f(z) \in S_k(\Gamma _0(N),\chi )\) are uniquely determined by f. Let \( \epsilon , \psi \) be primitive Dirichlet characters such that \(\epsilon {\psi } = \chi \) (i.e., \(\epsilon (n) {\psi }(n) = \chi (n)\) for all \(n \in {\mathbb {Z}}\) coprime to N) with conductors say L and M, respectively, and suppose \({LM} \mid N \). Let d be a positive divisor of N/LM and \(2\le k \in {\mathbb {N}}\) be such that \(\chi (-1)=(-1)^k\). Let \(\omega \) be the primitive Dirichlet character corresponding to \(\epsilon {\overline{\psi }}\) and \({\mathcal {M}}_\omega \) be its conductor. We define the Eisenstein series associated with \(\epsilon \) and \({\psi }\) by

$$\begin{aligned} {E_{k}(\epsilon ,\psi ; dz)} :=&\epsilon (0)+ \left( \frac{{\mathcal {M}}_\omega }{M } \right) ^k \left( \frac{ W({\overline{\psi }})}{W(\omega )} \right) \left( \frac{-2k}{B_{k,{\overline{\omega }}}} \right) \prod _{p \mid {{\,\mathrm{lcm}\,}}(L,M)} \frac{p^k}{p^k-\omega (p)}\nonumber \\&\quad \times \sum _{n =1}^{\infty } \sigma _{k-1}(\epsilon , {\psi }; n) e^{2\pi i n d z} , \end{aligned}$$
(2)

where \({\overline{\omega }}\) is the complex conjugate of \(\omega \),

$$\begin{aligned}&\sigma _{k-1}(\epsilon ,\psi ; n) := \sum _{1 \le d\mid n}\epsilon (n/d){\psi }(d)d^{k-1} \end{aligned}$$

is the generalized sum of divisors function associated with \(\epsilon \) and \(\psi \),

$$\begin{aligned}&W(\psi ) := \sum _{a=0}^{M-1} \psi (a) e^{2\pi i a/M} \end{aligned}$$

is the Gauss sum of \(\psi \), and \(B_{k,{\overline{\omega }}}\) is the k-th generalized Bernoulli number associated with \({\overline{\omega }}\) defined by

$$\begin{aligned} \sum _{k = 0}^\infty \frac{B_{k,{\overline{\omega }}}}{k !} t^k = \sum _{a=1}^{{\mathcal {M}}_{{\overline{\omega }}}} \frac{{{\overline{\omega }}}(a) t e^{at}}{e^{{\mathcal {M}}_{{{\overline{\omega }}}} t } -1}, \end{aligned}$$

see [13, end of pg. 94]. By [5, Corollary 8.5.5] (alternatively [13, Theorem 4.7.1, (7.1.13) and Lemma 7.2.19]), we have

$$\begin{aligned} E_{k}(\epsilon ,\psi ; dz ) \in M_k(\Gamma _0(N),\chi )&\text{ if } (k, \epsilon ,\psi ) \ne (2,\chi _1,\chi _1), \end{aligned}$$

and

$$\begin{aligned} E_{2}(\chi _1,\chi _1;z) - N E_{2}(\chi _1,\chi _1;Nz) \in M_2(\Gamma _0(N),\chi _1). \end{aligned}$$

Remark 1

Let \(L(\epsilon {\overline{\psi }}, k)\) be the Dirichlet L-function defined by

$$\begin{aligned} L(\epsilon {\overline{\psi }}, k):= \sum _{n \ge 1} \frac{\epsilon (n) {\overline{\psi }}(n)}{ n^{k}}. \end{aligned}$$

The Eisenstein series we define in (2) is equal to \(\displaystyle {E_k(Mdz;\epsilon ,{\overline{\psi }})}/({2 L(\epsilon {\overline{\psi }}, k)})\) in the notation of Theorem 7.1.3 and Theorem 7.2.12 of [13], and it is also equal to \(\displaystyle {G_k({\psi },\epsilon )(dz)}/{L(\epsilon {\overline{\psi }}, k)}\) in the notation of Corollary 8.5.5 and Definition 8.5.10 of [5]. Further treatment to obtain the form in (2) is done by using the formula for \(L(\epsilon {\overline{\psi }}, k)\) given in Theorems 3.3.4 and (3.3.14) of [13]. We have normalized the Eisenstein series this way to simplify the constant terms given in (27) and (28). This in return simplifies the notation in Sects. 4 and 5.

Letting \(D(N,{\mathbb {C}})\) to denote the group of Dirichlet characters modulo N, we define

$$\begin{aligned} {\mathcal {E}}(k,N,\chi ):= \{ (\epsilon ,\psi ) \in D(L,{\mathbb {C}})&\times D(M,{\mathbb {C}}) : \epsilon , \psi \text{ primitive, } \\&\quad \epsilon {\psi } = \chi \text{ and } LM \mid N \}. \end{aligned}$$

The set

$$\begin{aligned}&\{ E_{k}(\epsilon ,\psi ; dz) : (\epsilon ,\psi ) \in {\mathcal {E}}(k,N,\chi ), d \mid N/LM \} \end{aligned}$$

constitutes a basis for \(E_k(\Gamma _0(N),\chi )\) whenever \(k \ge 2\) and \((k,\chi ) \ne (2,\chi _1)\); the set

$$\begin{aligned}&\{ E_{2}(\chi _1,\chi _1;z )-d E_{2}(\chi _1,\chi _1;dz) : 1< d \mid N\} \\&\qquad \cup \{ E_{2}(Mdz; \epsilon ,\psi ) : (\epsilon ,\psi ) \in {\mathcal {E}}(2,N,\chi _1), (\epsilon ,\psi ) \ne ( \chi _1,\chi _1), d \mid N/LM \} \end{aligned}$$

constitutes a basis for \(E_2(\Gamma _0(N),\chi _1)\), see [5, Theorems 8.5.17 and 8.5.22], or [22, Proposition 5]. Then we have

$$\begin{aligned} E_f(z) = \sum _{(\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ) } \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) E_k(\epsilon ,\psi ;dz), \end{aligned}$$
(3)

for some \(a_f(\epsilon ,\psi ,d) \in {\mathbb {C}}\). When \(S_f(z)=0\), it is easy to determine \(a_f(\epsilon ,\psi ,d)\) by comparing the first few Fourier coefficients of f(z) expanded at \(i \infty \) and the first few Fourier coefficients of the right-hand side of (3) expanded at \(i \infty \). However, if \(S_f(z)\ne 0\) and an explicit basis for \(S_k(\Gamma _0(N),\chi )\) is not known then this method fails. In this paper we solve this problem, in other words we obtain \(a_f(\epsilon ,\psi ,d)\) explicitly (in terms of a finite sum) for all \(f \in M_k(\Gamma _0(N),\chi )\), where \(k \ge 2\), see Theorem 1. Our treatment is general and its special cases agree with the previously known formulas. Additionally, we give a new treatment of Siegel’s formula for representation numbers of quadratic forms, see Theorem 2.

Let \(a \in {\mathbb {Z}}\) and \(c \in {\mathbb {N}}_0\) be coprime. For an \(f(z) \in M_{k}(\Gamma _0(N),\chi )\), we denote the constant term of f(z) in the Fourier expansion of f(z) at the cusp a/c by

$$\begin{aligned}{}[0]_{a/c} f = \lim _{z \rightarrow i \infty } (c z + d)^{-k} f \left( \frac{az+b}{cz+d} \right) , \end{aligned}$$

where \(b,d \in {\mathbb {Z}}\) such that \(\begin{bmatrix} a &{} b \\ c &{} d \end{bmatrix} \in SL_2({\mathbb {Z}})\). The value of \([0]_{a/c} f \) does not depend on the choice of bd. We denote the nth Fourier coefficient of f(z) in the expansion at the cusp \(i\infty \) by [n]f. Letting \(\phi (n)\) denote the Euler totient function, we define an average associated with \(\psi \) for the constant terms of Fourier series expansions of modular forms at cusps as follows:

$$\begin{aligned}{}[0]_{c,{\psi }}f := \frac{1}{\phi (c)} \sum _{\begin{array}{c} a =1,\\ \gcd (a,c)=1 \end{array} }^c {\psi }(a)[0]_{a/c}f. \end{aligned}$$
(4)

We note that working with this average of constant terms at cusps is a new idea which helps studying modular form spaces with non-trivial character, see Sect. 5 for details.

Letting \(v_p(n)\) to denote the highest power of p dividing n and \(\mu (n)\) be the Möbius function we are ready to state the main theorem.

Theorem 1

(Main Theorem) Let \(f(z) \in M_k(\Gamma _0(N),\chi )\), where \(N,k \in {\mathbb {N}}\), \(k \ge 2\), \(\chi \) is a Dirichlet character modulo N that satisfies \(\chi (-1)=(-1)^k\). Let \(E_f(z)\) be defined by (1). Then

$$\begin{aligned} E_f(z) = \sum _{(\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ) } \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) E_k(\epsilon ,\psi ;dz), \end{aligned}$$

where

$$\begin{aligned} a_f(\epsilon ,\psi ,d) =&\prod _{p \mid N} \frac{p^k}{p^k - \epsilon (p) {\overline{\psi }}(p)}\\&\times \sum _{c \in C_{N}(\epsilon ,\psi ) } {\mathcal {R}}_{k,\epsilon ,\psi }(d,c/M) {\mathcal {S}}_{k,N/LM,\epsilon ,\psi }(d,c/M) [0]_{c,{\psi }}f, \end{aligned}$$

with

$$\begin{aligned} C_{N}(\epsilon ,\psi )&:= \{ c_1 M : c_1 \mid N/LM\}, \end{aligned}$$
(5)
$$\begin{aligned} {\mathcal {R}}_{k,\epsilon ,\psi }(d,c)&:= \epsilon \left( \frac{-d}{\gcd (d,c)} \right) {\overline{\psi }} \left( \frac{c}{\gcd (d,c)} \right) \left( \frac{\gcd (d,c)}{c} \right) ^k, \end{aligned}$$
(6)

and

$$\begin{aligned} {\mathcal {S}}_{k,N,\epsilon ,\psi }(d,c)&:= \mu \left( \frac{dc}{\gcd (d,c)^2} \right) \prod _{\begin{array}{c} p \mid \gcd (d,c),\\ 0<v_p(d)=v_p(c)<v_p(N) \end{array}} \left( \frac{p^k +\epsilon (p) {\overline{\psi }}(p)}{p^k} \right) . \end{aligned}$$
(7)

Remark 2

Let \(c \mid N\). By Lemma 6, if a/c and \(a'/c\) are equivalent cusps of \(\Gamma _0(N)\) and \((\epsilon ,\psi ) \in {\mathcal {E}}(k,N,\chi )\) with \(M \mid c\), then \( \psi (a)[0]_{a/c} f =\psi (a')[0]_{a'/c} f\). Therefore, in the applications of Theorem 1 computing \( \psi (a)[0]_{a/c} f\) at a set of inequivalent cusps will be sufficient, see [5, Corollary 6.3.23] for a description of such a set.

Theorem 1 agrees with and extends the previously known formulas. For example, if we let \(k \in {\mathbb {N}}\) even, N squarefree, \(\chi =\chi _1\) in Theorem 1, we obtain [3, Theorem 1.1] and if we let \(k \in {\mathbb {N}}\) odd \(N \in \{3,7,11,23 \}\), \(\chi =\chi _{-N}\) in Theorem 1, we obtain [6, (11.20)]. Theorem 1 additionally extends the latter to hold for all primes N that are congruent to 3 modulo 4.

Before we apply Theorem 1 to representation numbers of quadratic forms, we give a snapshot of interesting applications. Since \(f(z) -E_f(z)\) is a cusp form, one can use our main theorem to produce cusp forms. At the end of Sect. 3 we use this idea combined with the Modularity Theorem ( [9, Theorem 8.8.1]) and consider the elliptic curve \(E_{27A}: y^2 + y=x^3 - 7\). Then we use arithmetic properties of Eisenstein series to obtain

$$\begin{aligned} \# E_{27A}({\mathbb {F}}_p)&\equiv 0 \pmod {9} \text{ if } p \equiv 1 \pmod {3}, \\ \# E_{27A}({\mathbb {F}}_p)&= p+1 \text{ if } p \equiv 2 \pmod {3}, \end{aligned}$$

where

$$\begin{aligned} E_{27A}({\mathbb {F}}_p):= \{ \infty \} \cup \{ (x,y) \in {\mathbb {F}}_p \times {\mathbb {F}}_p : y^2 + y=x^3 - 7 \}, \end{aligned}$$

with \({\mathbb {F}}_p\) denoting the finite field of p elements, see Corollary 3.

The Fourier coefficients of special functions (expanded at \(i \infty \)) have been of huge interest. A very well studied special function is the Dedekind eta function which is defined by

$$\begin{aligned} \eta (z):=e^{\pi i z/12} \prod _{n \ge 1} (1-e^{2 \pi i n z})=q^{1/24} \prod _{n \ge 1} (1-q^{n}). \end{aligned}$$

Quotients of Dedekind eta functions are often referred to as eta quotients. Nathan Fine in his book [10] has given several formulas for Fourier coefficients of eta quotients (expanded at \(i \infty \)). In his work when the weight of the eta quotient is an integer, the formulas are linear combinations of Eisenstein series defined above. For instance he shows that

$$\begin{aligned} F(z):=\frac{\eta (2z)\eta (3z)\eta (8z)\eta (12z)}{\eta (z)\eta (24z)}=1+ \sum _{n \ge 1} \sigma _{0}(\chi _1,\chi _{-24};n) q^n, \end{aligned}$$

see [10, (32.5)], and acknowledges this equation as being very beautiful. We consider the \((2k+1)\)th power of F(z), that is we consider

$$\begin{aligned} F^{2k+1}(z)=\frac{\eta ^{2k+1}(2z)\eta ^{2k+1}(3z)\eta ^{2k+1}(8z)\eta ^{2k+1}(12z)}{\eta ^{2k+1}(z)\eta ^{2k+1}(24z)}. \end{aligned}$$

Using our main theorem (Theorem 1), we obtain the following analogous formula for \(F^{2k+1}(z)\) when \(k > 0\):

$$\begin{aligned} E_{F^{2k+1}}(z)&=1 - \frac{2k+1}{B_{{2k+1},\chi _{-24}}} \sum _{n \ge 1} \left( \sigma _{{2k}}(\chi _1,\chi _{-24};n) + (-24)^{k} \sigma _{{2k}}(\chi _{-24},\chi _1;n) \right) q^n, \end{aligned}$$

see Corollary 2. Using Theorem 1 one can obtain formulas in this fashion for all holomorphic eta quotients of integral weight \(k \ge 2\).

Let \({\mathcal {F}}(x_1,\ldots ,x_{2k})\) be a positive definite quadratic form with integer coefficients and \(B({\mathcal {F}})\) be the matrix associated with \({\mathcal {F}}\) whose entries are given by

$$\begin{aligned} B({\mathcal {F}})_{i,j}=\left( \frac{\partial ^2 {\mathcal {F}}}{\partial x_i \partial x_j} \right) . \end{aligned}$$

Then the generating function of the number of representations of a positive integer by the quadratic form \({\mathcal {F}}\) is

$$\begin{aligned} \theta _{\mathcal {F}}(z) = \sum _{x \in {\mathbb {Z}}^{2k}}e^{ 2 \pi i z {\mathcal {F}}(x) } = \sum _{x \in {\mathbb {Z}}^{2k}}e^{ 2 \pi i z x B({\mathcal {F}}) x^{T}/2 }. \end{aligned}$$

In [19], Siegel gave a formula for the weighted average for representation numbers of positive definite quadratic forms in the same genus. Siegel’s formula is in terms of local densities (for other treatments of Siegel’s formula see [23] and [15, Chapter 3]). In the realm of modular forms, Siegel’s formula corresponds to the Eisenstein part of \(\theta _{\mathcal {F}}(z)\), see [1, 17, 18, Remark on p. 110] and [19]. For clarity we note that if \({\mathcal {F}}_1\) and \({\mathcal {F}}_2\) are in the same genus then \(E_{\theta _{{\mathcal {F}}_1}}(z) = E_{\theta _{{\mathcal {F}}_2}}(z)\). Below we use Theorem 1 to give an explicit formula for \(E_{\theta _{{\mathcal {F}}}}(z)\), where \({\mathcal {F}}\) is a 2k–ary positive definite quadratic form with integer coefficients. In Sect. 2, we give several applications of our formula including a comparison of our output for the form \(\sum _{j=1}^{2k} x_j^2\) with that of Arenas [1, Proposition 1], which uses Siegel’s formula.

By [13, Corollary 4.9.5], we have

$$\begin{aligned} \theta _{\mathcal {F}}(z) \in M_{k}(\Gamma _0(N),\chi ), \end{aligned}$$
(8)

where \(\displaystyle \chi =({(-1)^k \det (B({\mathcal {F}}))}/{*})_{K}\) and N is the smallest positive integer such that the matrix \(NB({\mathcal {F}})^{-1}\) has even diagonal entries. By [21, (10.2)] we have

$$\begin{aligned}{}[0]_{a/c} \theta _{\mathcal {F}}(z)= \left( \frac{-i}{c} \right) ^k \frac{1}{\sqrt{\det (B({\mathcal {F}}))}} \sum _{\begin{array}{c} x \in {\mathbb {Z}}^{2k},\\ x \pmod {c} \end{array}} e^{ 2 \pi i ({\mathcal {F}}(x) a/c)}. \end{aligned}$$
(9)

Putting (2), (8), and (9) in Theorem 1, we obtain the following assertion concerning the representation numbers of 2k–ary quadratic forms.

Theorem 2

Let \({\mathcal {F}}(x_1,\ldots ,x_{2k})\) be a positive definite quadratic form with \(k \ge 2\); let \(\chi \) and N be as above and \(\omega \) be as in (2). Then

$$\begin{aligned}{}[n] E_{\theta _{\mathcal {F}}}(z)&= \sum _{(\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ) } \left( \frac{{\mathcal {M}}_\omega }{M } \right) ^k \left( \frac{ W({\overline{\psi }})}{W(\omega )} \right) \left( \frac{-2k}{B_{k,{\overline{\omega }}}} \right) \prod _{p \mid {{\,\mathrm{lcm}\,}}(L,M)} \frac{p^k}{p^k-\omega (p)} \nonumber \\&\qquad \qquad \qquad \times \sum _{d \mid N/LM} a_{\theta _{\mathcal {F}}}(\epsilon ,\psi ,d) \sigma _{k-1}(\epsilon , {\psi }; n/d) , \end{aligned}$$
(10)

where

$$\begin{aligned} a_{\theta _{\mathcal {F}}}(\epsilon ,\psi ,d) =&\frac{(-i)^k}{\sqrt{\det (B({\mathcal {F}}))}} \prod _{p \mid N} \frac{p^k}{p^k - \epsilon (p) {\overline{\psi }}(p)} \\&\times \sum _{c \in C_{N}(\epsilon ,\psi ) } \frac{ {\mathcal {R}}_{k,\epsilon ,\psi }(d,c/M) {\mathcal {S}}_{k,N/LM,\epsilon ,\psi }(d,c/M)}{c^k \phi (c)}\\ {}&\times \sum _{ \begin{array}{c} a=1,\\ \gcd (a,c)=1 \end{array}}^c {\psi }(a) \sum _{\begin{array}{c} x \in {\mathbb {Z}}^{2k},\\ x \pmod {c} \end{array}} e^{ 2 \pi i ({\mathcal {F}}(x) a/c)}. \end{aligned}$$

The organization of the rest of the paper is as follows. In Sect. 2, we apply Theorem 2 to the representation numbers of diagonal quadratic forms and certain non-diagonal level 2 quadratic forms. A special case of the latter leads to an equation for Ramanujan’s \(\tau \)-function. In Sect. 3, we apply our Main Theorem to certain families of eta quotients, these applications give extensions of some well-known formulas to higher weight eta quotients. In Sects. 46, we prove the main theorem.

2 Applications to representation numbers of certain quadratic forms

To apply (10) to specific quadratic forms we need to compute the quadratic Gauss sum. If \({\mathcal {F}}\) is a diagonal form, say \({\mathcal {F}}=\sum _{j=1}^{2k} \alpha _j x_j^2\), then we have

$$\begin{aligned} \sum _{\begin{array}{c} x \in {\mathbb {Z}}^{2k},\\ x \pmod {c} \end{array}} e^{2 \pi i {\mathcal {F}}(x)a/c} = \prod _{j=1}^{2k} \gcd (\alpha _j a,c) g\left( \frac{\alpha _j a}{\gcd (\alpha _j a,c)},\frac{c}{\gcd (\alpha _j a,c)} \right) , \end{aligned}$$
(11)

where, if \(\gcd (\alpha , \beta )=1\),

$$\begin{aligned} g(\alpha , \beta )= {\left\{ \begin{array}{ll} 0 &{} \text{ if } \beta \equiv 2 \pmod {4}, \\ {\Bigl ({\frac{\alpha }{\beta }}\Bigr )_{K} } \sqrt{\beta } &{} \text{ if } \beta \equiv 1 \pmod {4},\\ i {\Bigl ({\frac{\alpha }{\beta }}\Bigr )_{K} } \sqrt{\beta } &{} \text{ if } \beta \equiv 3 \pmod {4},\\ (1+i) {\Bigl ({\frac{\beta }{\alpha }}\Bigr )_{K} } \sqrt{\beta } &{} \text{ if } \beta \equiv 0 \pmod {4} \text { and }\alpha \equiv 1 \pmod {4},\\ (1- i) {\Bigl ({\frac{\beta }{\alpha }}\Bigr )_{K} } \sqrt{\beta } &{} \text{ if } \beta \equiv 0 \pmod {4} \text { and }\alpha \equiv 3 \pmod {4}, \end{array}\right. } \end{aligned}$$

see [4, Theorems 1.5.2 and 1.5.4]. Next we apply this result to the form \({\mathcal {F}}=\sum _{j=1}^{2k} x_j^2\), that is, \(\alpha _j=1\) for all \(1 \le j \le 2k\). Then we have

$$\begin{aligned} \sum _{\begin{array}{c} x \in {\mathbb {Z}}^{2k},\\ x \pmod {c} \end{array}} e^{2 \pi i {\mathcal {F}}(x)/c}=\prod _{i=1}^{2k} g\left( 1,c \right) = {\left\{ \begin{array}{ll} 1 &{} \text{ if } c=1,\\ 0 &{} \text{ if } c=2,\\ (8i)^{k} &{} \text{ if } c=4. \end{array}\right. } \end{aligned}$$

Thus, by Theorem 2 when k is even we have

$$\begin{aligned} E_{\theta _{{\mathcal {F}}}}(z) =&1- \frac{2k}{(2^k-1)B_{k,\chi _1}} \sum _{n \ge 1} \left( (-i)^k \sigma (\chi _1,\chi _1;n) - (i^k+1) \sigma (\chi _1,\chi _1;n/2) \right. \nonumber \\&\left. + 2^k \sigma (\chi _1,\chi _1;n/4) \right) q^n \end{aligned}$$
(12)

and when k is odd we have

$$\begin{aligned} E_{\theta _{{\mathcal {F}}}}(z)= 1- \frac{2k}{B_{k,\chi _{-4}}} \sum _{n \ge 1} \left( \sigma (\chi _1,\chi _{-4};n) + (2i)^{k-1} \sigma (\chi _{-4},\chi _1;n) \right) q^n. \end{aligned}$$
(13)

Formulas (12) and (13) agree with Ramanujan’s statements [16, (131)–(134)], which was first proven by Mordell in [14]. In [1, Proposition 1] Arenas uses Siegel’s formula to compute \(E_{\theta _{{\mathcal {F}}}}(z)\) and obtains (12) and (13) in the same form. Now, we turn our attention to another diagonal form. Let

$$\begin{aligned} {\mathcal {F}}(a,b;p)=\sum _{i=1}^{a} x_i^2 + \sum _{i=1}^{b} p y_i^2. \end{aligned}$$

In [7] Cooper, Kane, and Ye found formulas for the representation numbers of \({\mathcal {F}}(k,k;p)\), where \(p=3,7,11\), or 23. Their result relies on the existence of a Hauptmodul in the levels considered. Inspired by their results, in [2], we derived formulas for the representation numbers of \({\mathcal {F}}(2a,2b;p)\) where \(a,b \in {\mathbb {N}}_0\) and p is an odd prime. These results are considered as analogs of the Ramanujan–Mordell formula and specialized version of Theorem 2 agrees with these results. Below we give formulas in all the remaining cases, that is, we find formulas for representation numbers of \({\mathcal {F}}(a,b;p)\) where \(a,b \equiv 1 \pmod {2}\) and p an odd prime.

Corollary 1

Let \(a,b \ge 1\) be odd integers such that \(a+b \ge 4\). Set \(k=(a+b)/2\) and \({\mathbf {p}}=\chi _{-4}(p) p\). Then for any odd prime p, whenever \((-1)^k = \chi _{-4}(p)\) we have

$$\begin{aligned}&E_{\theta _{{\mathcal {F}}(a,b;p)}}(z) = 1\\&\,\,+ \sum _{n =1}^{\infty } \frac{2k \left( a_1 \sigma _{k-1}(\chi _1,\chi _{{\mathbf {p}}}; n) + a_2 \sigma _{k-1}(\chi _1,\chi _{{\mathbf {p}}}; n/2) + a_3 2^{k} \sigma _{k-1}(\chi _1,\chi _{{\mathbf {p}}}; n/4) \right) }{({2^k - \chi _{{\mathbf {p}}}(2)}) B_{k,\chi _{{\mathbf {p}}}} } q^{ n }\\&\,\, + \sum _{n =1}^{\infty } \frac{p^{(a-1)/2} 2k\left( a_4 \sigma _{k-1}(\chi _{{\mathbf {p}}},\chi _{1}; n) + a_5 \sigma _{k-1}(\chi _{{\mathbf {p}}},\chi _{1}; n/2) + a_6 2^k \sigma _{k-1}(\chi _{{\mathbf {p}}},\chi _{1}; n/4) \right) }{(2^k - \chi _{{\mathbf {p}}}(2)) B_{k,\chi _{{\mathbf {p}}}}} q^{n}, \end{aligned}$$

and whenever \(p \equiv (-1)^{k+1} \pmod {4}\) we have

$$\begin{aligned} E_{\theta _{{\mathcal {F}}(a,b;p)}}(z)&= 1- \sum _{n =1}^{\infty } \frac{2k\left( b_1 \sigma _{k-1}(\chi _{1},\chi _{-4{\mathbf {p}}}; n) + b_2 2^k \sigma _{k-1}(\chi _{-4},\chi _{{\mathbf {p}}}; n) \right) }{B_{k,\chi _{-4{\mathbf {p}}}}} q^{n} \\&\quad - \sum _{n =1}^{\infty } \frac{p^{(a-1)/2} 2k\left( b_3 \sigma _{k-1}(\chi _{{\mathbf {p}}},\chi _{-4}; n) + b_4 2^k \sigma _{k-1}(\chi _{-4{\mathbf {p}}},\chi _{1}; n) \right) }{B_{k,\chi _{-4{\mathbf {p}}}}} q^{n}, \end{aligned}$$

where

$$\begin{aligned} a_1&= {\left\{ \begin{array}{ll} (-1)^{k/2} &{} \text{ if } p \equiv 1 \pmod {4} ,\\ (-1)^{(k+a+2)/2} &{} \text{ if } p \equiv 3 \pmod {4} , \end{array}\right. }\\ a_2&= {\left\{ \begin{array}{ll} (-1)^{k/2+1}-\chi _{{\mathbf {p}}}(2) &{} \text{ if } p \equiv 1 \pmod {4} ,\\ (-1)^{(k+a)/2} - \chi _{{\mathbf {p}}}(2)&{} \text{ if } p \equiv 3 \pmod {4} , \end{array}\right. }\\ a_3&= 1,\\ a_4&= {\left\{ \begin{array}{ll} (-1)^{k/2} &{} \text{ if } p \equiv 1 \pmod {4} ,\\ (-1)^{(k-1)/2} &{} \text{ if } p \equiv 3 \pmod {4} , \end{array}\right. }\\ a_5&= {\left\{ \begin{array}{ll} (-1)^{k/2+1} \chi _{{\mathbf {p}}}(2) - 1 &{} \text{ if } p \equiv 1 \pmod {4} ,\\ (-1)^{(b+1)/2}+(-1)^{(k+1)/2}\chi _{{\mathbf {p}}}(2) &{} \text{ if } p \equiv 3 \pmod {4} , \end{array}\right. }\\ a_6&= {\left\{ \begin{array}{ll} 1 &{} \text{ if } p \equiv 1 \pmod {4} ,\\ (-1)^{(b-1)/2} &{} \text{ if } p \equiv 3 \pmod {4} , \end{array}\right. }\\ b_1&= 1,\\ b_2&= {\left\{ \begin{array}{ll} {(-1)^{(k-1)/2}}/{2} &{} \text{ if } p \equiv 1 \pmod {4} ,\\ {(-1)^{(k+a-1)/2}}/{2} &{} \text{ if } p \equiv 3 \pmod {4} , \end{array}\right. }\\ b_3&= {\left\{ \begin{array}{ll} 1 &{} \text{ if } p \equiv 1 \pmod {4} ,\\ (-1)^{(b+1)/2} &{} \text{ if } p \equiv 3 \pmod {4} , \end{array}\right. }\\ b_4&= {\left\{ \begin{array}{ll} (-1)^{(k-1)/2}/2 &{} \text{ if } p \equiv 1 \pmod {4} ,\\ (-1)^{k/2}/2 &{} \text{ if } p \equiv 3 \pmod {4} . \end{array}\right. } \end{aligned}$$

Using (11) and Theorem 2 one can obtain results similar to Corollary 1 for any diagonal form. Next we consider the non-diagonal form

$$\begin{aligned} {\mathcal {F}}_k= \sum _{m=1}^{k} \sum _{ \begin{array}{c} 1 \le i \le j \le 4, \\ (i,j) \ne (1,2) \end{array}} x_{i,m} x_{j,m}. \end{aligned}$$

We obtain

$$\begin{aligned}&N=2, \qquad \det (B({\mathcal {F}}_k))=2^{2k} \text{ and } \sum _{\begin{array}{c} x \in {\mathbb {Z}}^{2k},\\ x \pmod {c} \end{array}} e^{ 2 \pi i {\mathcal {F}}_k(x)/c}={\left\{ \begin{array}{ll} 1 &{} \text{ if } c=1,\\ (-8)^k &{} \hbox { if}\ c=2. \end{array}\right. } \end{aligned}$$

Thus, \(\theta _{{\mathcal {F}}_k} \in M_{2k}(\Gamma _0(2),\chi _1)\), hence by Theorem 2 we have

$$\begin{aligned}{}[n]E_{\theta _{{\mathcal {F}}_k}}(z) = \frac{-4k}{((-2)^k+1)B_{2k,\chi _1}} \left( \sigma _{2k-1}(\chi _1,\chi _1;n) + (-2)^k \sigma _{2k-1}(\chi _1,\chi _1;n/2) \right) . \end{aligned}$$
(14)

When \(k=6\) we compute the first few coefficients of the cusp part of \(\theta _{{\mathcal {F}}_6}\):

$$\begin{aligned} \theta _{{\mathcal {F}}_6}(z) - E_{\theta _{{\mathcal {F}}_6}}(z)=&\frac{2^6 3^4 19}{691}q+ \frac{2^6 3^4 19 }{691} (2^6 -24) q^2+ \frac{2^6 3^419 }{691} 252 q^3 +O(q^4) \\&\in S_{12}(\Gamma _0(2),\chi _1). \end{aligned}$$

The Fourier coefficients of \(\eta ^{24}(z)\) are called Ramanujan’s \(\tau \)-function and first few terms are given as follows:

$$\begin{aligned} \eta ^{24}(z)=\sum _{n \ge 1} \tau (n) q^n = q-24 q^2+252 q^3 +O(q^4). \end{aligned}$$
(15)

It is well known that \(\eta ^{24}(z)\) and \(\eta ^{24}(2z) \in S_{12}(\Gamma _0(2),\chi _1)\) and thus by Sturm’s Theorem [5, Corollary 5.6.14] we obtain

$$\begin{aligned} \theta _{{\mathcal {F}}_6}(z) - E_{\theta _{{\mathcal {F}}_6}}(z)= \frac{2^6 3^4 19}{691}(\eta ^{24}(z) + 2^6 \eta ^{24}(2z)). \end{aligned}$$
(16)

If we compare nth coefficient of both sides of (16) we get

$$\begin{aligned}&[n]\theta _{{\mathcal {F}}_6}(z)-\frac{2^4 3^2 7}{691} (\sigma _{11}(\chi _1,\chi _1;n) + 2^6 \sigma _{11}(\chi _1,\chi _1;n/2))\\&\quad = \frac{2^6 3^4 19}{691} (\tau (n) + 2^6 \tau (n/2)). \end{aligned}$$

Since

$$\begin{aligned}&[n]\theta _{{\mathcal {F}}_6}(z) \in {\mathbb {N}}_0\quad \text{ for } \text{ all } n \in {\mathbb {N}}_0 \quad \text{ and }\quad 2^4 3^2 7 \equiv -2^6 3^4 19 \pmod {691} \end{aligned}$$

it is not hard to deduce the well-known congruence relation

$$\begin{aligned} \tau (n) \equiv \sigma _{11}(\chi _1,\chi _1;n) \pmod {691}. \end{aligned}$$

3 Applications to eta quotients

In this section, we give further applications of Theorem 1. Recall that the Dedekind eta function is defined by

$$\begin{aligned} \eta (z)=e^{\pi i z/12} \prod _{n \ge 1} (1-e^{2 \pi i n z}). \end{aligned}$$

Let \(k \in {\mathbb {N}}\). We define

$$\begin{aligned} f_{k}(z)&:=\frac{\eta ^{2k+1}(2z)\eta ^{2k+1}(3z)\eta ^{2k+1}(8z)\eta ^{2k+1}(12z)}{\eta ^{2k+1}(z)\eta ^{2k+1}(24z)}, \end{aligned}$$
(17)
$$\begin{aligned} g_{k}(z)&:=\frac{\eta ^{6{k}-5}(3z)\eta ^{6{k}-4}(4z)}{\eta ^{{2k}-3}(z)\eta ^{{2k}-2}(2z)\eta ^{{2k}-4}(6z)\eta ^{{2k}}(12z)} , \end{aligned}$$
(18)
$$\begin{aligned} h_{k}(z)&:=\frac{\eta ^{6{k}-4}(9z) \eta ^{3}(27z)}{\eta ^{{2k}-1}(3z)}. \end{aligned}$$
(19)

In Corollary 2 below, we obtain formulas concerning \(f_k(z), g_k(z)\), and \(h_k(z)\). Similar formulas can be obtained via Theorem 1 for all integer weight holomorphic eta quotients.

Corollary 2

Let \(k \ge 1\) and let \(f_k(z), g_k(z)\), and \(h_k(z)\) be defined by (17), (18), and (19), respectively. Then we have

$$\begin{aligned} E_{f_{k}}(z)&=1 - \frac{4k+2}{B_{{2k+1},\chi _{-24}}} \sum _{n \ge 1} \left( \sigma _{{2k}}(\chi _1,\chi _{-24};n) + (-24)^{{k}} \sigma _{{2k}}(\chi _{-24},\chi _1;n) \right) q^n, \\ E_{g_{k}}(z)&= 1- \frac{4{k}}{B_{{2k},\chi _{12}}} \sum _{n \ge 1} \sigma _{{2k}-1}(\chi _{1},\chi _{12};n) q^n, \end{aligned}$$

and

$$\begin{aligned} E_{h_{k}}(z)&= \frac{-4{k}}{B_{2k,\chi _1}} \sum _{n \ge 1} \left( \sum _{d \mid 9} a_d \sigma _{{2k}-1}(\chi _{1}, \chi _{1}; n/d) + b_1\sigma _{{2k}-1}(\chi _{-3}, \chi _{-3}; n) \right) q^n, \end{aligned}$$
(20)

where

$$\begin{aligned} a_1&= \frac{(-1)^{{k}} - \cos \left( {({k}+4) \pi }/{3} \right) }{3^{3{k}+1} (3^{2k} - 1)}, \\ a_3&= \frac{(-1)^{k+1} +(3^{2k} +1) \cos \left( {({k}+4) \pi }/{3} \right) }{3^{3{k}+1} (3^{2k} - 1)}, \\ a_9&= \frac{- \cos \left( {({k}+4) \pi }/{3} \right) }{3^{{k}+1} (3^{2k} - 1)}, \\ b_1&= \frac{ \sqrt{3} \sin \left( {({k}+4) \pi }/{3} \right) }{3^{3{k}+1} (3^{2k}-1)}. \end{aligned}$$

Proof

We use [5, Proposition 5.9.2] to determine

$$\begin{aligned} f_k(z)&\in M_{2k+1}(\Gamma _0(24),\chi _{-24}),\\ g_k(z)&\in M_{2k}(\Gamma _0(12),\chi _{12}),\\ h_k(z)&\in M_{2k}(\Gamma _0(27),\chi _{1}). \end{aligned}$$

We evaluate the constant terms of \(f_k(z),g_k(z),h_k(z)\) at the relevant cusps using [12, Proposition 2.1]. We do this with the help of some SAGE functions we have written; the code is provided in the Appendix A. From these we compute

$$\begin{aligned}&[0]_{1/1} f_k =- \frac{i^{2k+1} \sqrt{6}}{3^{k+1} 2^{3k+2}},\\&[0]_{a/c}f_k =0, \hbox { for}\ a/c= 1/2,1/3,1/4,1/6,1/8,1/12, \\&[0]_{1/24}f_k =1, \end{aligned}$$

see Appendix A for details. We determine the set of tuples of characters as

$$\begin{aligned} {\mathcal {E}}(2k+1,24,\chi _{-24}) = \{ (\chi _{1},\chi _{-24}), (\chi _{-3},\chi _{8}), (\chi _{8},\chi _{-3}), (\chi _{-24},\chi _{1})\}. \end{aligned}$$

Thus, we have

$$\begin{aligned} E_{f_{k}}(z) = \sum _{(\epsilon , \psi ) \in {\mathcal {E}}(2k+1,24,\chi _{-24}) } a_{f_k}(\epsilon ,\psi ,1) E_{2k+1}(\epsilon ,\psi ;z). \end{aligned}$$

Now, we compute

$$\begin{aligned} a_{f_k}(\chi _{1},\chi _{-24},1)&= \left( \prod _{p \mid 24} \frac{p^k}{p^k -\chi _{1}(p) \chi _{-24}(p)} \right) \nonumber \\ {}&\quad \times {\mathcal {R}}_{k,\chi _{1},\chi _{-24}}(1,1) {\mathcal {S}}_{k,1,\chi _{1},\chi _{-24}}(1,1) [0]_{24,{\chi _{-24}}}f_k \nonumber \\&= {\mathcal {R}}_{k,\chi _{1},\chi _{-24}}(1,1) {\mathcal {S}}_{k,1,\chi _{1},\chi _{-24}}(1,1) [0]_{24,{\chi _{-24}}}f_k \nonumber \\&= [0]_{24,{\chi _{-24}}}f_k. \end{aligned}$$
(21)

Additionally, we have

$$\begin{aligned}{}[0]_{24,{\chi _{-24}}}f_k = \frac{1}{\phi (24)} \sum _{\begin{array}{c} a=1,\\ \gcd (a,24)=1 \end{array}}^{24} \chi _{-24}(a) [0]_{a/24} f_k = \chi _{-24}(1) [0]_{1/24} f_k = 1. \end{aligned}$$
(22)

Combining (21) and (22) we have \(a_{f_k}(\chi _{1},\chi _{-24},1)=1\).

The rest of the coefficients are obtained similarly. \(\square \)

Now, we turn our attention to special cases of these formulas. The dimension of \(S_{2}(\Gamma _0(12),\chi _{12})\) is 0, so we obtain an exact formula for \(g_1\), i.e., we have \(g_{1}(z)=E_{g_{1}}(z)\). When \(k=1\), (20) specializes to

$$\begin{aligned} E_{h_1}(z)&= \sum _{n \ge 1} \left( \frac{1}{18} \sigma _{1}(\chi _{1}, \chi _{1}; n) - \frac{2 }{ 9 } \sigma _{1}(\chi _{1}, \chi _{1}; n/3)\right. \\&\left. \quad +\frac{1}{6} \sigma _{1}(\chi _{1}, \chi _{1}; n/9) + \frac{1 }{18 } \sigma _{1}(\chi _{-3}, \chi _{-3}; n) \right) q^n. \end{aligned}$$

Clearly \(h_1(z)-E_{h_1}(z)\) is a cusp form, and if we normalize \(h_1(z)-E_{h_1}(z)\) so that the coefficient of q is 1, we obtain the newform \({\mathcal {N}}_{27}(z)\) in \(S_{2}(\Gamma _0(27),\chi _1)\), that is, we have

$$\begin{aligned} {\mathcal {N}}_{27}(z)&=-9 \frac{\eta ^{2}(9z) \eta ^{3}(27z)}{\eta (3z)} + \sum _{n \ge 1} \left( \frac{1}{2} \sigma _{1}(\chi _{1}, \chi _{1}; n) -2 \sigma _{1}(\chi _{1}, \chi _{1}; n/3) \right. \\&\qquad \qquad \qquad \qquad \qquad \qquad \qquad \left. + \frac{3}{2} \sigma _{1}(\chi _{1}, \chi _{1}; n/9) + \frac{1 }{2 } \sigma _{1}(\chi _{-3}, \chi _{-3}; n) \right) q^n. \end{aligned}$$

By [8, Table 1] this newform is associated to the elliptic curve

$$\begin{aligned} E_{27A}: y^2 + y=x^3 - 7. \end{aligned}$$

Recall that in Sect. 1 we defined

$$\begin{aligned} E_{27A}({\mathbb {F}}_p)= \{ \infty \} \cup \{ (x,y) \in {\mathbb {F}}_p \times {\mathbb {F}}_p : y^2 + y=x^3 - 7 \}, \end{aligned}$$

where \({\mathbb {F}}_p\) is the finite field of p elements. Then by the Modularity Theorem, see [9, Theorem 8.8.1], we have

$$\begin{aligned} \# E_{27A}({\mathbb {F}}_p) =(p+1) - [p] {\mathcal {N}}_{27}(z) \quad \text{ for } \text{ all } p \ne 3. \end{aligned}$$

Thus, for all \(p \ne 3\) we have

$$\begin{aligned} \# E_{27A}({\mathbb {F}}_p) = 9 [p]\frac{\eta ^{2}(9z) \eta ^{3}(27z)}{\eta (3z)} + (p+1) \left( \frac{ 1- \chi _{-3}(p) }{2} \right) . \end{aligned}$$

Since \(\displaystyle [p]\frac{\eta ^{2}(9z) \eta ^{3}(27z)}{\eta (3z)} \in {\mathbb {Z}}\) for all \(p \in {\mathbb {N}}\) and \(\displaystyle [p]\frac{\eta ^{2}(9z) \eta ^{3}(27z)}{\eta (3z)} =0\) when \(p \equiv 2 \pmod {3}\), we obtain the following statement.

Corollary 3

We have

$$\begin{aligned}&\# E_{27A}({\mathbb {F}}_p) \equiv 0 \pmod {9} \text{ if } p \equiv 1 \pmod {3},\\&\# E_{27A}({\mathbb {F}}_p) = p+1 \text{ if } p \equiv 2 \pmod {3}. \end{aligned}$$

4 Orthogonal relations

In this section, we prove some orthogonal relations involving the functions \({\mathcal {R}}_{k,\epsilon ,\psi }(d,c) \) and \( {\mathcal {S}}_{k,N,\epsilon ,\psi }(d,c)\) defined in (6) and (7), respectively. These orthogonal relations concern the constant terms of the Eisenstein series and give the means to determine \(a_f(\epsilon ,\psi ,d)\) of Theorem 1. Throughout the section we assume \(k,N \in {\mathbb {N}}\) and \(\epsilon , \psi \) are primitive Dirichlet characters with conductors LM, respectively, such that \(LM \mid N\).

Lemma 1

Let \(p \mid N\) be a prime and let \(t \mid N/p^v\), where \(v=v_p(N)\). Then, for \(0\le i \le v\), we have

$$\begin{aligned} {\mathcal {S}}_{k,N,\epsilon ,\psi }(t\cdot p^i,d)={\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^i,p^{v_p(d)}) {\mathcal {S}}_{k,N/p^v,\epsilon ,\psi }(t,d/p^{v_p(d)}). \end{aligned}$$

Proof

Since \(t \mid N/p^v\) we have \(\gcd (t,p)=1\). Using the multiplicative properties of the Möbius function we obtain

$$\begin{aligned}&{\mathcal {S}}_{k,N,\epsilon ,\psi }(t\cdot p^i,d)\\ {}&\quad = \mu \left( \frac{t\cdot p^i \cdot d}{\gcd (t\cdot p^i,d)^2} \right) \prod _{\begin{array}{c} p_2 \mid \gcd (t\cdot p^i,d),\\ 0<v_{p_2}(t\cdot p^i)=v_{p_2}(d)<v_{p_2}(N) \end{array}} \left( \frac{p_2^k +\epsilon (p_2) {\overline{\psi }}(p_2)}{p_2^k} \right) \\&\quad = \mu \left( \frac{ p^i \cdot p^{v_p(d)}}{\gcd ( p^i,p^{v_p(d)})^2} \right) \prod _{\begin{array}{c} p_2 \mid \gcd ( p^i,p^{v_p(d)}),\\ 0<v_{p_2}( p^i)=v_{p_2}(p^{v_p(d)})<v_{p_2}(N) \end{array}}\left( \frac{p_2^k +\epsilon (p_2) {\overline{\psi }}(p_2)}{p_2^k} \right) \\&\qquad \times \mu \left( \frac{t\cdot d/p^{v_p(d)} }{\gcd (t ,d/p^{v_p(d)})^2} \right) \!\!\! \prod _{\begin{array}{c} p_2 \mid \gcd (t ,d/p^{v_p(d)}),\\ 0<v_{p_2}(t )=v_{p_2}(d/p^{v_p(d)})<v_{p_2}(N/p^{v_p(d)}) \end{array}}\!\!\!\! \left( \frac{p_2^k +\epsilon (p_2) {\overline{\psi }}(p_2)}{p_2^k} \right) \\&\quad ={\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^i,p^{v_p(d)}) {\mathcal {S}}_{k,N/p^v,\epsilon ,\psi }(t,d/p^{v_p(d)}). \end{aligned}$$

\(\square \)

Lemma 2

If \(\gcd (t,p^i)=1\), then we have

$$\begin{aligned} {\mathcal {R}}_{k,\epsilon ,\psi }(c,t \cdot p^i)&= \epsilon (-1) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(c/p^{v_p(c)},t),\\ {\mathcal {R}}_{k,\epsilon ,\psi }(t \cdot p^i,d)&=\epsilon (-1) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)}) {\mathcal {R}}_{k,\epsilon ,\psi }(t, d/p^{v_p(d)}). \end{aligned}$$

Proof

By elementary manipulations we obtain

$$\begin{aligned} {\mathcal {R}}_{k,\epsilon ,\psi }(c,t \cdot p^i)&= \epsilon \left( \frac{-c}{\gcd (c,t\cdot p^i)} \right) {\overline{\psi }} \left( \frac{t\cdot p^i}{\gcd (c,t\cdot p^i)} \right) \left( \frac{\gcd (c,t\cdot p^i)}{t\cdot p^i} \right) ^k \\&= \epsilon \left( \frac{-c/p^{v_c}}{\gcd (c/p^{v_c},t)} \right) {\overline{\psi }} \left( \frac{t}{\gcd (c/p^{v_p(c)},t )} \right) \left( \frac{\gcd (c/p^{v_p(c)},t )}{t } \right) ^k \\&\quad \times \epsilon \left( \frac{p^{v_p(c)}}{\gcd (p^{v_p(c)}, p^i)} \right) {\overline{\psi }} \left( \frac{ p^i}{\gcd (p^{v_p(c)}, p^i)} \right) \left( \frac{\gcd (p^{v_c}, p^i)}{ p^i} \right) ^k\\&= \epsilon (-1) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(c/p^{v_p(c)},t). \end{aligned}$$

Proof of the second equation is similar. \(\square \)

Theorem 3

If \(c,d \mid N\), then

$$\begin{aligned}&\sum _{t \mid N} {\mathcal {S}}_{k,N,\epsilon ,\psi }(c,t) {\mathcal {R}}_{k,\epsilon ,\psi }(c,t) {\mathcal {R}}_{k,\epsilon ,\psi }(t,d) ={\left\{ \begin{array}{ll} 0 &{} \text{ if } c \ne d,\\ \displaystyle \prod _{p \mid N} \frac{p^k - \epsilon (p) {\overline{\psi }}(p)}{p^k} &{} \text{ if } c = d. \end{array}\right. } \end{aligned}$$

Proof

Let \(p \mid N\) be prime and \(v_p(N)=v\). We use Lemmas 1 and 2 to obtain

$$\begin{aligned}&\sum _{t \mid N} {\mathcal {S}}_{k,N,\epsilon ,\psi }(c,t) {\mathcal {R}}_{k,\epsilon ,\psi }(c,t) {\mathcal {R}}_{k,\epsilon ,\psi }(t,d)\\&\quad = \sum _{0 \le i \le v}\sum _{t \mid N/p^v} {\mathcal {S}}_{k,N,\epsilon ,\psi }(c,t \cdot p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(c,t \cdot p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(t \cdot p^i,d)\\&\quad = \sum _{0 \le i \le v}\sum _{t \mid N/p^v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {S}}_{k,N/p^v,\epsilon ,\psi }(c/p^{v_p(c)}, t) \\&\quad \quad \times \epsilon (-1) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(c/p^{v_p(c)},t)\\&\quad \quad \times \epsilon (-1) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)}) {\mathcal {R}}_{k,\epsilon ,\psi }(t, d/p^{v_p(d)})\\&\quad = \sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)}) \\&\quad \quad \times \sum _{t \mid N/p^v} {\mathcal {S}}_{k,N/p^v,\epsilon ,\psi }(c/p^{v_p(c)},t) {\mathcal {R}}_{k,\epsilon ,\psi }(c/p^{v_p(c)},t) {\mathcal {R}}_{k,\epsilon ,\psi }(t, c/p^{v_p(d)}). \end{aligned}$$

Using this recursively we obtain

$$\begin{aligned}&\sum _{t \mid N} {\mathcal {S}}_{k,N,\epsilon ,\psi }(c,t) {\mathcal {R}}_{k,\epsilon ,\psi }(c,t) {\mathcal {R}}_{k,\epsilon ,\psi }(t,d)\nonumber \\&\qquad = \prod _{p \mid N}\sum _{0 \le i \le v_p} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)}). \end{aligned}$$
(23)

Now, we prove for all \(p \mid N\) we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)}) \nonumber \\&\qquad ={\left\{ \begin{array}{ll} 0 &{} \text{ if } v_p(c) \ne v_p(d), \\ \displaystyle \frac{p^k - \epsilon (p) {\overline{\psi }}(p)}{p^k} &{} \text{ if } v_p(c) = v_p(d). \end{array}\right. } \end{aligned}$$
(24)

We first note that

$$\begin{aligned} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) = {\left\{ \begin{array}{ll} 0 &{} \text{ if } \vert v_p(c) - i \vert>1, \\ \displaystyle \frac{p^k + \epsilon (p) {\overline{\psi }}(p)}{p^k} &{} \text{ if } i = v_p(c) \text{ and } v> v_p(c)> 0,\\ 1 &{} \text{ if } i = v_p(c) \text{ and } v_p(c) = v,\\ 1 &{} \text{ if } i = v_p(c) \text{ and } v_p(c) = 0,\\ - 1 &{} \text{ if } i = v_p(c) - 1 \text{ and } v_p(c) > 0, \\ - 1 &{} \text{ if } i = v_p(c) + 1 \text{ and } v_p(c) < v, \end{array}\right. } \end{aligned}$$
(25)

and

$$\begin{aligned}&{\mathcal {R}}_{k,\epsilon ,\psi }(p^i, p^j) = {\left\{ \begin{array}{ll} \epsilon (-1) &{} \text{ if } i = j,\\ \displaystyle \epsilon (-1) {\overline{\psi }}(p^{j-i}) \left( \frac{1}{p^{j-i}} \right) ^k &{} \text{ if } i < j , \\ \epsilon (-p^{i-j}) &{} \text{ if } i > j. \end{array}\right. } \end{aligned}$$
(26)

The cases

  • (Case 1) \(0< v_p(c) < v_p(d) \le v\),

  • (Case 2) \(0 = v_p(c) < v_p(d) \le v\),

  • (Case 3) \(v> v_p(c) > v_p(d) \ge 0\),

  • (Case 4) \(v = v_p(c) > v_p(d) \ge 0\),

  • (Case 5) \(0< v_p(c) = v_p(d) < v\),

  • (Case 6) \(0 = v_p(c) = v_p(d)\),

  • (Case 7) \(v= v_p(c) = v_p(d)\),

need to be handled separately, which is done below.

Case 1 If \(0< v_p(c) < v_p(d) \le v\), then by employing (25) for all i such that \(\vert v_p(c) - i \vert >1\) we have

$$\begin{aligned} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)}) = 0. \end{aligned}$$

Therefore, we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)})\\&\quad = {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)-1}, p^{v_p(d)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)}, p^{v_p(d)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)+1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)+1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)+1}, p^{v_p(d)}), \end{aligned}$$

which, by (25) and (26), equals to

$$\begin{aligned}&= -1 \cdot \epsilon (-p) \cdot \epsilon (-1){\overline{\psi }}( p^{v_p(d)-v_p(c)+1}) \left( \frac{1}{p^{v_p(d)-v_p(c)+1}} \right) ^k\\&\quad +\frac{p^k + \epsilon (p) {\overline{\psi }}(p)}{p^k} \cdot \epsilon (-1) \cdot \epsilon (-1) {\overline{\psi }}(p^{v_p(d)-v_p(c)})\left( \frac{1}{p^{v_p(d)-v_p(c)}} \right) ^k\\&\quad + (-1) \cdot \epsilon (-1) {\overline{\psi }}(p) \left( \frac{1}{p} \right) ^k \cdot \epsilon (-1) {\overline{\psi }}(p^{v_p(d)-v_p(c)-1}) \left( \frac{1}{p^{v_p(d)-v_p(c)-1}} \right) ^k. \end{aligned}$$

By using multiplicative properties of Dirichlet characters we conclude that this expression is equal to 0.

Case 2 If \(0 = v_p(c) < v_p(d) \le v\), then by employing (25) and (26) we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)})\\&\quad = {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(1,1) {\mathcal {R}}_{k,\epsilon ,\psi }(1, 1) {\mathcal {R}}_{k,\epsilon ,\psi }( 1, p^{v_p(d)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(1,p) {\mathcal {R}}_{k,\epsilon ,\psi }(1, p) {\mathcal {R}}_{k,\epsilon ,\psi }( p, p^{v_p(d)})\\&\quad = {\overline{\psi }}( p^{v_p(d)}) \left( \frac{1}{p^{v_p(d)}} \right) ^k - {\overline{\psi }}(p^{v_p(d)}) \left( \frac{1}{p^{v_p(d)}} \right) ^k, \end{aligned}$$

which equals to 0.

Case 3 If \(v> v_p(c) > v_p(d) \ge 0\), then by employing (25) and (26) we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)})\\&\quad = {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)-1}, p^{v_p(d)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)}, p^{v_p(d)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)+1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)+1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)+1}, p^{v_p(d)})\\&\quad = - \epsilon (-p) \epsilon ( - p^{v_p(c)-1- v_p(d)}) + \frac{p^k + \epsilon (p){\overline{\psi }}(p) }{p^k} \cdot \epsilon (-1) \cdot \epsilon ( - p^{v_p(c)- v_p(d)})\\&\qquad - \epsilon (-1) {\overline{\psi }}(p) \frac{1}{p^k} \cdot \epsilon (-p^{v_p(c)+1-v_p(d)}). \end{aligned}$$

By using multiplicative properties of Dirichlet characters we conclude that this expression is equal to 0.

Case 4 If \(v = v_p(c) > v_p(d) \ge 0\), then by employing (25) and (26) we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)})\\&\quad = {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)-1}, p^{v_p(d)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)}, p^{v_p(d)})\\&\quad = - \epsilon (p^{v_p(c)-v_p(d)} )+ \epsilon (p^{v_p(c)-v_p(d)})\\&\quad = 0. \end{aligned}$$

Case 5 If \(0< v_p(c) = v_p(d) < v\), then by employing (25), (26) and multiplicative properties of Dirichlet characters we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)})\\&\quad = {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)-1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)-1}, p^{v_p(c)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)}, p^{v_p(c)})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^{v_p(c)+1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^{v_p(c)+1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v_p(c)+1}, p^{v_p(c)})\\&\quad = - \epsilon (-p) \cdot \epsilon (-1) {\overline{\psi }}(p) \frac{1}{p^k}+ \frac{p^k + \epsilon (p) {\overline{\psi }}(p)}{p^k} \cdot \epsilon (-1) \cdot \epsilon (-1) \\&\qquad - \epsilon (-1) {\overline{\psi }}(p) \frac{1}{p^k} \cdot \epsilon (-p)\\&\quad = \frac{p^k - \epsilon (p) {\overline{\psi }}(p)}{p^k}. \end{aligned}$$

Case 6 If \(0=v_p(c) = v_p(d) \), then by employing (25), (26) and multiplicative properties of Dirichlet characters we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)})\\&\quad = {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(1,1) {\mathcal {R}}_{k,\epsilon ,\psi }(1,1) {\mathcal {R}}_{k,\epsilon ,\psi }( 1,1 )\\&\,\,\,\quad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(1,p ) {\mathcal {R}}_{k,\epsilon ,\psi }(1, p ) {\mathcal {R}}_{k,\epsilon ,\psi }( p, 1)\\&\quad = 1 \cdot \epsilon (-1) \cdot \epsilon (-1) - \epsilon (-1) {\overline{\psi }}(p) \frac{1}{p^k} \cdot \epsilon (-p)\\&\quad = \frac{p^k - \epsilon (p) {\overline{\psi }}(p)}{p^k}. \end{aligned}$$

Case 7 If \(v=v_p(c) = v_p(d)\), then by employing (25), (26) and multiplicative properties of Dirichlet characters we have

$$\begin{aligned}&\sum _{0 \le i \le v} {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v_p(c)},p^i) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v_p(c)}, p^i) {\mathcal {R}}_{k,\epsilon ,\psi }( p^i, p^{v_p(d)})\\&\quad = {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v},p^{v-1}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v}, p^{v-1}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v-1}, p^{v})\\&\qquad + {\mathcal {S}}_{k,p^v,\epsilon ,\psi }(p^{v},p^{v}) {\mathcal {R}}_{k,\epsilon ,\psi }(p^{v}, p^{v}) {\mathcal {R}}_{k,\epsilon ,\psi }( p^{v}, p^{v})\\&\quad = -1 \cdot \epsilon (-p) \cdot \epsilon (-1) {\overline{\psi }}(p) \frac{1}{p^k} + 1 \cdot \epsilon (-1) \cdot \epsilon (-1) \\&\quad = \frac{p^k - \epsilon (p) {\overline{\psi }}(p)}{p^k}. \end{aligned}$$

This yields (24). Finally, if \(c \ne d\), then there exists a prime \(p \mid N\) such that \(v_p(c) \ne v_p(d)\). Hence by (24) the product in (23) is 0. If \(c=d\) then for all prime divisors p of N we have \(v_p(c) = v_p(d)\). Therefore, by (23) and (24) we have the desired result. \(\square \)

5 Constant terms of expansions of Eisenstein series at the cusps

Recall that \(E_{k}(\epsilon ,\psi ;dz)\) is defined by (2) and we have

$$\begin{aligned}&{E_{k}(\epsilon ,\psi ;dz )}\in E_{k}(\Gamma _0(N),\chi ) \quad \text{ when } (k,\epsilon ,\psi )\ne (2,\chi _1,\chi _1), \end{aligned}$$

and

$$\begin{aligned}&L_d(z) :=E_{2}(\chi _1,\chi _1;z)-dE_{2}(\chi _1,\chi _1;dz) \in E_{2}(\Gamma _0(N),\chi _1). \end{aligned}$$

The constant terms of Eisenstein series in the expansion at the cusp a/c with \(\gcd (a,c)=1\) are given by

$$\begin{aligned}&[0]_{a/c} E_{k}(\epsilon ,\psi ;dz ) = \displaystyle {\overline{\psi }}(a){\mathcal {R}}_{k,\epsilon ,\psi } (c,Md) \text{ when } (k,\epsilon ,\psi )\ne (2,\chi _1,\chi _1) \text{ and } \end{aligned}$$
(27)
$$\begin{aligned}&[0]_{a/c} L_d(z)= {\mathcal {R}}_{2,\chi _1,\chi _1}(c,1)-d{\mathcal {R}}_{2,\chi _1,\chi _1}(c,d), \end{aligned}$$
(28)

where \({\mathcal {R}}_{k,\epsilon ,\psi } (c,t) \) is defined by (6). For (27) see [3, (6.2)], [5, Proposition 8.5.6 and Ex. 8.7 (i) on pg. 308]. The formula (28) is proved later in this section.

The structure of the terms \([0]_{a/c}E_k(\epsilon ,\psi ;dz)\) is complicated and difficult to work with. We observe that taking the average \([0]_{c,{\psi }} E_k( \epsilon ,\psi ;dz)\) gives constant terms a very nice structure which is easier to work with (see (38)). Throughout the section we assume \(k,N \in {\mathbb {N}}\), \(\epsilon \) and \(\psi \) are primitive Dirichlet characters with conductors L and M, respectively, such that \(LM \mid N\) and \((k,\epsilon ,\psi ) \ne (2,\chi _1,\chi _1)\).

Lemma 3

Let \(c \mid N\) and \(LMd \mid N\). If \(M \not \mid c\), or \(M \mid c\) and \(L \not \mid N/c\), then

$$\begin{aligned}{}[0]_{a/c} E_k(\epsilon ,\psi ;dz) =0. \end{aligned}$$

Proof

First, assuming \(M \not \mid c\), we see that \( M \not \mid \gcd (Md,c) \). Thus, \( \gcd \left( \frac{Md}{\gcd (Md,c)},M \right) \mid M\), which implies \( {\overline{\psi }} \left( \frac{Md}{\gcd (Md,c)} \right) =0\) (since the conductor of \(\psi \) is M). Therefore, the result follows from (27).

Second, we assume \(M \mid c\) and \(L \not \mid N/c\). Setting \(c_1=c/M\), we have \(c_1 \mid N/M\). Since \(L \not \mid N/c\), we have \(c_1 \not \mid N/LM\). Since \(\frac{(N/M)}{L} \in {\mathbb {Z}}\), \(\frac{(N/M)}{c_1} \in {\mathbb {Z}}\) and \(\frac{(N/M)/c_1}{L} \not \in {\mathbb {Z}}\), we have \(\gcd (c_1,L) \ne 1\). Additionally, there exists a prime p dividing \(c_1\) such that

$$\begin{aligned}&v_p(c_1) > v_p(N) - v_p(M)-v_p(L). \end{aligned}$$
(29)

Since \(c_1 \mid N/M\), for all \(p \mid c_1\) we have

$$\begin{aligned}&v_p(c_1) \le v_p(N) - v_p(M). \end{aligned}$$
(30)

By (29) and (30) we have

$$\begin{aligned}&v_p(N) - v_p(M)> v_p(N) - v_p(M)-v_p(L). \end{aligned}$$

Therefore,

$$\begin{aligned}&v_p(L)> 0. \end{aligned}$$
(31)

Since \(d \mid N/LM\), we have

$$\begin{aligned} v_p(N)-v_p(M)-v_p(L) \ge v_p(d) \ge 0. \end{aligned}$$
(32)

Inequalities (29) and (32) together imply \(v_p(c_1) > v_p(d)\). Employing (31) we have

$$\begin{aligned} p \mid \gcd \left( \frac{p^{v_p(c_1)}}{\gcd (p^{v_p(c_1)},p^{v_p(d)})},p^{v_p(L)} \right) . \end{aligned}$$

That is,

$$\begin{aligned} p \mid \gcd \left( \frac{c_1}{\gcd (c_1,d)},L \right) . \end{aligned}$$

This implies \(\displaystyle \epsilon \left( \frac{c}{\gcd (Md,c)} \right) =0\) (since the conductor of \(\epsilon \) is L). Therefore, the result follows from (27). \(\square \)

Next we need the orthogonality of characters. The following lemma is a result of standard Schur orthogonality relations for the characters on the unit group \(({\mathbb {Z}}/c{\mathbb {Z}})^\times \) (see [5, Proposition 3.4.2]).

Lemma 4

Let \(c \in {\mathbb {N}}\), and let \(\psi _1,\psi _2\) be two primitive Dirichlet characters with conductors \(M_1\) and \(M_2\), respectively. If both \(M_1\) and \(M_2\) divide c, then we have

$$\begin{aligned} \sum _{\begin{array}{c} a =1, \\ \gcd (a,c)=1 \end{array}}^c \overline{\psi _1} (a) {\psi _2}(a) = {\left\{ \begin{array}{ll} 0 &{} \text{ if } \psi _1 \ne \psi _2,\\ \displaystyle \phi (c) &{} \text{ if } \psi _1 = \psi _2. \end{array}\right. } \end{aligned}$$

Before we prove the main result of this section we prove (28).

Lemma 5

If \(\gcd (a,c)=1\), then we have

$$\begin{aligned}{}[0]_{a/c} L_d(z)= {\mathcal {R}}_{2,\chi _1,\chi _1}(c,1)-d{\mathcal {R}}_{2,\chi _1,\chi _1}(c,d). \end{aligned}$$

Proof

Since \(\gcd (a,c)=1\), there exist \(\beta , \gamma \in {\mathbb {Z}}\) such that \(A=\begin{bmatrix} a &{} \beta \\ c &{} \gamma \end{bmatrix} \in SL_2({\mathbb {Z}})\). Then by [12, (1.21)] we have

$$\begin{aligned}&E_2(\chi _1,\chi _1;A(z))=(cz+\gamma )^2 E_2(\chi _1,\chi _1;z) - \frac{6ic}{ \pi } (cz+\gamma ), \end{aligned}$$
(33)

where A(z) is the usual linear fractional transformation. Let \(e= \frac{a d }{\gcd (c,a d )}\) and \(g=\frac{c}{\gcd (c,a d )}\). Since \(\gcd (e,g)=1\) there exist fh such that \( \begin{bmatrix} e &{} f \\ g &{} h \end{bmatrix} \in SL_2(Z)\). Hence we have

$$\begin{aligned}&E_{2}(\chi _1,\chi _1; d A(z);) \\&\quad = E_{2} \left( \chi _1,\chi _1;\begin{bmatrix} e &{} f \\ g &{} h \end{bmatrix} \begin{bmatrix} a h d - c f &{} \beta h d - \gamma f \\ - ag d + ce &{} -\beta g d + \gamma e \end{bmatrix} (z) \right) \\&\quad = E_{2} \left( \chi _1,\chi _1;\begin{bmatrix} \frac{a d }{\gcd (c,a d )} &{} f \\ \frac{c}{\gcd (c,a d )} &{} h \end{bmatrix} \begin{bmatrix} a h d - c f &{} \beta h d - \gamma f \\ 0 &{} \frac{ d }{\gcd (c,a d )} \end{bmatrix} (z) \right) \\&\quad = \left( \frac{\gcd (c ,d)}{ d } \right) ^2 (cz+\gamma )^2 E_{2} \left( \chi _1,\chi _1; \begin{bmatrix} a h d - c f &{} \beta h d - \gamma f \\ 0 &{} \frac{d}{\gcd (c,a d )} \end{bmatrix} (z) \right) \\&\qquad - \frac{6ic}{ \pi d } (cz+\gamma ), \end{aligned}$$

where in the last line we used (33). Thus, we obtain

$$\begin{aligned}{}[0]_{a/c} L_d(z)&=[0]_{a/c} (E_2(\chi _1,\chi _1;z)- d E_2(\chi _1,\chi _1;d z)) = \frac{ d -\gcd ( c ,d)^2}{ d }\\&= {\mathcal {R}}_{2,\chi _1,\chi _1}(c,1)-d{\mathcal {R}}_{2,\chi _1,\chi _1}(c,d). \end{aligned}$$

\(\square \)

Theorem 4

If \(c \mid N\) and \((\epsilon _1,\psi _1),(\epsilon _2,\psi _2) \in \{ (\epsilon ,\psi ) \in {\mathcal {E}}(k,N,\chi ) : M \mid c \}\), then we have

$$\begin{aligned}{}[0]_{c,{\psi _2}} E_k( \epsilon _1,\psi _1;dz)={\left\{ \begin{array}{ll} [0]_{1/c} E_k(\epsilon _2,\psi _2;dz) &{} \text{ if } \psi _1=\psi _2,\\ 0 &{} \text{ otherwise. } \end{array}\right. } \end{aligned}$$

If \(c \mid N\) and \((\epsilon _2,\psi _2) \in \{ (\epsilon ,\psi ) \in {\mathcal {E}}(2,N,\chi _1) : M \mid c \}\), then we have

$$\begin{aligned}{}[0]_{c,{\psi _2}} L_d(z)={\left\{ \begin{array}{ll} [0]_{1/c} L_d(z) &{} \text{ if } \psi _2=\chi _1, \\ 0 &{} \text{ otherwise. } \end{array}\right. } \end{aligned}$$

Proof

If \((k, \epsilon , \psi ) \ne (2,\chi _1,\chi _1)\) by (27) we have

$$\begin{aligned}{}[0]_{c,{\psi _2}} E(\epsilon _1,\psi _1;dz)&= \frac{1}{\phi (c)} \sum _{\begin{array}{c} a =1,\\ \gcd (a,c)=1 \end{array} }^c {\psi _2}(a) \overline{\psi _1}(a) {\mathcal {R}}_{k,\epsilon _1,\psi _1}(c,M_1d) \\&= [0]_{1/c} E_k(\epsilon _1,\psi _1;dz) \frac{1}{\phi (c)} \sum _{\begin{array}{c} a =1,\\ \gcd (a,c)=1 \end{array} }^c {\psi _2}(a) \overline{\psi _1}(a). \end{aligned}$$

Therefore, by Lemma 4 we obtain the first part of the statement. Proof of the second part is similar. \(\square \)

6 Proof of the main theorem

Recall that \(E_{k}(\epsilon ,\psi ;dz)\) is defined by (2) and the set

$$\begin{aligned}&\{ E_{k}(\epsilon ,\psi ;dz ) : (\epsilon ,\psi ) \in {\mathcal {E}}(k,N,\chi ), d \mid N/LM \} \end{aligned}$$
(34)

constitutes a basis for \(E_k(\Gamma _0(N),\chi )\) whenever \((k,\chi ) \ne (2,\chi _1)\) and the set

$$\begin{aligned}&\{ E_{2}(\chi _1,\chi _1;z)-d E_{2}(\chi _1,\chi _1;dz) : 1< d \mid N\} \nonumber \\&\qquad \cup \{ E_{2}(\epsilon ,\psi ;dz ) : (\epsilon ,\psi ) \in {\mathcal {E}}(2,N,\chi _1), (\epsilon ,\psi ) \ne ( \chi _1,\chi _1), d \mid N/LM \} \end{aligned}$$
(35)

constitutes a basis for \(E_2(\Gamma _0(N),\chi _1)\), see [5, Theorems 8.5.17 and 8.5.22], or [22, Proposition 5].

Now, we prove the main theorem whenever \((k,\chi ) \ne (2,\chi _1)\). Let \(f(z) \in M_k(\Gamma _0(N),\chi )\) where \(N,k \in {\mathbb {N}}\), \(k \ge 2\) and \((k,\chi ) \ne (2,\chi _1)\). By (34) we have

$$\begin{aligned} E_f(z) = \sum _{(\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ) } \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) E_k(\epsilon ,\psi ; dz), \end{aligned}$$
(36)

for some \(a_f(\epsilon ,\psi ,d) \in {\mathbb {C}}\). Our strategy for the proof is, using the interplay between the constant terms of Eisenstein series, to create sets of linear equations (see (38)) and to solve those sets of linear equations for \(a_f(\epsilon ,\psi ,d)\) using Theorem 3.

By (1) we have \(f(z)=E_f(z)+S_f(z)\), where \(E_f(z) \in E_k(\Gamma _0(N),\chi )\) and \(S_f(z) \in S_k(\Gamma _0(N),\chi )\) are unique. Since by definition \(S_f(z)\) vanishes at all cusps, we have \([0]_{a/c}f(z)=[0]_{a/c}E_f(z)\). Therefore, by (36) for each \(c \mid N\) and \(a \in {\mathbb {Z}}\) such that \(\gcd (a,c)=1\), we obtain

$$\begin{aligned}{}[0]_{a/c}f(z) = \sum _{(\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ) } \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) [0]_{a/c} E_k(\epsilon ,\psi ;dz). \end{aligned}$$

Let \((\epsilon _2,\psi _2) \in {\mathcal {E}}(k,N,\chi )\), and let the conductors of \(\epsilon _2\) and \(\psi _2\) be \(L_2\) and \(M_2\), respectively. Note that for each \(\psi _2\) there is a unique \(\epsilon _2\) such that \((\epsilon _2,\psi _2) \in {\mathcal {E}}(k,N,\chi )\). If we average the constant terms with \(\psi _2\) using (4), then for all \(c \mid N\) we obtain

$$\begin{aligned}{}[0]_{c, {\psi _2}}f(z) = \sum _{(\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ) } \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) [0]_{c, {\psi _2}} E_k(\epsilon ,\psi ;dz). \end{aligned}$$

Our goal here is to isolate a set of linear equations from which we can determine \(a_f(\epsilon _2,\psi _2,d)\) for all \(d \mid N/L_2M_2\). By Lemma 3 we have \([0]_{c, {\psi _2}} E_k(\epsilon _2,\psi _2;dz)=0\), if \(c \mid N\) is such that \(M_2 \mid c\), or \(M_2 \not \mid c\) and \(L_2 \mid N/c\). Therefore, from now on we restrict c to be in \(C_{N}(\epsilon _2,\psi _2)\), see (5) for definition. By applying Lemma 3 one more time we have \([0]_{c,\psi _2} E_k(\epsilon ,\psi ;dz)=0\) if \(M \not \mid c\). Therefore, for all \(c \in C_{N}(\epsilon _2,\psi _2)\) we have

$$\begin{aligned}{}[0]_{c, {\psi _2}}f(z) = \sum _{\begin{array}{c} (\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ),\\ M \mid c \end{array}} \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) [0]_{c, {\psi _2}} E_k(\epsilon ,\psi ;dz). \end{aligned}$$
(37)

Recall that for each \(\psi _2\) there is a unique \((\epsilon _2,\psi _2) \in {\mathcal {E}}(k,N,\chi )\). Additionally, for all \(c \in C_{N}(\epsilon _2,\psi _2)\) we have \((\epsilon _2,\psi _2) \in \{(\epsilon ,\psi ) \in {\mathcal {E}}(k,N,\chi ) : M \mid c \}\). Therefore, for all \(c \in C_{N}(\epsilon _2,\psi _2)\) we have

$$\begin{aligned}{}[0]_{c, {\psi _2}}f(z)&= \sum _{\begin{array}{c} (\epsilon , \psi ) \in {\mathcal {E}}(k,N,\chi ),\\ (\epsilon , \psi ) \ne (\epsilon _2,\psi _2) \\ M \mid c \end{array}} \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) [0]_{c, {\psi _2}} E_k(\epsilon ,\psi ;dz)\\&\quad + \sum _{d \mid N/L_2M_2} a_f(\epsilon _2,\psi _2,d) [0]_{c, {\psi _2}} E_k(\epsilon _2,\psi _2;dz). \end{aligned}$$

From this, using Theorem 4, we obtain

$$\begin{aligned}{}[0]_{c, {\psi _2}}f(z)&= \sum _{d \mid N/L_2M_2} a_f(\epsilon _2,\psi _2,d) [0]_{1/c} E_k(\epsilon _2,\psi _2;dz). \end{aligned}$$

Since \(M_2 \mid c\) we have

$$\begin{aligned}{}[0]_{1/c} E_k(\epsilon _2,\psi _2;dz)={\mathcal {R}}_{k,\epsilon _2,\psi _2}(c,M_2d)= {\mathcal {R}}_{k,\epsilon _2,\psi _2}(c/M_2,d). \end{aligned}$$

Hence for all \(c \in C_{N}(\epsilon _2,\psi _2)\) we have

$$\begin{aligned}{}[0]_{c, {\psi _2}}f(z) = \sum _{d \mid N/L_2M_2} a_f(\epsilon _2,\psi _2,d) {\mathcal {R}}_{k,\epsilon _2,\psi _2}(c/M_2,d). \end{aligned}$$
(38)

Below we solve the equations coming from (38) for \(a_f(\epsilon _2,\psi _2,d)\) using Theorem 3. For \(d_2 \mid N/L_2M_2\) we consider the sum

$$\begin{aligned} \sum _{c \in C_{N}(\epsilon _2,\psi _2) } {\mathcal {R}}_{k,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {S}}_{k,N/L_2M_2,\epsilon _2,\psi _2}(d_2,c/M_2) [0]_{c, {\psi _2}}f(z), \end{aligned}$$
(39)

which, by (38), equals to

$$\begin{aligned} =&\sum _{c \in C_{N}(\epsilon _2,\psi _2) } {\mathcal {R}}_{k,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {S}}_{k,N/L_2M_2,\epsilon _2,\psi _2}(d_2,c/M_2)\nonumber \\&\times \sum _{d \mid N/L_2M_2} a_f(\epsilon _2,\psi _2,d) {\mathcal {R}}_{k,\epsilon _2,\psi _2}(c/M_2,d). \end{aligned}$$
(40)

Rearranging the terms of (40) we obtain

$$\begin{aligned}&\sum _{c \in C_{N}(\epsilon _2,\psi _2) } {\mathcal {R}}_{k,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {S}}_{k,N/L_2M_2,\epsilon _2,\psi _2}(d_2,c/M_2) [0]_{c, {\psi _2}}f(z) \nonumber \\&\quad =\sum _{d \mid N/L_2M_2} a_f(\epsilon _2,\psi _2,d)\nonumber \\&\,\,\,\quad \times \sum _{c \in C_{N}(\epsilon _2,\psi _2) } {\mathcal {R}}_{k,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {S}}_{k,N/L_2M_2,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {R}}_{k,\epsilon _2,\psi _2}(c/M_2,d). \end{aligned}$$
(41)

Recall that \(C_{N}(\epsilon _2,\psi _2)\) is defined by (5) and is a set equivalent to the set

$$\begin{aligned} \{ c : M_2 \mid c, ~c/M_2 \mid N/L_2M_2 \}, \end{aligned}$$

i.e., \(c/M_2\) runs through all the divisors of \( N/L_2M_2\) as c runs through all the elements of \(C_{N}(\epsilon _2,\psi _2)\). In Theorem 3 we use this and we replace N by \(N/L_2M_2\), t by \(c/M_2\), c by \(d_2\) and d by d to obtain

$$\begin{aligned}&\sum _{c \in C_{N}(\epsilon _2,\psi _2) } {\mathcal {R}}_{k,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {S}}_{k,N/L_2M_2,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {R}}_{k,\epsilon _2,\psi _2}(c/M_2,d) \nonumber \\&\quad = {\left\{ \begin{array}{ll} \displaystyle \prod _{ p \mid N/L_2M_2} \frac{p^k - \epsilon _2(p) \overline{\psi _2}(p)}{p^k} &{} \text{ if } d=d_2,\\ 0 &{} \text{ if } d \ne d_2. \end{array}\right. } \end{aligned}$$
(42)

Therefore, from (41) and (42) we obtain

$$\begin{aligned}&\sum _{c \in C_{N}(\epsilon _2,\psi _2) } {\mathcal {R}}_{k,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {S}}_{k,N/L_2M_2,\epsilon _2,\psi _2}(d_2,c/M_2) [0]_{c, {\psi _2}}f(z) \\&\qquad = a_f(\epsilon _2,\psi _2,d_2) \prod _{ p \mid N/L_2M_2} \frac{p^k - \epsilon _2(p) \overline{\psi _2}(p)}{p^k}. \end{aligned}$$

Since \(p \mid L_2 M_2\) implies \(\epsilon _2(p) \overline{\psi _2}(p) =0\) we have

$$\begin{aligned} a_f(\epsilon _2,\psi _2,d_2) =&\prod _{p \mid N} \frac{p^k}{p^k-\epsilon _2(p) \overline{\psi _2}(p)}\\ {}&\times \sum _{c \in C_{N}(\epsilon _2,\psi _2) } {\mathcal {R}}_{k,\epsilon _2,\psi _2}(d_2,c/M_2) {\mathcal {S}}_{k,N/L_2M_2,\epsilon _2,\psi _2}(d_2,c/M_2) [0]_{c,{\psi _2}}f. \end{aligned}$$

This completes the proof of Theorem 1 when \((k,\chi ) \ne (2, \chi _1)\).

Now, if \((k,\chi ) = (2, \chi _1)\), then a basis of \(E_2(\Gamma _0(N),\chi _1)\) is given by (35). Using Lemma 5, Theorem 4, and arguments similar to the first part of this proof we obtain

$$\begin{aligned} E_f(z)&\!=\!\sum _{1<d \mid N} c_f(\chi _1,\chi _1,d) L_d(z) \!+\!\sum _{\begin{array}{c} (\epsilon , \psi ) \in {\mathcal {E}}(2,N,\chi ), \\ (\epsilon ,\psi ) \ne (\chi _1,\chi _1) \end{array} } \sum _{d \mid N/LM} a_f(\epsilon ,\psi ,d) E_2(\epsilon ,\psi ;dz), \end{aligned}$$

where \(a_f(\epsilon ,\psi ,d)\) is as above (with \(k=2\)) and

$$\begin{aligned} c_f(\chi _1,\chi _1,d)&= -\frac{1}{d} \prod _{p \mid N} \frac{p^2}{p^2 - 1 } \sum _{\begin{array}{c} c \mid N \end{array} } {\mathcal {R}}_{2,\chi _1,\chi _1}(d,c) {\mathcal {S}}_{2,N,\chi _1,\chi _1}(d,c) [0]_{c,{\chi _1}}f \\&= -\frac{1}{d} a_f(\chi _1,\chi _1,d). \end{aligned}$$

On the other hand, we have

$$\begin{aligned} \sum _{1<d \mid N} c_f(\chi _1,\chi _1,d) L_d(z)&= \sum _{1<d \mid N} c_f(\chi _1,\chi _1,d) (E_2(\chi _1,\chi _1;z)-dE_2(\chi _1,\chi _1;dz))\\&=\sum _{1<d \mid N} c_f(\chi _1,\chi _1,d) E_2(\chi _1,\chi _1;z) \\&\qquad + \sum _{1<d \mid N} a_f(\chi _1,\chi _1,d) E_2(\chi _1,\chi _1;dz)\\&= \sum _{d \mid N} a_f(\chi _1,\chi _1,d) E_2(\chi _1,\chi _1;dz), \end{aligned}$$

since

$$\begin{aligned} a_f(\chi _1,\chi _1,1) \prod _{p \mid N} \frac{p^2-1}{p^2}&=\sum _{c \mid N} {\mathcal {R}}_{2,\chi _1,\chi _1}(1,c){\mathcal {S}}_{2,N,\chi _1,\chi _1}(1,c) [0]_{c,\chi _1} f \\&= \sum _{c \mid N} \frac{\mu (c)}{c^2} \sum _{1< d \mid N} c_f(\chi _1,\chi _1,d) \frac{d-\gcd (d,c)^2}{d} \\&=\sum _{1< d \mid N} c_f(\chi _1,\chi _1,d) \sum _{c \mid N} \frac{\mu (c)}{c^2} \frac{d-\gcd (d,c)^2}{d} \\&= \prod _{p \mid N} \frac{p^2-1}{p^2} \sum _{1< d \mid N} c_f(\chi _1,\chi _1,d), \end{aligned}$$

i.e., \(\sum _{1< d \mid N} c_f(\chi _1,\chi _1,d)=a_f(\chi _1,\chi _1,1)\). This completes the proof of the Main Theorem.

At last we prove a lemma which is useful in reducing the number of constant term computations in the applications of Theorem 1.

Lemma 6

Let \(f(z) \in M_k(\Gamma _0(N),\chi )\) and \(c \mid N\). Let a/c and \(a'/c\) be equivalent cusps of \(\Gamma _0(N)\). If \((\epsilon ,\psi ) \in {\mathcal {E}}(k,N,\chi )\) with \(M \mid c\), then we have

$$\begin{aligned} {\psi }(a)[0]_{a/c}f={\psi }(a')[0]_{a'/c}f. \end{aligned}$$

Proof

If a/c and \(a'/c\) are equivalent cusps of \(\Gamma _0(N)\), then there exists a matrix \(\begin{bmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{bmatrix} \in \Gamma _0(N)\) such that

$$\begin{aligned} \begin{bmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{bmatrix} \begin{bmatrix} a &{} b \\ c &{} d \end{bmatrix} = \begin{bmatrix} a' &{} b' \\ c &{} d' \end{bmatrix}. \end{aligned}$$
(43)

Then using transformation properties of modular forms we have

$$\begin{aligned} \psi (a') [0]_{a'/c} f&= \psi (a') \lim _{z \rightarrow i\infty } (cz+d')^{-k} f\left( \frac{a' z + b'}{cz + d'} \right) \\&= \psi (a') \lim _{z \rightarrow i\infty } (cz+d')^{-k} \chi (\delta ) \left( \gamma \frac{a z + b}{cz + d} + \delta \right) ^k f\left( \frac{a z + b}{cz + d} \right) \\&= \psi (a') \chi (\delta ) \lim _{z \rightarrow i\infty } (cz+d)^{-k} f\left( \frac{a z + b}{cz + d} \right) \\&= \psi (a') \chi (\delta ) [0]_{a/c}f. \end{aligned}$$

We have \(M\mid c\) and by (43) we have \(a'=\alpha a + \beta c\), thus \(\psi (a')=\psi (\alpha )\psi ( a)\). Since \(M \mid c\), \(c \mid N\), and \(N \mid \gamma \), we have \(M \mid \gamma \), therefore, we have \( 1= \psi (1)= \psi ( \alpha \delta - \gamma \beta )\) which implies \(\psi (\alpha ) = {\overline{\psi }}(\delta )\). Putting these together, we obtain

$$\begin{aligned} \psi (a') \chi (\delta )= \psi (a) {\overline{\psi }}(\delta ) \chi (\delta ). \end{aligned}$$

Since \(\gcd (\delta ,N)=1\) we have \({\overline{\psi }}(\delta ) \chi (\delta )=\epsilon (\delta )\). Now, we prove \(\epsilon (\delta )=1\) which finishes the proof. Recall that \(LM \mid N\), therefore, \(c \mid M\) implies \(L \mid N/c\), i.e., \(L \mid \gamma /c\). From (43) we have \(\delta = 1 - a \gamma /c\), thus, since \(\gcd (a,c)=1\) and \(L \mid \gamma /c\), we have \(\epsilon (\delta )=\epsilon (1 - a \gamma /c)=\epsilon (1)=1\). \(\square \)