1 Introduction and some basic facts

1.1 Introduction

It is a profound problem in analytic number theory to understand the distribution of values of \(L(s,\chi _{p})\), the Dirichlet L-functions associated to the quadratic character \(\chi _{p}\), for fixed s and variable p, where for a prime number \(p\equiv v \pmod 4\) with \(v=1\) or 3, the quadratic character \(\chi _{p}(n)\) is defined by the Legendre symbol \(\chi _{p}(n)=(\frac{n}{p})\). The problem about the distribution of values of Dirichlet L-functions with real characters \(\chi \) modulo a prime p was first studied by Elliot [9] and later some of his results were generalized by Stankus [18].

For \(\mathrm {Re}(s)>\frac{1}{2}\), Stankus proved that \(L(s,\chi _{p})\) is in a given Borel set B in the complex plane with a certain probability which depends on s and B. However, the same question is non-trivial if we consider s in the center of the critical strip, i.e., \(\mathrm {Re}(s)=\frac{1}{2}\). In particular, it is a challenging (and open) problem to decide whether \(L\big (\tfrac{1}{2},\chi _{p}\big ) \ne 0\) for all quadratic characters \(\chi _{p}\). Appears that this fact was first conjectured by Chowla [8].

It is also a difficult problem to determine whether or not \(L\big (\tfrac{1}{2},\chi _{p}\big )\ne 0\) for infinitely many primes p. A natural strategy to attack this problem is to prove that \(L\big (\tfrac{1}{2},\chi _{p}\big )\) has a positive average value when \(0<p\le X\) and X is large. That is,

$$\begin{aligned} \sum _{\begin{array}{c} p\le X \\ p\equiv v \pmod 4 \end{array}} L\left( \tfrac{1}{2},\chi _{p}\right) > 0, \end{aligned}$$
(1.1)

when X is large. In this context, Goldfeld and Viola [10] have conjectured an asymptotic formula for

$$\begin{aligned} \sum _{\begin{array}{c} p\le X \\ p\equiv v \pmod 4 \end{array}}L\left( \tfrac{1}{2},\chi _{p}\right) , \end{aligned}$$
(1.2)

and Jutila [13] was able to establish the following asymptotic formula:

Theorem 1.1

(Jutila) For \(v=1\) or 3, we have

$$\begin{aligned} \sum _{\begin{array}{c} p\le X \\ p\equiv v \pmod 4 \end{array}}(\log p)L\left( \tfrac{1}{2},\chi _{p}\right)= & {} \frac{1}{4}X \left\{ \log (X/\pi ) +\frac{\varGamma '}{\varGamma }(v/4)+4\gamma -1\right\} \nonumber \\&+\, O\big (X(\log X)^{-A}\big ), \end{aligned}$$
(1.3)

where the implied constant is not effectively calculable. The following estimate is effective:

$$\begin{aligned} \sum _{\begin{array}{c} p\le X \\ p\equiv v \pmod 4 \end{array}}(\log p)L\left( \tfrac{1}{2},\chi _{p}\right) = \frac{1}{4}X\log X +O\big (X(\log X)^{\varepsilon }\big ). \end{aligned}$$
(1.4)

In a recent paper [4], the authors raise the question about higher moments for the family of quadratic Dirichlet L-functions associated to \(\chi _{p}\). In other words, the problem is

Problem 1.2

Establish asymptotic formulas for

$$\begin{aligned} \sum _{\begin{array}{c} p\le X \\ p\equiv v \pmod 4 \end{array}}L\left( \tfrac{1}{2},\chi _{p}\right) ^{k}, \end{aligned}$$
(1.5)

when \(X\rightarrow \infty \) and \(k>1\).

The only known asymptotic formulae for (1.5) are those given in Theorem 1.1, i.e., we have asymptotic formulas merely when \(k=1\) and it is an important open problem for \(k>1\).

The first aim of this paper is to study the function field analogue of the problem above in the same spirit as those recent results obtained by Andrade [1] and Andrade and Keating [24] and extend their results. The second aim of the paper is to derive asymptotic formulas for the mean values of quadratic Dirichlet L-functions over the rational function field at the special point \(s=1\) and as an immediate corollary to obtain the mean values of the associated class numbers over function fields.

One of the main novelties of this paper is that we compute the second moment of quadratic Dirichlet L-functions associated to monic irreducible polynomials of even degree (the odd degree case was computed by Andrade and Keating [4]), and in this way we are able to go beyond of what is known in the number field case. The second innovation of this paper comes from the fact that, if the cardinality of the ground field is even then the task of average L-functions in function fields is much harder and, in this paper, we are able to handle this strenuous case and establish several mean values results of L-functions over function fields. (See next section for more details.)

1.2 Zeta function of curves

Let \(\mathbb {F}_{q}\) be a finite field of odd cardinality, \(\mathbb {A}=\mathbb {F}_{q}[T]\) the polynomial ring over \(\mathbb {F}_{q}\) and we denote by \(k=\mathbb {F}_{q}(T)\) the rational function field over \(\mathbb {F}_{q}\). We consider C to be any smooth, projective, geometrically connected curve of genus \(g\ge 1\) defined over the finite field \(\mathbb {F}_{q}\). In this setting Artin [5] has defined the zeta function of the curve C as

$$\begin{aligned} Z_{C}(u):=\exp \left( \sum _{n=1}^{\infty }N_{n}(C)\frac{u^{n}}{n}\right) , \quad |u|<\frac{1}{q} \end{aligned}$$
(1.6)

where \(N_{n}(C):=\mathrm {Card}(C(\mathbb {F}_{q}))\) is the number of points on C with coordinates in a field extension \(\mathbb {F}_{q^{n}}\) of \(\mathbb {F}_{q}\) of degree \(n\ge 1\) and \(u=q^{-s}\). It is well known that the zeta function attached to C is a rational function as proved by Weil [19] and in this case is presented in the following form

$$\begin{aligned} Z_{C}(u)=\frac{L_{C}(u)}{(1-u)(1-qu)}, \end{aligned}$$
(1.7)

where \(L_{C}(u)\in \mathbb {Z}[u]\) is a polynomial of degree 2g, called the \({\varvec{L}}\)-polynomial of the curve C. The Riemann–Roch theorem for function fields (see [16, Theorem 5.4 and Theorem 5.9]) show us that \(L_{C}(u)\) satisfies the following functional equation:

$$\begin{aligned} L_{C}(u)=(qu^{2})^{g}L_{C}\left( \frac{1}{qu}\right) . \end{aligned}$$
(1.8)

And the Riemann hypothesis for curves over finite fields is a theorem in this setting, which was established by Weil [19] in 1948, and it says that the zeros of \(L_{C}(u)\) all lie on the circle \(|u|=q^{-\frac{1}{2}}\), i.e.,

$$\begin{aligned} L_{C}(u)=\prod _{j=1}^{2g}(1-\alpha _{j}u), \quad \text { with } |\alpha _{j}|=\sqrt{q}\, \text { for all } j. \end{aligned}$$
(1.9)

1.3 Some background on \(\mathbb {A}= \mathbb {F}_{q}[T]\)

Let \(\mathbb {A}^+\) denote the set of monic polynomials in \(\mathbb {A}\) and \(\mathbb P\) denote the set of monic irreducible polynomials in \(\mathbb {A}\). For a positive integer n we denote by \(\mathbb {A}_{n}^{+}\) to be the set of monic polynomials in \(\mathbb {A}\) of degree n and by \(\mathbb P_{n}\) to be the set of monic irreducible polynomials in \(\mathbb {A}\) of degree n. Throughout this paper, a monic irreducible polynomial \(P\in \mathbb {P}\) will be also called a “prime” polynomial. The norm of a polynomial \(f\in \mathbb {A}\) is defined to be \(|f|:=q^{\mathrm {deg}(f)}\) for \(f\ne 0\), and \(|f|=0\) for \(f=0\). The sign \(\hbox {sgn}(f)\) of f is the leading coefficient of f. The zeta function of \(\mathbb {A}\) is defined for \(\mathrm {Re}(s)>1\) to be the following infinite series

$$\begin{aligned} \zeta _{\mathbb {A}}(s):=\sum _{f\in \mathbb {A}^{+}} |f|^{-s} = \prod _{P\in \mathbb P}\left( 1-|P|^{-s}\right) ^{-1}, \quad \mathrm {Re}(s)>1. \end{aligned}$$
(1.10)

It is easy to show (see [16, Chapter 2]) that the zeta function \(\zeta _{\mathbb {A}}(s)\) is a very simple function and can be rewritten as

$$\begin{aligned} \zeta _{\mathbb {A}}(s)=\frac{1}{1-q^{1-s}}. \end{aligned}$$
(1.11)

The monic irreducible polynomials in \(\mathbb {A}=\mathbb {F}_{q}[T]\) also satisfies the analogue of the prime number theorem. In other words we have the following Theorem [16, Theorem 2.2].

Theorem 1.3

(Prime polynomial theorem) Let \(\pi _{\mathbb {A}}(n)\) denote the number of monic irreducible polynomials in \(\mathbb {A}\) of degree n. Then, we have

$$\begin{aligned} \pi _{\mathbb {A}}(n)=\#\mathbb {P}_{n}=\frac{q^{n}}{n}+O\left( \frac{q^{\tfrac{n}{2}}}{n}\right) . \end{aligned}$$
(1.12)

Hoffstein and Rosen [11] were one of the first to study mean values of L-functions over function fields. In their beautiful paper, they established several mean values of L-series over the rational function field they considered averages over all monic polynomials, as well as the sum over square-free polynomials in \(\mathbb {F}_{q}[T]\). But in their paper, they never consider mean values of L-functions associated to monic irreducible polynomials over \(\mathbb {F}_{q}[T]\). In this paper, we investigate the problem of averaging L-functions over prime polynomials and we compute the first and the second moment of several families of L-functions, thus extending the pioneering work of Hoffstein and Rosen. It is also important to note that our methods are totally different from those used by Hoffstein and Rosen and are based on the use of the approximate functional equation for function fields.

2 Statement of results

2.1 Odd characteristic case

In this subsection we assume that q is odd. First we present some preliminary facts on quadratic Dirichlet L-functions for the rational function field \(k = \mathbb {F}_{q}(T)\) and for this we use Rosen’s book [16] as a guide to the notations and definitions. We also present the results of Andrade and Keating [4], which is the main inspiration for this article.

2.1.1 Quadratic Dirichlet L-function attached to \(\chi _{D}\)

Fix a generator \(\gamma \) of \(\mathbb {F}_{q}^{\times }\). Let \(\mathbb H\) be the set of non-constant square-free polynomials D in \(\mathbb {A}\) with \(\hbox {sgn}(D) \in \{1, \gamma \}\). Then any quadratic extension K of k can be written uniquely as \(K= K_{D} := k(\sqrt{D})\) for \(D\in \mathbb H\). The infinite prime \(\infty = (1/T)\) of k is ramified, split, or inert in \(K_{D}\) accordingly as \(\deg (D)\) is odd, \(\deg (D)\) is even and \(\hbox {sgn}(D)=1\), or \(\deg (D)\) is even and \(\hbox {sgn}(D)=\gamma \). Then \(K_{D}\) is called ramified imaginary, real, or inert imaginary, respectively. The genus \(g_{D}\) of \(K_{D}\) is given by

$$\begin{aligned} g_{D} = \left[ \frac{\deg (D)+1}{2}\right] - 1 = {\left\{ \begin{array}{ll} \frac{1}{2}(\deg (D)-1) &{} \text {if } \deg (D) \text { is odd,} \\ \frac{1}{2} \deg (D)-1 &{} \text {if } \deg (D) \text { is even.} \end{array}\right. } \end{aligned}$$
(2.1)

For \(D\in \mathbb H\), let \(\chi _{D}\) be the quadratic Dirichlet character modulo D defined by the Kronecker symbol \(\chi _{D}(f) = \big (\frac{D}{f}\big )\) with \(f\in \mathbb {A}\). For more details about Dirichlet characters for polynomials over finite fields see [16, Chapters 3, 4]. The L-function associated to the character \(\chi _{D}\) is defined by the following Dirichlet series

$$\begin{aligned} L(s,\chi _{D}) := \sum _{f\in \mathbb {A}^{+}} \chi _{D}(f) |f|^{-s} = \prod _{P\in \mathbb P} \left( 1-\chi _{D}(P) |P|^{-s}\right) ^{-1}, \quad \mathrm{Re}(s) > 1. \end{aligned}$$
(2.2)

From [16, Propositions 4.3, 14.6 and 17.7], we have that \(L(s,\chi _{D})\) is a polynomial in \(z=q^{-s}\) of degree \(\deg (D)-1\). Also we have that the quadratic Dirichlet L-function associated to \(\chi _{D}\), \(\mathcal {L}(z,\chi _{D})=L(s,\chi _{D})\), has a “trivial” zero at \(z=1\) (resp. \(z=-1\)) if and only if \(\deg (D)\) is even and \(\hbox {sgn}(D)=1\) (resp. \(\deg (D)\) is even and \(\hbox {sgn}(D)=\gamma \)) and so we can define the “completed” L-function as

$$\begin{aligned} \mathcal {L}^{*}(z,\chi _{D}) = {\left\{ \begin{array}{ll} \mathcal {L}(z,\chi _{D}) &{} \text { if } \deg (D) \text { is odd,} \\ (1-z)^{-1} \mathcal {L}(z,\chi _{D}) &{} \text { if }\deg (D) \text { is even and } \hbox {sgn}(D) = 1, \\ (1+z)^{-1} \mathcal {L}(z,\chi _{D}) &{} \text { if } \deg (D) \text { is even and } \hbox {sgn}(D) = \gamma , \end{array}\right. } \end{aligned}$$
(2.3)

which is a polynomial of even degree \(2 g_{D}\) and satisfies the functional equation

$$\begin{aligned} \mathcal {L}^{*}(z,\chi _{D})=(qz^{2})^{g_{D}}\mathcal {L}^{*}\left( \frac{1}{qz},\chi _{D}\right) . \end{aligned}$$
(2.4)

In all cases, we have that

$$\begin{aligned} \mathcal {L}^{*}(z,\chi _{D})=L_{C_{D}}(z), \end{aligned}$$
(2.5)

where \(L_{C_{D}}(z)\) is the numerator of the zeta function associated to the hyperelliptic curve given in the affine form by

$$\begin{aligned} C_{D} : y^{2}=D(T). \end{aligned}$$
(2.6)

The following proposition is quoted from Rudnick [17], and it is proved by using the explicit formula for \(L(s,\chi _{P})\) and the Riemann hypothesis for curves.

Proposition 2.1

For any non-constant monic polynomial \(f\in \mathbb {A}^{+}\), which is not a perfect square, we have

$$\begin{aligned} \Bigg |\sum _{P\in \mathbb P_{n}}\left( \frac{f}{P}\right) \Bigg |\ll \frac{\mathrm {deg}(f)}{n}q^{n/2}. \end{aligned}$$
(2.7)

2.1.2 The prime hyperelliptic ensemble

We consider \(\mathbb P_{n}\) as a probability space (ensemble) with the uniform probability measure attached to it. So the expected value of any function F on \(\mathbb P_{n}\) is defined as

$$\begin{aligned} \left\langle F\right\rangle _{n}:=\frac{1}{\#\mathbb {P}_{n}}\sum _{P\in \mathbb {P}_{n}}F(P). \end{aligned}$$
(2.8)

Using Theorem 1.3 we have that

$$\begin{aligned} \frac{1}{\#\mathbb {P}_{n}}\sim \frac{\log _{q}|P|}{|P|}, \quad \text {as } n\rightarrow \infty , \end{aligned}$$
(2.9)

and thus we may write the expected value as

$$\begin{aligned} \left\langle F(P)\right\rangle _{n}\sim \frac{\log _{q}|P|}{|P|}\sum _{P\in \mathbb {P}_{n}}F(P), \quad \text {as } n\rightarrow \infty . \end{aligned}$$
(2.10)

2.1.3 Main results

In this section we present the main theorems of this paper and we also state the previous results of Andrade and Keating [4], which is the main motivation for this paper.

From Andrade and Keating we have the following mean value theorem:

Theorem 2.2

(Andrade and Keating [4]) Let \(\mathbb {F}_{q}\) be a fixed finite field of odd cardinality with \(q\equiv 1 \pmod 4\). Then for every \(\varepsilon >0\) we have,

$$\begin{aligned} \sum _{P\in \mathbb {P}_{2g+1}}(\log _{q}|P|)L\left( \tfrac{1}{2},\chi _{P}\right) =\frac{|P|}{2}(\log _{q}|P|+1)+O\left( |P|^{\tfrac{3}{4}+\varepsilon }\right) \end{aligned}$$
(2.11)

and

$$\begin{aligned} \sum _{P\in \mathbb {P}_{2g+1}}L\left( \tfrac{1}{2},\chi _{P}\right) ^{2}= \frac{1}{24}\frac{1}{\zeta _{\mathbb {A}}(2)}|P|(\log _{q}|P|)^{2}+O\big (|P|(\log _{q}|P|)\big ). \end{aligned}$$
(2.12)

The results of Andrade and Keating correspond to the average of quadratic Dirichlet L-function associated to the imaginary quadratic function field \(k(\sqrt{P})\), i.e., it is the function field analogue of the Problem 1.2 with \(v=3\). In this paper we extend the results of Andrade and Keating by establishing the corresponding asymptotic formulas for the case of quadratic Dirichlet L-functions associated to the real quadratic function field \(k(\sqrt{P})\), which is the function field analogue of the Problem 1.2 with \(v=1\). It is again worth noting that in the classical case (number fields) only asymptotics formulas for the first moment of this family are known. But in function fields, we can do better by establishing the second moment. We also establish the corresponding asymptotic formulas for the case of quadratic Dirichlet L-functions associated to the inert imaginary quadratic function field \(k(\sqrt{\gamma P})\). In addition, we derive asymptotic formulas for the mean values of quadratic Dirichlet prime L-functions at \(s=1\) and \(s=2\), which are connected to the mean values of the ideal class numbers and to the cardinalities of second K-groups. Our main results are presented below.

A prime L-function is the L-function associated to the quadratic character \(\chi _{P}\) where P is a prime polynomial. For the first moment of prime L-functions, we have the following theorem.

Theorem 2.3

Let \(\mathbb {F}_{q}\) be a fixed finite field with q being a power of an odd prime.

  1. 1.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{2g+1}} L(s,\chi _{P}) = I_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O(|P|^{1-\frac{s}{2}}) &{} \hbox {if} \quad \mathrm{Re}(s) < 1, \\ O(|P|^{\frac{1}{2}} (\log _{q}|P|)) &{} \hbox {if} \quad \mathrm{Re}(s) \ge 1, \end{array}\right. } \end{aligned}$$
    (2.13)

    as \(g\rightarrow \infty \) with

    $$\begin{aligned} I_{g}(s) := {\left\{ \begin{array}{ll} g + 1 &{} \hbox {if}\,\,\,s = \frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) (1- q^{(1+g)(1-2s)}) &{} \hbox {if}\,\,\,\frac{1}{2} \le \mathrm{Re}(s) < 1 \left( s \ne \frac{1}{2}\right) . \\ \zeta _{\mathbb {A}}(2s) &{} \hbox {if} \,\,\,\mathrm{Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
    (2.14)
  2. 2.

    For any \(\epsilon >0\) and for \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\) and \(|s-1|>\epsilon \), we have

    $$\begin{aligned} \!\! \sum _{P\in \mathbb P_{2g+2}} L(s,\chi _{P}) = J_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O(|P|^{1-\frac{s}{2}}) &{} \hbox {if} \,\,\mathrm{Re}(s) < 1, \\ O\left( |P|^{\frac{1}{2}} (\log _{q}|P|)\right) &{} \hbox {if}\,\,\mathrm{Re}(s) \ge 1, \, {and}\, (s\ne 1), \end{array}\right. } \end{aligned}$$
    (2.15)

    as \(g\rightarrow \infty \) with

    $$\begin{aligned} J_{g}(s) := {\left\{ \begin{array}{ll} g + 1 + \zeta _{\mathbb {A}}(\frac{1}{2}) &{} \hbox {if}\,\,\, s = \frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) J'_{g}(s) - \zeta _{\mathbb {A}}(2) J_{g}^{*}(s) &{} \hbox {if}\,\,\,\frac{1}{2} \le \mathrm{Re}(s)< 1 ~\left( s\ne \frac{1}{2}\right) , \\ \zeta _{\mathbb {A}}(2s) J''_{g}(s) - \zeta _{\mathbb {A}}(2) J_{g}^{*}(s) &{} \hbox {if}\,\,\,1 \le \mathrm{Re}(s) < \frac{3}{2} ~(s\ne 1), \\ \zeta _{\mathbb {A}}(2s) &{} \hbox {if}\,\,\,\mathrm{Re}(s) \ge \frac{3}{2},\end{array}\right. } \end{aligned}$$
    (2.16)

    where

    $$\begin{aligned} J'_{g}(s)&= 1 - q^{\left( \left[ \frac{g}{2}+1\right] \right) (1-2s)} + \frac{\zeta _{\mathbb {A}}(2-s)}{\zeta _{\mathbb {A}}(1+s)} \left( q^{\left( g-\big [\frac{g-1}{2}\big ]\right) (1-2s)} - q^{(g+1)(1-2s)}\right) , \qquad \end{aligned}$$
    (2.17)
    $$\begin{aligned} J''_{g}(s)&= 1 - q^{\left( \left[ \frac{g}{2}+1\right] \right) (1-2s)} + \frac{\zeta _{\mathbb {A}}(2-s)}{\zeta _{\mathbb {A}}(1+s)} q^{\left( g-\big [\frac{g-1}{2}\big ]\right) (1-2s)}, \end{aligned}$$
    (2.18)
    $$\begin{aligned} J_{g}^{*}(s)&= q^{\big [\frac{g}{2}\big ]-(g+1)s} + \frac{\zeta _{\mathbb {A}}(2-s)}{\zeta _{\mathbb {A}}(1+s)} q^{\big [\frac{g-1}{2}\big ]-gs}, \end{aligned}$$
    (2.19)

    and, for \(s=1\), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(1,\chi _{P}) = \zeta _{\mathbb {A}}(2) \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}} (\log _{q}|P|)\right) . \end{aligned}$$
    (2.20)
  3. 3.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(s,\chi _{\gamma {P}}) = K_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O(|P|^{1-\frac{s}{2}}) &{} \hbox {if}\,\,\,\mathrm{Re}(s) < 1, \\ O\left( |P|^{\frac{1}{2}} (\log _{q}|P|)\right) &{} \hbox {if}\,\,\,\mathrm{Re}(s) \ge 1, \end{array}\right. } \end{aligned}$$
    (2.21)

    as \(g\rightarrow \infty \) with

    $$\begin{aligned} K_{g}(s) := {\left\{ \begin{array}{ll} g+1+\zeta _{\mathbb {A}}(0) \zeta _{\mathbb {A}}(\frac{1}{2})^{-1} &{} \hbox {if}\,\,\,s=\frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) K'_{g}(s) + \zeta _{\mathbb {A}}(2) K^{*}_{g}(s) &{} \hbox {if}\,\,\,\frac{1}{2} \le \mathrm{Re}(s)< 1 \left( s\ne \frac{1}{2}\right) , \\ \zeta _{\mathbb {A}}(2s) K''_{g}(s) + \zeta _{\mathbb {A}}(2) K^{*}_{g}(s) &{} \hbox {if}\,\,\, 1 \le \mathrm{Re}(s) < \frac{3}{2}, \\ \zeta _{\mathbb {A}}(2s) &{} \hbox {if}\,\,\,\frac{3}{2} \le \mathrm{Re}(s), \end{array}\right. } \end{aligned}$$
    (2.22)

    where

    $$\begin{aligned} K'_{g}(s)&= 1 - q^{\left( \big [\frac{g}{2}+1\big ]\right) (1-2s)} + \tfrac{1+q^{-s}}{1+q^{s-1}} \left( q^{\left( g-\big [\frac{g-1}{2}\big ]\right) (1-2s)} - q^{(g+1)(1-2s)}\right) , \end{aligned}$$
    (2.23)
    $$\begin{aligned} K''_{g}(s)&= 1 - q^{\left( \big [\frac{g}{2}+1\big ]\right) (1-2s)} + \tfrac{1+q^{-s}}{1+q^{s-1}} q^{\left( g-\big [\frac{g-1}{2}\big ]\right) (1-2s)}, \end{aligned}$$
    (2.24)
    $$\begin{aligned} K_{g}^{*}(s)&= (-1)^{g} q^{\big [\frac{g}{2}\big ]-(g+1)s} + (-1)^{g+1}\tfrac{1+q^{-s}}{1+q^{s-1}} q^{\big [\frac{g-1}{2}\big ]-gs}. \end{aligned}$$
    (2.25)

Remark 2.4

Note that in many of our estimates (e.g., when we use the O and \(\ll \) notations) the implied constant may depend on q.

From Theorem 2.3 (2) and (3), we have the following corollary.

Corollary 2.5

Let q be a fixed power of an odd prime. For every \(\varepsilon >0\), we have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} (\log _{q}|P|) L\big (\tfrac{1}{2},\chi _{P}\big ) = \frac{1}{2} \big (\log _{q}|P| + 2\zeta _{\mathbb {A}}\big (\tfrac{1}{2}\big )\big ) |P| + O\big (|P|^{\frac{3}{4}+\varepsilon }\big ), \end{aligned}$$
    (2.26)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} (\log _{q}|P|) L\big (\tfrac{1}{2},\chi _{\gamma P}\big ) = \frac{1}{2} \big (\log _{q}|P| + 2\zeta _{\mathbb {A}}(0) \zeta _{\mathbb {A}}\big (\tfrac{1}{2}\big )^{-1}\big ) |P| + O\big (|P|^{\frac{3}{4}+\varepsilon }\big ),\nonumber \\ \end{aligned}$$
    (2.27)

as \(g\rightarrow \infty \).

For the second moment of prime L-functions at \(s=\frac{1}{2}\), we have the following theorem.

Theorem 2.6

Let q be a fixed power of an odd prime. As \(g\rightarrow \infty \), we have that

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L(\tfrac{1}{2},\chi _{P})^{2} = \frac{1}{24 \zeta _{\mathbb {A}}(2)} |P| (\log _{q}|P|)^2 + O\big (|P| (\log _{q}|P|)\big ), \end{aligned}$$
    (2.28)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L(\tfrac{1}{2},\chi _{\gamma {P}})^{2} = \frac{1}{24 \zeta _{\mathbb {A}}(2)} |P| (\log _{q}|P|)^2 + O\big (|P| (\log _{q}|P|)\big ). \end{aligned}$$
    (2.29)

From Theorem 2.3 (2), (3), Theorem 2.6, and (2.10), we obtain the following corollaries. Observe that Corollary 2.8 below is about non-vanishing results of quadratic Dirichlet L-functions over function fields.

Corollary 2.7

With q kept fixed power of an odd prime and \(g\rightarrow \infty \), we have

$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{P}\right) \right\rangle _{2g+2}&\sim \frac{1}{2}\big (\log _{q}|P|+2\zeta _{\mathbb {A}}\big (\tfrac{1}{2}\big )\big ), \end{aligned}$$
(2.30)
$$\begin{aligned} \left\langle L(\tfrac{1}{2},\chi _{\gamma P})\right\rangle _{2g+2}&\sim \frac{1}{2}\big (\log _{q}|P|+2\zeta _{\mathbb {A}}(0)\zeta _{\mathbb {A}}\big (\tfrac{1}{2}\big )^{-1}\big ) \end{aligned}$$
(2.31)

and

$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{P}\right) ^{2}\right\rangle _{2g+2}&\sim \frac{1}{24\zeta _{\mathbb {A}}(2)}(\log _{q}|P|)^{3}, \end{aligned}$$
(2.32)
$$\begin{aligned} \left\langle L(\tfrac{1}{2},\chi _{\gamma P})^{2}\right\rangle _{2g+2}&\sim \frac{1}{24\zeta _{\mathbb {A}}(2)}(\log _{q}|P|)^{3}. \end{aligned}$$
(2.33)

Corollary 2.8

With q kept fixed power of an odd prime and \(g\rightarrow \infty \), we have

$$\begin{aligned} \sum _{\begin{array}{c} P\in \mathbb {P}_{2g+2} \\ L\left( \tfrac{1}{2},\chi _{P}\right) \ne 0 \end{array}} 1 \gg \frac{|P|}{(\log _{q}|P|)^{2}} \end{aligned}$$
(2.34)

and

$$\begin{aligned} \sum _{\begin{array}{c} P\in \mathbb {P}_{2g+2} \\ L\left( \tfrac{1}{2},\chi _{\gamma P}\right) \ne 0 \end{array}} 1 \gg \frac{|P|}{(\log _{q}|P|)^{2}}. \end{aligned}$$
(2.35)

Proof

We only give the proof of (2.34). A similar argument will give the proof of (2.35). From Theorem 2.3 (2) and Theorem 2.6 (1), we have

$$\begin{aligned} \sum _{P\in \mathbb {P}_{2g+2}}L\left( \tfrac{1}{2},\chi _{P}\right) \sim c_{1}|P| \end{aligned}$$
(2.36)

and

$$\begin{aligned} \sum _{P\in \mathbb {P}_{2g+2}}L\left( \tfrac{1}{2},\chi _{P}\right) ^{2}\sim c_{2}|P|(\log _{q}|P|)^{2}, \end{aligned}$$
(2.37)

where \(c_{1}\) and \(c_{2}\) are the constants given in the above theorems. By applying Cauchy–Schwarz inequality we have that the number of monic irreducible polynomials \(P\in \mathbb {P}_{2g+2}\) such that \(L\left( \tfrac{1}{2},\chi _{P}\right) \ne 0\) exceeds the ratio of the square of the quantity in (2.36) to the quantity in (2.37). \(\square \)

A simple computation shows that \(K_{g}(1) = \zeta _{\mathbb {A}}(2)\). For the mean value of prime L-functions at \(s=1\), from Theorem 2.3, we have the following:

Theorem 2.9

Let q be a fixed power of an odd prime. For every \(\varepsilon >0\), we have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+1}} L(1,\chi _{P}) = \zeta _{\mathbb {A}}(2) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}+\varepsilon }\big ), \end{aligned}$$
    (2.38)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L(1,\chi _{P}) = \zeta _{\mathbb {A}}(2) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}+\varepsilon }\big ), \end{aligned}$$
    (2.39)
  3. 3.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L(1,\chi _{\gamma {P}}) = \zeta _{\mathbb {A}}(2) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}+\varepsilon }\big ), \end{aligned}$$
    (2.40)

as \(g\rightarrow \infty \).

For any non-constant square-free polynomial \(D\in \mathbb {A}\) with \(\hbox {sgn}(D)\in \{1, \gamma \}\), let \(\mathcal {O}_{D}\) be the integral closure of \(\mathbb {A}\) in the quadratic function field \(k(\sqrt{D})\). Let \(h_{D}\) be the ideal class number of \(\mathcal {O}_{D}\), and \(R_{D}\) be the regulator of \(\mathcal {O}_{D}\) if \(\deg (D)\) is even and \(\hbox {sgn}(D) = 1\). We have a formula which connects \(L(1, \chi _{D})\) with \(h_{D}\) [16, Theorem 17.8A]:

$$\begin{aligned} L(1, \chi _{D}) = {\left\{ \begin{array}{ll} \sqrt{q}~ |D|^{-\frac{1}{2}} h_{D} &{} \text { if } \deg (D) \text { is odd,} \\ (q-1) |D|^{-\frac{1}{2}} h_{D} R_{D} &{} \text { if } \deg (D) \text { is even and } \hbox {sgn} (D)=1, \\ \frac{1}{2} (q+1) |D|^{-\frac{1}{2}} h_{D} &{} \text { if } \deg (D) \text { is even and } \hbox {sgn} (D)=\gamma . \\ \end{array}\right. } \end{aligned}$$
(2.41)

By combining Theorem 2.9 and (2.41), we obtain the following corollary.

Corollary 2.10

Let q be a fixed power of an odd prime. For every \(\varepsilon >0\), we have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+1}} h_{P} = \frac{\zeta _{\mathbb {A}}(2)}{\sqrt{q}} \frac{|P|^{\frac{3}{2}}}{\log _{q}|P|} + O(|P|^{1+\varepsilon }), \end{aligned}$$
    (2.42)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} h_{P} R_{P} = q^{-1} \zeta _{\mathbb {A}}(2)^2 \frac{|P|^{\frac{3}{2}}}{\log _{q}|P|} + O(|P|^{1+\varepsilon }), \end{aligned}$$
    (2.43)
  3. 3.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} h_{P} = 2 q^{-1} \zeta _{\mathbb {A}}(3) \frac{|P|^{\frac{3}{2}}}{\log _{q}|P|} + O(|P|^{1+\varepsilon }), \end{aligned}$$
    (2.44)

as \(g\rightarrow \infty \).

For any non-constant square-free polynomial \(D\in \mathbb {A}\) with \(\hbox {sgn}(D)\in \{1, \gamma \}\), let \(K_{2}(\mathcal {O}_{D})\) be the second K-group of \(\mathcal {O}_{D}\). We have a formula which connects \(L(2,\chi _{D})\) with the cardinality \(\#K_{2}(\mathcal {O}_{D})\) of \(K_{2}(\mathcal {O}_{D})\) [15, Proposition 2]:

$$\begin{aligned} L(2, \chi _{D}) = {\left\{ \begin{array}{ll} q^{\frac{3}{2}} |D|^{-\frac{3}{2}} \#K_{2}(\mathcal {O}_{D}) &{} \text { if } \deg (D) \text { is odd,} \\ \frac{\zeta _{\mathbb {A}}(2)}{\zeta _{\mathbb {A}}(3)} q^{2} |D|^{-\frac{3}{2}} \#K_{2}(\mathcal {O}_{D}) &{} \text { if } \deg (D) \text { is even and } \hbox {sgn}(D)=1, \\ \frac{\zeta _{\mathbb {A}}(3)^2}{\zeta _{\mathbb {A}}(2)\zeta _{\mathbb {A}}(5)} q^{2} |D|^{-\frac{3}{2}} \#K_{2}(\mathcal {O}_{D}) &{} \text { if } \deg (D) \text { is even and } \hbox {sgn}(D)=\gamma . \\ \end{array}\right. } \end{aligned}$$
(2.45)

For the mean value of prime L-functions at \(s=2\), as an application of Theorem 2.3, we have the following.

Theorem 2.11

Let q be a fixed power of an odd prime. For every \(\varepsilon >0\), we have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+1}} L(2,\chi _{P}) = \zeta _{\mathbb {A}}(4) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}+\varepsilon }\big ), \end{aligned}$$
    (2.46)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L(2,\chi _{P}) = \zeta _{\mathbb {A}}(4) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}+\varepsilon }\big ), \end{aligned}$$
    (2.47)
  3. 3.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L(2,\chi _{\gamma {P}}) = \zeta _{\mathbb {A}}(4) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}+\varepsilon }\big ), \end{aligned}$$
    (2.48)

as \(g\rightarrow \infty \).

Putting together Theorem 2.11 and (2.45), we obtain the following corollary.

Corollary 2.12

Let q be a fixed power of an odd prime. For every \(\varepsilon >0\), we have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+1}} \#K_{2}(\mathcal {O}_{P}) = q^{-\frac{3}{2}} \zeta _{\mathbb {A}}(4) \frac{|P|^{\frac{5}{2}}}{\log _{q}|P|} + O(|P|^{2+\varepsilon }), \end{aligned}$$
    (2.49)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} \#K_{2}(\mathcal {O}_{P}) = q^{-2} \frac{\zeta _{\mathbb {A}}(3) \zeta _{\mathbb {A}}(4)}{\zeta _{\mathbb {A}}(2)} \frac{|P|^{\frac{5}{2}}}{\log _{q}|P|} + O(|P|^{2+\varepsilon }), \end{aligned}$$
    (2.50)
  3. 3.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} \#K_{2}(\mathcal {O}_{\gamma P}) = q^{-2} \frac{\zeta _{\mathbb {A}}(2) \zeta _{\mathbb {A}}(4) \zeta _{\mathbb {A}}(5)}{\zeta _{\mathbb {A}}(3)^2} \frac{|P|^{\frac{5}{2}}}{\log _{q}|P|} + O(|P|^{2+\varepsilon }), \end{aligned}$$
    (2.51)

as \(g\rightarrow \infty \).

2.2 Even characteristic case

We now will handle the more difficult case. In this section we assume that q is a power of 2.

2.2.1 Quadratic function fields of even characteristic

The theory of quadratic function fields of even characteristic was first developed in [7], and we sketch below the basics on function fields of characteristic even. Every separable quadratic extension K of k is of the form \(K = K_{u} := k(x_{u})\), where \(x_{u}\) is a zero of \(X^2+X+u=0\) for \(u\in k\). Let \(\wp : k \rightarrow k\) be the additive homomorphism defined by \(\wp (x) = x^2 + x\). Two extensions \(K_{u}\) and \(K_{v}\) are equal if and only if \(x_{v} = \alpha x_{u} + w, v = \alpha u + \wp (w)\) for some \(\alpha \in \mathbb {F}_{q}^{\times }\) and \(w\in k\). Hence, we can normalize u to satisfy the following conditions (see [12]):

$$\begin{aligned}&u = \sum _{i=1}^{m} \frac{Q_{i}}{P_{i}^{e_i}} + f(T), \end{aligned}$$
(2.52)
$$\begin{aligned}&(P_{i}, Q_{i}) = 1 \text { and } 2\not \mid e_{i} \text { for } 1 \le i \le m, \end{aligned}$$
(2.53)
$$\begin{aligned}&2 \not \mid \deg (f(T)) \text { if } f(T) \in \mathbb {F}_{q}[T]{\setminus } \mathbb {F}_{q}, \end{aligned}$$
(2.54)

where \(P_{i}\in \mathbb P\) are distinct and \(Q_{i} \in \mathbb {A}\) with \(\deg (Q_{i}) < \deg (P_{i}^{e_i})\) for \(1 \le i \le m\). In this case, the infinite prime \(\infty = (1/T)\) is split, inert, or ramified in \(K_{u}\) accordingly as \(f(T) = 0\), \(f(T) \in \mathbb {F}_{q}{\setminus }\wp (\mathbb {F}_{q})\), or \(f(T) \not \in \mathbb {F}_{q}\). Then the field \(K_{u}\) is called real, inert imaginary, or ramified imaginary, respectively. Let \(\mathcal {O}_{u}\) be the integral closure of \(\mathbb {A}\) in \(K_{u}\). Then \(\mathcal {O}_{u} = \mathbb {A}+ G_{u} x_{u}\mathbb {A}\), where \(G_{u} := \prod _{i=1}^{m} P_{i}^{(e_{i}+1)/2}\), and the discriminant of \(\mathcal {O}_{u}\) is \(G_{u}^2 = \prod _{i=1}^{m} P_{i}^{e_{i}+1}\). The local discriminant of \(K_{u}\) at the infinite prime \(\infty \) is \(\infty ^{\deg (f(T)) + 1}\) if \(K_{u}\) is ramified imaginary and trivial otherwise. Hence, the discriminant \(D_{u}\) of \(K_u\) is given by

$$\begin{aligned} D_{u} = {\left\{ \begin{array}{ll} G_{u}^2 \cdot \infty ^{\deg (f(T)) + 1} &{} \text { if } K_{u} \text { is ramified imaginary,} \\ G_{u}^2 &{} \text { otherwise,} \end{array}\right. } \end{aligned}$$
(2.55)

and, by the Hurwitz genus formula, the genus \(g_{u}\) of \(K_{u}\) is given by

$$\begin{aligned} g_{u} = \frac{1}{2} \deg (D_{u}) - 1. \end{aligned}$$
(2.56)

In general, the normalization (2.52) is not unique. Fix an element \(\xi \in \mathbb {F}_{q}{\setminus } \wp (\mathbb {F}_{q})\). Then every u can be normalized uniquely to satisfy the following conditions:

$$\begin{aligned} u = \sum _{i=1}^{m} \sum _{j=0}^{\ell _{i}} \frac{Q_{ij}}{P_{i}^{2j+1}} + \sum _{i=1}^{n} \alpha _{i} T^{2i-1} + \alpha , \end{aligned}$$
(2.57)

where \(P_{i}\in \mathbb P\) are distinct, \(Q_{ij}\in \mathbb {A}\) with \(\deg (Q_{ij}) < \deg (P_{i})\), \(Q_{i \ell _{i}} \ne 0\), \(\alpha \in \{0, \xi \}\), and \(\alpha _{n} \ne 0\) for \(n>0\). Let \(\widetilde{\mathcal F}\) be the set of such u’s above with \(n=0\) and \(\alpha =0\), and \(\widetilde{\mathcal F}'\) be the set of such u’s above with \(n=0\) and \(\alpha =\xi \). Then, we see that \(u\mapsto K_{u}\) defines an one-to-one correspondence between \(\widetilde{\mathcal F}\) (resp. \(\widetilde{\mathcal F}'\)) and the set of real (resp. inert imaginary) separable quadratic extensions of k. Similarly, if we denote by \(\widetilde{\mathcal H}\) the set of such u’s above with \(n\ne 0\), then \(u\mapsto K_{u}\) defines an one-to-one correspondence between \(\widetilde{\mathcal H}\) and the set of ramified imaginary separable quadratic extensions of k.

2.2.2 Hasse symbol and L-functions

Let \(P\in \mathbb P\). For \(u\in k\) which is P-integral, the Hasse symbol [uP) with values in \(\mathbb {F}_{2}\) is defined by

$$\begin{aligned}{}[u, P) := {\left\{ \begin{array}{ll} 0 &{} \text { if } X^2+X\equiv u \bmod P \text { is solvable in } \mathbb {A}, \\ 1 &{} \text { otherwise.} \end{array}\right. } \end{aligned}$$
(2.58)

For \(N\in \mathbb {A}\) prime to the denominator of u, write \(N = \hbox {sgn}(N) \prod _{i=1}^{s} P_{i}^{e_i}\), where \(P_{i} \in \mathbb P\) are distinct and \(e_{i} \ge 1\), and define [uN) to be \(\sum _{i=1}^{s} e_{i} [u, P_{i})\).

For \(u\in k\) and \(0\ne N \in \mathbb {A}\), we also define the quadratic symbol:

$$\begin{aligned} \left\{ \frac{u}{N}\right\} := {\left\{ \begin{array}{ll} (-1)^{[u, N)} &{} \text { if } N \text { is prime to the denominator of} u, \\ 0 &{} \text { otherwise.} \end{array}\right. } \end{aligned}$$
(2.59)

This symbol is clearly additive in its first variable and multiplicative in the second variable.

For the quadratic extension \(K_{u}\) of k, we associate a character \(\chi _{u}\) on \(\mathbb {A}^{+}\) which is defined by \(\chi _{u}(f) = \{\frac{u}{f}\}\). Let \(L(s,\chi _{u})\) be the L-function associated to the character \(\chi _{u}\): for \(s\in \mathbb C\) with \(\mathrm{Re}(s)\ge 1\),

$$\begin{aligned} L(s,\chi _{u}) = \sum _{f\in \mathbb {A}^{+}} \chi _{u}(f) |f|^{-s} = \prod _{P\in \mathbb P} \left( 1-\chi _{u}(P)|P|^{-s}\right) ^{-1}. \end{aligned}$$
(2.60)

It is well known that \(L(s,\chi _{u})\) is a polynomial in \(q^{-s}\). Letting \(z=q^{-s}\), write \(\mathcal L(z,\chi _{u}) = L(s, \chi _{u})\). Then, \(\mathcal L(z,\chi _{u})\) is a polynomial in z of degree \(2 g_{u} + \frac{1+(-1)^{\varepsilon (u)}}{2}\), where \(\varepsilon (u) = 1\) if \(K_{u}\) is ramified imaginary and \(\varepsilon (u) = 0\) otherwise. Also we have that \(\mathcal {L}(z,\chi _{u})\) has a “trivial” zero at \(z=1\) (resp. \(z=-1\)) if and only if \(K_{u}\) is real (resp. inert imaginary), so we can define the “completed” L-function as

$$\begin{aligned} \mathcal {L}^{*}(z,\chi _{u}) = {\left\{ \begin{array}{ll} \mathcal {L}(z,\chi _{u}) &{} \text { if } K_{u} \text { is ramified imaginary,} \\ (1-z)^{-1} \mathcal {L}(z,\chi _{u}) &{} \text { if }K_{u} \text { is real,} \\ (1+z)^{-1} \mathcal {L}(z,\chi _{u}) &{} \text { if } K_{u} \text { is inert imaginary,} \end{array}\right. } \end{aligned}$$
(2.61)

which is a polynomial of even degree \(2 g_{u}\) satisfying the functional equation

$$\begin{aligned} \mathcal {L}^{*}(z,\chi _{u})=(q z^{2})^{g_{u}}\mathcal {L}^{*}\left( \frac{1}{qz},\chi _{u}\right) . \end{aligned}$$
(2.62)

2.2.3 Main results

We are interested in the family of real, inert imaginary, or ramified imaginary quadratic extensions \(K_{u}\) of k whose finite discriminant is a square of prime polynomial, i.e., \(G_{u}\in \mathbb P\). For any two subsets UV of k and \(w\in k\), we write

$$\begin{aligned} U+V := \{u+v : u\in U \text { and } v\in V\} \quad \text { and }\quad U+w := \{u+w : u \in U\}. \end{aligned}$$
(2.63)

Let \(\mathcal F\) be the set of rational functions \(u\in \widetilde{\mathcal F}\) whose denominator is a monic irreducible polynomial, i.e., \(u = \frac{A}{P}\in \widetilde{\mathcal F}\) with \(P\in \mathbb P\) and \(0 \ne A\in \mathbb {A}, \deg (A)<\deg (P)\), and \(\mathcal F' = \mathcal F + \xi \). Then, under the above correspondence \(u\mapsto K_{u}\), \(\mathcal F\) (resp. \(\mathcal F'\)) corresponds to the set of real (resp. inert imaginary) separable quadratic extensions of k whose discriminant is a square of prime polynomial. For each positive integer n, let \(\mathcal F_{n}\) be the set of rational functions \(u = \frac{A}{P} \in \mathcal F\) such that \(P \in \mathbb P_{n}\) and \(\mathcal F'_{n} = \mathcal F_{n} + \xi \). Then, under the correspondence \(u\mapsto K_{u}\), \(\mathcal F_{g+1}\) (resp. \(\mathcal F'_{g+1}\)) corresponds to the set of real (resp. inert imaginary) separable quadratic extensions of k whose discriminant is a square of prime polynomial and genus is g.

For each positive integer s, let \(\mathcal G_{s}\) be the set of polynomials \(F(T) \in \mathbb {A}_{2s-1}\) of the form

$$\begin{aligned} F(T) = \alpha +\sum _{i=1}^{s}\alpha _{i}T^{2i-1}, \quad \alpha \in \{0, \xi \}, ~~~\alpha _{s} \ne 0. \end{aligned}$$
(2.64)

Let \(\mathcal G\) be the union of \(\mathcal G_{s}\)’s for \(s \ge 1\) and \(\mathcal H = \mathcal F + \mathcal G\). Then, under the correspondence \(u\mapsto K_{u}\), \(\mathcal H\) corresponds to the set of ramified imaginary separable quadratic extensions of k whose finite discriminant is a square of prime polynomial. For integers \(r,s\ge 1\), let \(\mathcal H_{(r,s)} = \mathcal F_{r}+\mathcal G_{s}\). Then, for each \(u\in \mathcal H_{(r,s)}\), the corresponding field \(K_{u}\) is a ramified imaginary of genus \(r+s-1\). For integer \(n\ge 1\), let \(\mathcal H_{n}\) be the union of \(\mathcal H_{(r,n-r)}\)’s for \(1 \le r \le n-1\). Then, under the correspondence \(u\mapsto K_{u}\), \(\mathcal H_{g+1}\) corresponds to the set of ramified imaginary separable quadratic extensions of k whose finite discriminant is a square of prime polynomial and genus is g.

In this paper, we are interested in asymptotics for the sums (as q is fixed and \(g\rightarrow \infty \)):

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L(s,\chi _{u}), \sum _{u\in \mathcal F_{g+1}} L(s,\chi _{u}), \sum _{u\in \mathcal F'_{g+1}} L(s,\chi _{u}), \mathrm {Re}(s)\ge \frac{1}{2} \end{aligned}$$
(2.65)

and

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^2, \sum _{u\in \mathcal F_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^2, \sum _{u\in \mathcal F'_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^2. \end{aligned}$$
(2.66)

For each \(P\in \mathbb P\), let \(\mathcal F_{P}\) be the set of rational functions \(u \in \mathcal F\) whose denominator is P, and \(\mathcal F'_{P} := \mathcal F_{P} + \xi \). Then \(\mathcal F_{g+1}\) is disjoint union of the \(\mathcal F_{P}\)’s and \(\mathcal F'_{g+1}\) is disjoint union of the \(\mathcal F'_{P}\)’s, where P runs over prime polynomials in \(\mathbb P_{g+1}\). Hence, we can write

$$\begin{aligned} \sum _{u\in \mathcal F_{g+1}} L(s,\chi _{u}) = \sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F_{P}} L(s,\chi _{u}), \quad \sum _{u\in \mathcal F'_{g+1}} L(s,\chi _{u}) = \sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F'_{P}} L(s,\chi _{u}), \end{aligned}$$
(2.67)

and

$$\begin{aligned}&\sum _{u\in \mathcal F_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^2 = \sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^2, \nonumber \\&\sum _{u\in \mathcal F'_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2} = \sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F'_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^2. \end{aligned}$$
(2.68)

For the first moment of such L-functions, we have the following theorem.

Theorem 2.13

Let \(\mathbb {F}_{q}\) be a fixed finite field with q being a power of 2.

  1. 1.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L(s,\chi _{u}) = 2\tilde{I}_{g}(s) \frac{q^{2g+1}}{g} + {\left\{ \begin{array}{ll} O(g^{-1} q^{2g}) &{} \quad \hbox {if}\,\,\,s=\frac{1}{2}, \\ O(g^{-2} q^{2g}) &{} \quad \hbox {if}\,\,\,s\ne \frac{1}{2}, \end{array}\right. } \end{aligned}$$
    (2.69)

    as \(g\rightarrow \infty \) with

    $$\begin{aligned} \tilde{I}_{g}(s) = {\left\{ \begin{array}{ll} g+1 &{} \quad \hbox {if}\,\,\,s=\frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) &{} \quad \hbox {if}\,\,\,s\ne \frac{1}{2}. \end{array}\right. } \end{aligned}$$
    (2.70)
  2. 2.

    For any \(\varepsilon >0\) and for \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\) and \(|s-1|>\varepsilon \), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L(s,\chi _{u}) = \tilde{J}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\big (|P|^{\frac{3}{2}}\big ) \end{aligned}$$
    (2.71)

    as \(g\rightarrow \infty \) with

    $$\begin{aligned} \tilde{J}_{g}(s) := {\left\{ \begin{array}{ll} g+1+\zeta _{\mathbb {A}}\left( \tfrac{1}{2}\right) &{} \hbox {if}\,\,\,s=\frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) {J}'_{g}(s) - \zeta _{\mathbb {A}}(2) {J}^{*}_{g}(s) &{} \hbox {if}\,\,\,\frac{1}{2} \le \mathrm{Re}(s) < 1 ~(s\ne \frac{1}{2}), \\ \zeta _{\mathbb {A}}(2s) &{} \hbox {if}\,\,\,\mathrm{Re}(s) \ge 1, \end{array}\right. } \end{aligned}$$
    (2.72)

    where \({J}'_{g}(s)\) and \({J}^{*}_{g}(s)\) are given in Theorem 2.3 (2) and, for \(s=1\), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F_{P}} L(1,\chi _{u}) = \zeta _{\mathbb {A}}(2) \frac{|P|^{2}}{\log _{q}|P|} + O\big (|P|^{\frac{3}{2}}\big ). \end{aligned}$$
    (2.73)
  3. 3.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F'_{P}} L(s,\chi _{u}) = \tilde{K}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\big (|P|^{\frac{3}{2}}\big ), \end{aligned}$$
    (2.74)

    as \(g\rightarrow \infty \) with

    $$\begin{aligned} \tilde{K}_{g}(s) := {\left\{ \begin{array}{ll} g+1+\zeta _{\mathbb {A}}(0)\zeta _{\mathbb {A}}(\frac{1}{2})^{-1} &{} \hbox {if}\,\,\,s=\frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) {K}'_{g}(s) - \zeta _{\mathbb {A}}(2) {K}^{*}_{g}(s) &{} \hbox {if}\,\,\,\frac{1}{2} \le \mathrm{Re}(s) < 1 ~\left( s\ne \frac{1}{2}\right) , \\ \zeta _{\mathbb {A}}(2s) &{} \hbox {if}\,\,\,\mathrm{Re}(s) \ge 1, \end{array}\right. } \end{aligned}$$
    (2.75)

    where \({K}'_{g}(s)\) and \({K}^{*}_{g}(s)\) are given in Theorem 2.3 (3).

Remark 2.14

If q is odd, the quadratic extension \(k(\sqrt{\gamma D})\) of k is also ramified imaginary for any monic square-free polynomial D of odd degree. Under the changing of variable \(T\mapsto \gamma T\), \(k(\sqrt{\gamma D})\) becomes to \(k(\sqrt{D})\). Hence, we only consider the family \(\{k(\sqrt{P}) : P\in \mathbb P_{2g+1}\}\) in Theorem 2.3 (1). However, if q is even, we consider all separable ramified imaginary one. This is the reason why the constant “2” appears in Theorem 2.13 (1) and does not appear in Theorem 2.3 (1).

For the second moment of L-functions at \(s=\frac{1}{2}\), we have the following theorem.

Theorem 2.15

Let q be a fixed power of 2. As \(g\rightarrow \infty \), we have

  1. 1.
    $$\begin{aligned}&\sum _{u\in \mathcal H_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2} = \frac{2}{3 \zeta _{\mathbb {A}}(2)} g^2 q^{2g+1} + O\big ((\log g) g q^{2g}\big ), \end{aligned}$$
    (2.76)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^2 = \frac{1}{3 \zeta _{\mathbb {A}}(2)} |P|^2 (\log _{q}|P|)^2 + O\big (|P|^2 (\log _{q}|P|)\big ), \end{aligned}$$
    (2.77)
  3. 3.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F'_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2} = \frac{1}{3 \zeta _{\mathbb {A}}(2)} |P|^2 (\log _{q}|P|)^2 + O\big (|P|^2 (\log _{q}|P|)\big ). \end{aligned}$$
    (2.78)

Remark 2.16

There is a unique quadratic extension \(k(\sqrt{P})\) of k whose (finite) discriminant is P in case of q being odd, but if q is even, there are \(\Phi (P) = |P|-1\) separable quadratic extensions \(K_{u}\) of k whose (finite) discriminant is \(P^2\). For this reason, \(|P|^2\) appears in Theorem 2.15 whereas |P| appears in Theorem 2.6. Considering this difference, we may regard Theorem 2.15 as an even characteristic analogue of Theorem 2.6.

As in odd characteristic case, we can consider \(\mathcal H_{g+1}\), \(\mathcal F_{g+1}\), and \(\mathcal F'_{g+1}\) as probability spaces (ensembles) with the uniform probability measure attached to them. So the expected value of any function F on \(\mathcal H_{g+1}\), \(\mathcal F_{g+1}\), or \(\mathcal F'_{g+1}\) is defined as

$$\begin{aligned} \left\langle F\right\rangle _{\mathcal H_{g+1}}&= \frac{1}{\#\mathcal H_{g+1}}\sum _{u\in \mathcal H_{g+1}}F(u), \end{aligned}$$
(2.79)
$$\begin{aligned} \left\langle F\right\rangle _{\mathcal F_{g+1}}&= \frac{1}{\#\mathcal F_{g+1}}\sum _{u\in \mathcal F_{g+1}}F(u), \end{aligned}$$
(2.80)
$$\begin{aligned} \left\langle F\right\rangle _{\mathcal F'_{g+1}}&= \frac{1}{\#\mathcal F'_{g+1}}\sum _{u\in \mathcal F'_{g+1}}F(u). \end{aligned}$$
(2.81)

Since (see Lemma 4.3)

$$\begin{aligned}&\#\mathcal H_{g+1} = 2 \frac{q^{2g+1}}{g}+ O\left( \frac{q^{2g}}{g^2}\right) , \end{aligned}$$
(2.82)
$$\begin{aligned}&\#\mathcal F_{g+1} = \#\mathcal F'_{g+1} = \frac{q^{2g+2}}{g+1} + O\left( \frac{q^{\frac{3g}{2}}}{g}\right) , \end{aligned}$$
(2.83)

we have

$$\begin{aligned} \frac{1}{\#\mathcal H_{g+1}} \sim \frac{g}{2 q^{2g+1}} ~~~\text { and }~~~ \frac{1}{\#\mathcal F_{g+1}} = \frac{1}{\#\mathcal F'_{g+1}} \sim \frac{g+1}{q^{2g+2}} \quad \text { as } g\rightarrow \infty . \end{aligned}$$
(2.84)

From Theorems 2.13 and 2.15, we get the following corollary.

Corollary 2.17

With q kept fixed power of 2 and \(g\rightarrow \infty \), we have

$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{u}\right) \right\rangle _{\mathcal H_{g+1}}&\sim g+1, \end{aligned}$$
(2.85)
$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{u}\right) \right\rangle _{\mathcal F_{g+1}}&\sim g+1+\zeta _{\mathbb {A}}\left( \tfrac{1}{2}\right) , \end{aligned}$$
(2.86)
$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{u}\right) \right\rangle _{\mathcal F'_{g+1}}&\sim g+1+\zeta _{\mathbb {A}}(0)\zeta _{\mathbb {A}}\left( \tfrac{1}{2}\right) ^{-1} \end{aligned}$$
(2.87)

and

$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{u}\right) ^2\right\rangle _{\mathcal H_{g+1}}&\sim \frac{g^3}{3 \zeta _{\mathbb {A}}(2)}, \end{aligned}$$
(2.88)
$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{u}\right) ^2\right\rangle _{\mathcal F_{g+1}}&\sim \frac{(g+1)^3}{3 \zeta _{\mathbb {A}}(2)}, \end{aligned}$$
(2.89)
$$\begin{aligned} \left\langle L\left( \tfrac{1}{2},\chi _{u}\right) ^2\right\rangle _{\mathcal F'_{g+1}}&\sim \frac{(g+1)^3}{3 \zeta _{\mathbb {A}}(2)}. \end{aligned}$$
(2.90)

We follow the same reasoning as it is done in Corollary 2.8 with Theorems 2.13 and 2.15 to get the following corollary.

Corollary 2.18

With q kept fixed power of 2 and \(g\rightarrow \infty \), we have

$$\begin{aligned}&\sum _{\begin{array}{c} u\in \mathcal H_{g+1}\\ L(\frac{1}{2}, \chi _{u})\ne 0 \end{array}} 1 \gg \frac{q^{2g+1}}{g^2}, \end{aligned}$$
(2.91)
$$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}} \sum _{\begin{array}{c} u\in \mathcal F_{P}\\ L(\frac{1}{2}, \chi _{u})\ne 0 \end{array}} 1 \gg \left( \frac{|P|}{\log _{q}|P|}\right) ^{2}, \end{aligned}$$
(2.92)
$$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}} \sum _{\begin{array}{c} u\in \mathcal F'_{P}\\ L(\frac{1}{2}, \chi _{u})\ne 0 \end{array}} 1 \gg \left( \frac{|P|}{\log _{q}|P|}\right) ^{2}. \end{aligned}$$
(2.93)

From Theorem 2.13, we have the following result concerning the first moment of L-functions at \(s=1\).

Theorem 2.19

Let q be a fixed power of 2. As \(g\rightarrow \infty \), we have

  1. 1.
    $$\begin{aligned}&\sum _{u \in \mathcal H_{g+1}} L(1,\chi _{u}) = 2 \zeta _{\mathbb {A}}(2) \frac{q^{2g+1}}{g} + O\left( \frac{q^{2g}}{g^2}\right) , \end{aligned}$$
    (2.94)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F_{P}} L(1,\chi _{u}) = \zeta _{\mathbb {A}}(2) \frac{|P|^{2}}{\log _{q}|P|} + O\big (|P|^{\frac{3}{2}}\big ), \end{aligned}$$
    (2.95)
  3. 3.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F'_{P}} L(1,\chi _{u}) = \zeta _{\mathbb {A}}(2) \frac{|P|^{2}}{\log _{q}|P|} + O\big (|P|^{\frac{3}{2}}\big ). \end{aligned}$$
    (2.96)

For any \(u\in \mathcal H_{g+1} \cup \mathcal F_{g+1} \cup \mathcal F'_{g+1}\), we have a formula which connects \(L(1, \chi _{u})\) and the class number \(h_{u}\) of \(\mathcal {O}_{u}\) [7, Theorem 5.2]:

$$\begin{aligned} L(1, \chi _{u}) = {\left\{ \begin{array}{ll} q^{-g} h_{u} &{} \text { if } u \in \mathcal H_{g+1}, \\ \zeta _{\mathbb {A}}(2)^{-1} q^{-g} h_{u} R_{u} &{} \text { if }u \in \mathcal F_{g+1}, \\ \frac{1}{2}\zeta _{\mathbb {A}}(2) \zeta _{\mathbb {A}}(3)^{-1} q^{-g} h_{u} &{} \text { if } u \in \mathcal F'_{g+1}, \end{array}\right. } \end{aligned}$$
(2.97)

where \(R_{u}\) is the regulator of \(\mathcal {O}_{u}\) if \(u\in \mathcal F_{g+1}\).

By combining Theorem 2.19 and Eq. (2.97), we have the following corollary.

Corollary 2.20

Let q be a fixed power of 2. As \(g\rightarrow \infty \), we have

  1. 1.
    $$\begin{aligned}&\sum _{u \in \mathcal H_{g+1}} h_{u} = 2 \zeta _{\mathbb {A}}(2) \frac{q^{3g+1}}{g} + O\left( \frac{q^{3g}}{g^2}\right) , \end{aligned}$$
    (2.98)
  2. 2.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} h_{u} R_{u} = \zeta _{\mathbb {A}}(2)^2 q^{-1} \frac{|P|^3}{\log _{q}|P|} + O\big (|P|^{\frac{5}{2}}\big ), \end{aligned}$$
    (2.99)
  3. 3.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F'_{P}} h_{u} = 2 \zeta _{\mathbb {A}}(3) q^{-1} \frac{|P|^3}{\log _{q}|P|} + O\big (|P|^{\frac{5}{2}}\big ). \end{aligned}$$
    (2.100)

3 “Approximate” functional equations of L-functions

For any separable quadratic extension K of k, let \(\chi _{K}\) denote the character \(\chi _{D}\) if q is odd and \(K=k(\sqrt{D})\), where D is a non-constant square-free polynomials \(D\in \mathbb {A}\) with \(\hbox {sgn}(D) \in \{1, \gamma \}\), or the character \(\chi _{u}\) if q is even and \(K = K_{u}\), where \(u\in k\) is normalized as in (2.57). Let \(L(s,\chi _{K})\) be the L-function associated to \(\chi _{K}\). Then \(L(s,\chi _{K})\) is a polynomial in \(z = q^{-s}\) of degree \(\delta _{K} = 2 g_{K} + \frac{1}{2}(1+(-1)^{\varepsilon (K)})\), where \(g_{K}\) is the genus of K, \(\varepsilon (K) = 1\) if K is ramified imaginary and \(\varepsilon (K) = 0\) otherwise. Write

$$\begin{aligned} L(s,\chi _{K}) = \sum _{n=0}^{\delta _{K}} A_{K}(n) q^{-ns} \quad \text { with }A_{K}(n) := \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{K}(f). \end{aligned}$$
(3.1)

Lemma 3.1

  1. 1.

    If K is ramified imaginary, then we have

    $$\begin{aligned} L(s,\chi _{K}) = \sum _{n=0}^{g_{K}} A_{K}(n) q^{-sn} + q^{(1-2s)g_{K}} \sum _{n=0}^{g_{K}-1} A_{K}(n) q^{(s-1)n}. \end{aligned}$$
    (3.2)
  2. 2.

    If K is real, then we have

    $$\begin{aligned} L(s,\chi _{K}) = \sum _{n=0}^{g_{K}} A_{K}(n) q^{-sn} - q^{-(g_{K}+1)s} \sum _{n=0}^{g_{K}} A_{K}(n) + H_{K}(s), \end{aligned}$$
    (3.3)

    where \(H_{K}(1) := \zeta _{\mathbb {A}}(2)^{-1} q^{-g_{K}}\sum _{n=0}^{g_{K}-1} \left( g_{K}-n\right) A_{K}(n)\) and, for \(s\ne 1\),

    $$\begin{aligned} H_{K}(s) := q^{(1-2s)g_{K}} \frac{\zeta _{\mathbb {A}}(2-s)}{\zeta _{\mathbb {A}}(1+s)} \sum _{n=0}^{g_{K}-1} q^{(s-1)n} A_{K}(n) - q^{-s g_{K}} \frac{\zeta _{\mathbb {A}}(2-s)}{\zeta _{\mathbb {A}}(1+s)} \sum _{n=0}^{g_{K}-1} A_{K}(n).\nonumber \\ \end{aligned}$$
    (3.4)
  3. 3.

    If K is inert imaginary, then we have

    $$\begin{aligned} L(s,\chi _{K})&= \sum _{n=0}^{g_{K}} A_{K}(n) q^{-sn} + q^{-(\delta _D+1)s} \sum _{n=0}^{g_{K}}(-1)^{n+g_{K}} A_{K}(n) \nonumber \\& + \left( \frac{1+q^{-s}}{1+q^{s-1}}\right) q^{(1-2s)g_{K}} \sum _{n=0}^{g_{K}-1} A_{K}(n) q^{(s-1)n} \nonumber \\& + \left( \frac{1+q^{-s}}{1+q^{s-1}}\right) q^{-sg_{K}} \sum _{n=0}^{g_{K}-1} (-1)^{n+g_{K}+1} A_{K}(n). \end{aligned}$$
    (3.5)

Proof

Write

$$\begin{aligned} \mathcal L(z,\chi _{K}) = \sum _{n=0}^{\delta _{K}} A_{K}(n) z^{n} \quad \text { and }\quad \mathcal L^{*}(z,\chi _{K}) = \sum _{n=0}^{2g_{K}} A_{K}^{*}(n) z^{n}. \end{aligned}$$
(3.6)

By (2.3) and (2.61), we have

$$\begin{aligned} A_{K}^{*}(n) = {\left\{ \begin{array}{ll} A_{K}(n) &{} \text { if } K \text {is ramified imaginary}, \\ \sum _{i=0}^{n} A_{K}(i) &{} \text { if } K \text {is real,} \\ \sum _{i=0}^{n} (-1)^{n-i} A_{K}(i) &{} \text { if } K \text { is inert imaginary.} \end{array}\right. } \end{aligned}$$
(3.7)

By substituting \(\mathcal L^{*}(z,\chi _{K}) = \sum _{n=0}^{2g_{K}} A_{K}^{*}(n) z^{n}\) into the functional equation (2.4) [or (2.61)]

$$\begin{aligned} \sum _{n=0}^{2g_{K}} A_{K}^{*}(n) z^{n} = \sum _{n=0}^{2g_{K}} A_{K}^{*}(n) q^{g_{K}-n} z^{2g_{K}-n} = \sum _{n=0}^{2g_{K}} A_{K}^{*}(2g_{K}-n) q^{n-g_{K}} z^{n}, \end{aligned}$$
(3.8)

and equating coefficients, we have

$$\begin{aligned} A_{K}^{*}(n) = A_{K}^{*}(2g_{K}-n) q^{n-g_{K}} \quad \text { or }\quad A_{K}^{*}(2g_{K}-n) = A_{K}^{*}(n) q^{g_{K}-n}. \end{aligned}$$
(3.9)

So we can write \(\mathcal L^{*}(z,\chi _{K})\) as

$$\begin{aligned} \mathcal L^{*}(z,\chi _{K}) = \sum _{n=0}^{g_{K}} A_{K}^{*}(n) z^{n} + q^{g_{K}} z^{2g_{K}} \sum _{n=0}^{g_{K}-1} A_{K}^{*}(n) q^{-n} z^{-n}. \end{aligned}$$
(3.10)

If K is ramified imaginary, since \(\mathcal L(z,\chi _{K}) = \mathcal L^{*}(z,\chi _{K})\), we have that (3.2) follows immediately from (3.10). Suppose that K is real. By (3.7) and (3.10), we have

$$\begin{aligned} \mathcal L^{*}(z,\chi _{K})&= \sum _{n=0}^{g_{K}} \left( \sum _{i=0}^{n} A_{K}(i)\right) z^{n} + q^{g_{K}} z^{2g_{K}} \sum _{n=0}^{g_{K}-1} \left( \sum _{j=0}^{n} A_{K}(j)\right) q^{-n} z^{-n} \nonumber \\&= \sum _{n=0}^{g_{K}} \left( \frac{z^{n}-z^{g_{K}+1}}{1-z}\right) A_{K}(n) + H^{*}(z), \end{aligned}$$
(3.11)

where \(H^{*}(q^{-1}) := q^{-g_{K}}\sum _{n=0}^{g_{K}-1} \left( g_{K}-n\right) A_{K}(n)\) and, for \(z\ne q^{-1}\),

$$\begin{aligned} H^{*}(z) := \dfrac{q^{g_{K}} z^{2g_{K}}}{1-q^{-1} z^{-1}} \displaystyle \sum _{n=0}^{g_{K}-1} q^{-n} z^{-n} A_{K}(n) - \dfrac{z^{g_{K}}}{1-q^{-1} z^{-1}} \displaystyle \sum _{n=0}^{g_{K}-1} A_{K}(n). \end{aligned}$$
(3.12)

By multiplying \((1-z)\) on (3.11) and putting \(z=q^{-s}\), we get (3.3). Finally, consider the case that K is inert imaginary. By (3.7) and (3.10), we have

$$\begin{aligned} \mathcal L^{*}(z,\chi _{K})&= \sum _{n=0}^{g_{K}} \left( \sum _{i=0}^{n} (-1)^{n-i} A_{K}(i)\right) z^{n} \nonumber \\&\quad + q^{g_{K}} z^{2g_{K}} \sum _{n=0}^{g_{K}-1} \left( \sum _{j=0}^{n} (-1)^{n-j} A_{K}(j)\right) q^{-n} z^{-n} \nonumber \\&= \frac{1}{1+z} \sum _{n=0}^{g_{K}} A_{K}(n) z^{n} + \frac{z^{g_{K}+1}}{1+z} \sum _{n=0}^{g_{K}}(-1)^{n+g_{K}} A_{K}(n) \nonumber \\&\quad + \frac{q^{g_{K}} z^{2g_{K}}}{1+q^{-1} z^{-1}} \sum _{n=0}^{g_{K}-1} A_{K}(n) q^{-n} z^{-n} \nonumber \\&\quad + \frac{z^{g_{K}}}{1+q^{-1} z^{-1}} \sum _{n=0}^{g_{K}-1} (-1)^{n+g_{K}+1} A_{K}(n). \end{aligned}$$
(3.13)

By multiplying \((1+z)\) on (3.13) and putting \(z=q^{-s}\), we get (3.5). \(\square \)

Write

$$\begin{aligned} L(s,\chi _{K})^2 = \sum _{n=0}^{2\delta _{K}} B_{K}(n) q^{-ns} \quad \text { with } B_{K}(n) := \sum _{f\in \mathbb {A}_{n}^{+}} d(f)\chi _{K}(f), \end{aligned}$$
(3.14)

where d(f) denotes the divisor function on \(\mathbb {A}^{+}\):

$$\begin{aligned} d(f) := \sum _{\begin{array}{c} N\in \mathbb {A}^{+}\\ N|f \end{array}} 1. \end{aligned}$$
(3.15)

Lemma 3.2

  1. 1.

    If K is ramified imaginary, then we have

    $$\begin{aligned} L(\tfrac{1}{2},\chi _{K})^{2} = \sum _{n=0}^{2g_{K}} B_{K}(n) q^{-\frac{n}{2}} + \sum _{n=0}^{2g_{K}-1} B_{K}(n) q^{-\frac{n}{2}}. \end{aligned}$$
    (3.16)
  2. 2.

    If K is real, then we have

    $$\begin{aligned} L\left( \tfrac{1}{2},\chi _{D}\right) ^{2}&= \sum _{n=0}^{2g_{K}} B_{K}(n) q^{-\frac{n}{2}} + \sum _{n=0}^{2g_{K}-1} B_{K}(n) q^{-\frac{n}{2}} \nonumber \\&\quad - q^{-\left( g_{K}+\frac{1}{2}\right) } \sum _{n=0}^{2g_{K}} B_{K}(n) - q^{-g_{K}} \sum _{n=0}^{2g_{K}-1} B_{K}(n) \nonumber \\&\quad - \zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) ^{-1} q^{-\left( g_{K}+\frac{1}{2}\right) } \sum _{n=0}^{2g_{K}} (2g_{K}+1-n) B_{K}(n) \nonumber \\&\quad - \zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) ^{-1} q^{-g_{K}}\sum _{n=0}^{2g_{K}-1} (2g_{K}-n) B_{K}(n). \end{aligned}$$
    (3.17)
  3. 3.

    If K is inert imaginary, then we have

    $$\begin{aligned} L\left( \tfrac{1}{2},\chi _{D}\right) ^{2}&= \sum _{n=0}^{2g_{K}} B_{K}(n) q^{-\frac{n}{2}} + \sum _{n=0}^{2g_{K}-1} q^{-\frac{n}{2}} B_{K}(n) \nonumber \\&\quad + q^{-\left( g_{K}+\frac{1}{2}\right) } \sum _{n=0}^{2g_{K}} (-1)^n B_{K}(n) + q^{-g_{K}} \sum _{n=0}^{2g_{K}-1} (-1)^{n} B_{K}(n) \nonumber \\&\quad + \frac{\zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) }{\zeta _{\mathbb {A}}(2)} q^{-\left( g_{K}+\frac{1}{2}\right) } \sum _{n=0}^{2g_{K}} (-1)^n (2g_{K}+1-n) B_{K}(n) \nonumber \\&\quad + \frac{\zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) }{\zeta _{\mathbb {A}}(2)} q^{-g_{K}}\sum _{n=0}^{2g_{K}-1} (-1)^{n} (2g_{K}-n) B_{K}(n). \end{aligned}$$
    (3.18)

Proof

Write

$$\begin{aligned} \mathcal L(z,\chi _{D})^2 = \sum _{n=0}^{2\delta _{K}} B_{K}(n) z^{n} \quad \text { and }\quad \mathcal L^{*}(z,\chi _{D})^2 = \sum _{n=0}^{4 g_{K}} B_{K}^{*}(n) z^{n}. \end{aligned}$$
(3.19)

By (2.3) and (2.61), we have

$$\begin{aligned} B_{K}^{*}(n) = {\left\{ \begin{array}{ll} B_{K}(n) &{} \text { if }\,\,\, K \text { is ramified imaginary,} \\ \sum _{i=0}^{n} (n+1-i) B_{K}(i) &{} \text { if }\,\,\, K \text { is real,} \\ \sum _{i=0}^{n} (-1)^{n+i} (n+1-i) B_{K}(i) &{} \text { if } \,\,\,K \text { is inert imaginary.} \end{array}\right. } \end{aligned}$$
(3.20)

From the functional equation

$$\begin{aligned} \mathcal {L}^{*}(z,\chi _{K})^{2} = (qz^{2})^{2g_{K}} \mathcal {L}^{*}\left( \frac{1}{qz},\chi _{K}\right) ^2, \end{aligned}$$
(3.21)

we get

$$\begin{aligned} B_{K}^{*}(n) = B_{K}^{*}(4 g_{K}-n) q^{n-2g_{K}} \quad \text { or }\quad B_{K}^{*}(4 g_{K}-n) = q^{2g_{K}-n} B_{K}^{*}(n). \end{aligned}$$
(3.22)

Then we have

$$\begin{aligned} \mathcal {L}^{*}(z,\chi _{K})^{2} = \sum _{n=0}^{2g_{K}} B_{K}^{*}(n) z^{n} + q^{2g_{K}} z^{4g_{K}} \sum _{n=0}^{2g_{K}-1} B_{K}^{*}(n) q^{-n} z^{-n}. \end{aligned}$$
(3.23)

If K is ramified imaginary, since \(\mathcal L(z,\chi _{K})^2 = \mathcal L^{*}(z,\chi _{K})^2\), we have that (3.16) follows immediately from (3.23). Suppose that K is real. By (3.20) and (3.23), we have

$$\begin{aligned} \mathcal {L}^{*}(q^{-\frac{1}{2}},\chi _{K})^{2}&= \sum _{n=0}^{2g_{K}} \left\{ \frac{q^{-\frac{n}{2}}- q^{-\left( g_{K}+\frac{1}{2}\right) }}{\left( 1-q^{-\frac{1}{2}}\right) ^2} -\frac{(2g_{K}+1-n)q^{-\left( g_{K}+\frac{1}{2}\right) }}{1-q^{-\frac{1}{2}}}\right\} B_{K}(n) \nonumber \\&\quad \, + \sum _{n=0}^{2g_{K}-1}\left\{ \frac{q^{-\frac{n}{2}}-q^{-g_{K}}}{\left( 1-q^{-\frac{1}{2}}\right) ^2} -\frac{(2g_{K}-n)q^{-g_{K}}}{1-q^{-\frac{1}{2}}}\right\} B_{K}(n). \end{aligned}$$
(3.24)

Multiplying \(\left( 1-q^{-\frac{1}{2}}\right) ^2\) on (3.24), we get (3.17). Suppose that K is inert imaginary. By (3.20) and (3.23), we have

$$\begin{aligned}&\mathcal {L}^{*}(q^{-\frac{1}{2}},\chi _{K})^{2} \nonumber \\&\quad = \sum _{n=0}^{2g_{K}} \left\{ \frac{q^{-\frac{n}{2}}+ (-1)^{n} q^{-\left( g_{K}+\frac{1}{2}\right) }}{\left( 1+q^{-\frac{1}{2}}\right) ^2}+\frac{(-1)^{n}(2g_{K}+1-n)q^{-\left( g_{K}+\frac{1}{2}\right) }}{1+q^{-\frac{1}{2}}}\right\} B_{K}(n) \nonumber \\&\quad \quad + \sum _{n=0}^{2g_{K}-1}\left\{ \frac{q^{-\frac{n}{2}}+(-1)^{n}q^{-g_{K}}}{\left( 1+q^{-\frac{1}{2}}\right) ^2} +\frac{(-1)^{n}(2g_{K}-n)q^{-g_{K}}}{1+q^{-\frac{1}{2}}}\right\} B_{K}(n). \end{aligned}$$
(3.25)

Multiplying \(\big (1+q^{-\frac{1}{2}}\big )^2\) on (3.25), we get (3.18). \(\square \)

4 First moment of prime L-functions

4.1 Odd characteristic case

In this subsection, we give a proof of Theorem 2.3. In Sect. 4.1.1, we obtain several results of the contribution of squares and of non-squares, which will be used to calculate the first moment of prime L-functions in Sects. 4.1.2, 4.1.3, and 4.1.4.

In Sect. 4.1.1, \(\mathbb H_{g}\) will denote \(\mathbb P_{2g+1}\) or \(\mathbb P_{2g+2}\) for any positive integer g.

4.1.1 Preparations for the proof

We first consider the contribution of squares. We will use the prime polynomial theorem (Theorem 1.3) in the following form

$$\begin{aligned} \sum _{P\in \mathbb H_{g}} 1 = \frac{|P|}{\log _{q}|P|} + O\left( \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|}\right) . \end{aligned}$$
(4.1)

Proposition 4.1

  1. 1.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{P\in \mathbb H_{g}} \sum _{n=0}^{g} (\pm 1)^{n} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{P}(f) = A_{g}(s) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}}\big ), \end{aligned}$$
    (4.2)

    where

    $$\begin{aligned} A_{g}(s) = {\left\{ \begin{array}{ll} \big [\frac{g}{2}\big ]+1 &{} \hbox {if}\,\,\,s=\frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) (1-q^{(\big [\frac{g}{2}\big ]+1)(1-2s)}) &{} \hbox {if}\,\,\, s\ne \frac{1}{2}. \end{array}\right. } \end{aligned}$$
    (4.3)
  2. 2.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{(1-2s)g} \sum _{P\in \mathbb H_{g}} \sum _{n=0}^{g-1} (\pm 1)^{n} q^{(s-1)n} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{P}(f) = B_{g}(s) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{3}{4}-\frac{s}{2}}\big ), \end{aligned}$$
    (4.4)

    where

    $$\begin{aligned} B_{g}(s) = {\left\{ \begin{array}{ll} \big [\frac{g-1}{2}\big ] + 1 &{} \hbox {if}\,\,\, s = \frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) \big \{q^{\left( g-\big [\frac{g-1}{2}\big ]\right) (1-2s)} - q^{(g+1)(1-2s)}\big \} &{} \hbox {if}\,\,\, s \ne \frac{1}{2}. \end{array}\right. } \end{aligned}$$
    (4.5)
  3. 3.

    Let \(h \in \{g-1, g\}\). For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{-(h+1)s} \sum _{P\in \mathbb H_{g}}\sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{P}(f) = C_{h}(s) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{3}{4}-\frac{s}{2}}\big ), \end{aligned}$$
    (4.6)

    where \(C_{h}(s) = \zeta _{\mathbb {A}}(2) q^{-(h+1)s-1} \big (q^{\big [\frac{h}{2}\big ]+1}-1\big )\).

  4. 4.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} \zeta _{\mathbb {A}}(2)^{-1} q^{-g} \sum _{P\in \mathbb P_{2g+2}}\sum _{n=0}^{g-1} (g-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{P}(f) = B(g) \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|} + O\big (|P|^{\frac{1}{4}}\big ), \end{aligned}$$
    (4.7)

    where \(B(g) = q^{\big (\big [\frac{g-1}{2}\big ]+1\big )} \left\{ 2\zeta _{\mathbb {A}}(2)- \tfrac{1}{2}(1+(-1)^{g+1})\right\} - g - 2 \zeta _{\mathbb {A}}(2)\).

Proof

(1) For any \(P\in \mathbb H_{g}\) and \(L\in \mathbb {A}_{l}^{+}\) with \(l \le g\), we have \(\chi _{P}(L^2) = 1\). By (4.1), we have

$$\begin{aligned}&\sum _{P\in \mathbb H_{g}} \sum _{n=0}^{g} (\pm 1)^{n} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{P}(f) = \sum _{l=0}^{\big [\frac{g}{2}\big ]} q^{-2ls} \sum _{L\in \mathbb {A}_{l}^+} \sum _{P\in \mathbb H_{g}} \chi _{P}(L^2)\nonumber \\&\quad = \sum _{l=0}^{\big [\frac{g}{2}\big ]} q^{(1-2s)l} \sum _{P\in \mathbb H_{g}} 1 = A_{g}(s) \frac{|P|}{\log _{q}|P|} + O\left( A_{g}(s) \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|}\right) . \end{aligned}$$
(4.8)

Since \(A_{g}(s) \ll g\), the error term in (4.8) is \(\ll |P|^{\frac{1}{2}}\). Hence, we get the result. The proofs of (2), (3), and (4) are similar as that of (1). \(\square \)

Now, we consider the contribution of non-squares. For any non-constant monic polynomial f, which is not perfect square, we can reformulate Proposition 2.1 as follows:

$$\begin{aligned} \Bigg |\sum _{P\in \mathbb H_{g}} \chi _{P}(f)\Bigg | \ll \deg (f) \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|}. \end{aligned}$$
(4.9)

Proposition 4.2

  1. 1.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{P\in \mathbb H_{g}}\sum _{n=0}^{g} (\pm 1)^{n} q^{-ns} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{P}(f) = {\left\{ \begin{array}{ll} O(|P|^{1-\frac{s}{2}}) &{} \hbox {if}\,\,\,\mathrm{Re}(s) < 1, \\ O(|P|^{\frac{1}{2}}(\log _{q}|P|)) &{} \hbox {if}\,\,\,\mathrm{Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
    (4.10)
  2. 2.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{(1-2s)g} \sum _{P\in \mathbb H_{g}}\sum _{n=0}^{g-1} (\pm 1)^{n} q^{(s-1)n} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{P}(f) = O\big (|P|^{1-\frac{s}{2}}\big ). \end{aligned}$$
    (4.11)
  3. 3.

    Let \(h\in \{g-1, g\}\). For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{-(h+1)s} \sum _{P\in \mathbb H_{g}}\sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{P}(f) = O\big (|P|^{1-\frac{s}{2}}\big ). \end{aligned}$$
    (4.12)
  4. 4.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \zeta _{\mathbb {A}}(2)^{-1} q^{-g} \sum _{P\in \mathbb P_{2g+2}}\sum _{n=0}^{g-1} (g-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{P}(f) = O\big (|P|^{\frac{1}{2}}\big ). \end{aligned}$$
    (4.13)

Proof

(1) By (4.9), we have

$$\begin{aligned} \sum _{P\in \mathbb H_{g}}\sum _{n=0}^{g} (\pm 1)^{n} q^{-ns} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{P}(f)&\ll \sum _{n=0}^{g} q^{-ns} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \left| \sum _{P\in \mathbb H_{g}} \chi _{P}(f)\right| \end{aligned}$$
(4.14)
$$\begin{aligned}&\ll \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|} \sum _{n=0}^{g} n q^{(1-s)n}. \end{aligned}$$
(4.15)

Since

$$\begin{aligned} \sum _{n=0}^{g} n q^{(1-s)n} \ll {\left\{ \begin{array}{ll} g q^{(1-s)g} &{} \text { if }\,\,\, \mathrm{Re}(s)<1, \\ g^2 &{} \text { if } \,\,\,\mathrm{Re}(s) \ge 1, \end{array}\right. } \end{aligned}$$
(4.16)

we have

$$\begin{aligned} \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|} \sum _{n=0}^{g} n q^{(1-s)n} \ll {\left\{ \begin{array}{ll} |P|^{1-\frac{s}{2}} &{} \text { if }\,\,\, \mathrm{Re}(s) < 1, \\ |P|^{\frac{1}{2}}(\log _{q}|P|) &{} \text { if }\,\,\, \mathrm{Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
(4.17)

The proofs of (2), (3), and (4) are similar as that of (1). \(\square \)

4.1.2 Proof of Theorem 2.3 (1)

By Lemma 3.1 (1), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+1}} L(s,\chi _{P})&= \sum _{P\in \mathbb P_{2g+1}} \sum _{n=0}^{g} q^{-sn} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) \nonumber \\&\quad +q^{(1-2s)g} \sum _{P\in \mathbb P_{2g+1}} \sum _{n=0}^{g-1} q^{(s-1)n} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f). \end{aligned}$$
(4.18)

We can write \(\sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f)\) as

$$\begin{aligned} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) = \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f=\square \end{array}} \chi _{P}(f) + \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f\ne \square \end{array}} \chi _{P}(f). \end{aligned}$$
(4.19)

Then, by Propositions 4.1 (1), (2) and 4.2 (1), (2), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+1}} L(s,\chi _{P}) = \left( A_{g}(s) + B_{g}(s)\right) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O\big (|P|^{1-\frac{s}{2}}\big ) &{}\text {if }\, \mathrm{Re}(s) < 1,\\ O\big (|P|^{\frac{1}{2}}(\log _{q}|P|)\big ) &{}\text {if }\, \mathrm{Re}(s) \ge 1. \end{array}\right. }\nonumber \\ \end{aligned}$$
(4.20)

A simple computation shows that

$$\begin{aligned} A_{g}(s) + B_{g}(s) = {\left\{ \begin{array}{ll} g + 1 &{} \text { if }\,\,\, s = \frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) (1- q^{(1+g)(1-2s)}) &{} \text { if } \,\,\,s \ne \frac{1}{2}. \end{array}\right. } \end{aligned}$$
(4.21)

For \(\mathrm{Re(s)} \ge 1\), we have

$$\begin{aligned} \zeta _{\mathbb {A}}(2s) \big (1- q^{(1+g)(1-2s)}\big ) \frac{|P|}{\log _{q}|P|} = \zeta _{\mathbb {A}}(2s) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}}(\log _{q}|P|)\big ). \end{aligned}$$
(4.22)

Then, by (4.20), (4.21), and (4.22), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+1}} L(s,\chi _{P}) = I_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O\big (|P|^{1-\frac{s}{2}}\big ) &{} \text { if} \,\,\, \text { Re}(s) < 1, \\ O\big (|P|^{\frac{1}{2}}(\log _{q}|P|)\big ) &{} \text { if} \,\,\, \text { Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
(4.23)

This completes the proof of Theorem 2.3 (1). \(\square \)

4.1.3 Proof of Theorem 2.3 (2)

By Lemma 3.1 (2), we can write

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(s,\chi _{P})&= \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{g} q^{-sn} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) \nonumber \\&- q^{-(g+1)s}\sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{g} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) + \sum _{P\in \mathbb P_{2g+2}} H_{P}(s), \end{aligned}$$
(4.24)

where

$$\begin{aligned} H_{P}(1) = \zeta _{\mathbb {A}}(2)^{-1} q^{-g}\displaystyle \sum _{n=0}^{g-1} \left( g-n\right) \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) \end{aligned}$$
(4.25)

and, for \(s\ne 1\),

$$\begin{aligned} H_{P}(s) = \eta (s) q^{(1-2s)g} \sum _{n=0}^{g-1} q^{(s-1)n} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) - \eta (s) q^{-s g} \sum _{n=0}^{g-1} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) \end{aligned}$$
(4.26)

with \(\eta (s) = \frac{\zeta _{\mathbb {A}}(2-s)}{\zeta _{\mathbb {A}}(1+s)}\). We first consider the case \(s=1\). By Propositions 4.1 (1), (2), (4) and 4.2 (1), (2), (4), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(1,\chi _{P}) = H(g) \frac{|P|}{\log _{q}|P|} + O\big (|P|^{\frac{1}{2}}(\log _{q}|P|)\big ), \end{aligned}$$
(4.27)

where \(H(g) = A_{g}(1) - C_{g}(1) + B(g) |P|^{-\frac{1}{2}}\). Since

$$\begin{aligned} C_{g}(1) \frac{|P|}{\log _{q}|P|} = \zeta _{\mathbb {A}}(2) q^{\big [\frac{g}{2}\big ]-(g+1)} \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) \end{aligned}$$
(4.28)

and

$$\begin{aligned} B(g) \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|}&= q^{\left( \big [\frac{g-1}{2}\big ]+1\right) } \left\{ 2\zeta _{\mathbb {A}}(2)- \tfrac{1}{2}(1+(-1)^{g+1})\right\} \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|} \nonumber \\&\quad +O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) , \end{aligned}$$
(4.29)

we have

$$\begin{aligned} H(g) \frac{|P|}{\log _{q}|P|} = J_{g}(1) \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) , \end{aligned}$$
(4.30)

where

$$\begin{aligned} J_{g}(1) := A_{g}(1) - \zeta _{\mathbb {A}}(2) q^{\big [\frac{g}{2}\big ]-(g+1)} + q^{\left( \big [\frac{g-1}{2}\big ]-g\right) } \left\{ 2\zeta _{\mathbb {A}}(2)- \tfrac{1}{2}(1+(-1)^{g+1})\right\} . \end{aligned}$$
(4.31)

A simple computation shows that \(J_{g}(1) = \zeta _{\mathbb {A}}(2)\). Hence, by (4.27) and (4.30), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(1,\chi _{P}) = \zeta _{\mathbb {A}}(2) \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) . \end{aligned}$$
(4.32)

Now, consider the case \(s\ne 1\). For \(|s-1|>\varepsilon \), \(\eta (s)\) is bounded. Then, by Propositions 4.1 and 4.2, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(s,\chi _{P}) = H_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O\big (|P|^{1-\frac{s}{2}}\big ) &{} \text { if Re}(s) < 1, \\ O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) &{} \text { if Re}(s) \ge 1, \end{array}\right. } \end{aligned}$$
(4.33)

where \(H_{g}(s) = A_{g}(s) + \eta (s) B_{g}(s) - C_{g}(s) - \eta (s) C_{g-1}(s)\). We have that, for \(s\in \mathbb C\) with \(\frac{1}{2} \le \mathrm{Re}(s) < 1\) and \(|s-1|>\varepsilon \),

$$\begin{aligned} C_{g}(s) \frac{|P|}{\log _{q}|P|}&= \zeta _{\mathbb {A}}(2) q^{\big [\frac{g}{2}\big ]-(g+1)s} \frac{|P|}{\log _{q}|P|} + O\big (|P|^{1-\frac{s}{2}}\big ), \end{aligned}$$
(4.34)
$$\begin{aligned} \eta (s) C_{g-1}(s) \frac{|P|}{\log _{q}|P|}&= \zeta _{\mathbb {A}}(2) \eta (s) q^{\big [\frac{g-1}{2}\big ]-gs} \frac{|P|}{\log _{q}|P|} + O\big (|P|^{1-\frac{s}{2}}\big ), \end{aligned}$$
(4.35)

and, for \(s\in \mathbb C\) with \(1 \le \mathrm{Re}(s) < \frac{3}{2}\) and \(|s-1|>\varepsilon \),

$$\begin{aligned} \eta (s) B_{g}(s) \frac{|P|}{\log _{q}|P|}&= \eta (s) \zeta _{\mathbb {A}}(2s) q^{(1-2s)(g-[\frac{g-1}{2}])} \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) , \nonumber \\\end{aligned}$$
(4.36)
$$\begin{aligned} C_{g}(s) \frac{|P|}{\log _{q}|P|}&= \zeta _{\mathbb {A}}(2) q^{[\frac{g}{2}]-(g+1)s} \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) , \end{aligned}$$
(4.37)
$$\begin{aligned} \eta (s) C_{g-1}(s) \frac{|P|}{\log _{q}|P|}&= \zeta _{\mathbb {A}}(2) \eta (s) q^{[\frac{g-1}{2}]-gs} \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) , \end{aligned}$$
(4.38)

and, for \(s\in \mathbb C\) with \(\frac{3}{2} \le \mathrm{Re}(s)\),

$$\begin{aligned} A_{g}(s) \frac{|P|}{\log _{q}|P|}&= \zeta _{\mathbb {A}}(2s) \frac{|P|}{\log _{q}|P|} + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) , \end{aligned}$$
(4.39)
$$\begin{aligned} \eta (s) B_{g}(s) \frac{|P|}{\log _{q}|P|}&\ll |P|^{\frac{1}{2}} (\log _{q}|P|), \end{aligned}$$
(4.40)
$$\begin{aligned} C_{g}(s) \frac{|P|}{\log _{q}|P|}&\ll |P|^{\frac{1}{2}}(\log _{q}|P|), \end{aligned}$$
(4.41)
$$\begin{aligned} \eta (s) C_{g-1}(s) \frac{|P|}{\log _{q}|P|}&\ll |P|^{\frac{1}{2}}(\log _{q}|P|). \end{aligned}$$
(4.42)

Then, by (4.34), (4.36), and (4.39), we have

$$\begin{aligned} H_{g}(s) \frac{|P|}{\log _{q}|P|} = J_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O(|P|^{1-\frac{s}{2}}) &{} \text { if} \,\,\, \text {Re}(s) < 1, \\ O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) &{} \text { if} \,\,\, \text {Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
(4.43)

Hence, by (4.33) and (4.43), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(s,\chi _{P}) = J_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O(|P|^{1-\frac{s}{2}}), &{} \text { if } \,\,\, \text {Re}(s) < 1 \\ O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)\right) &{} \text { if} \,\,\, \text {Re}(s) \ge 1 \end{array}\right. } \end{aligned}$$
(4.44)

for \(s\in \mathbb C\) with \(\frac{1}{2} \le \mathrm{Re}(s)\) and \(|s-1|>\varepsilon \). This completes the proof of Theorem 2.3 (2). \(\square \)

4.1.4 Proof of Theorem 2.3 (3)

For any \(f\in \mathbb {A}^{+}\), we have \(\chi _{\gamma P}(f) = (-1)^{\deg (f)} \chi _{P}(f)\). Hence, by Lemma 3.1 (3), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(s,\chi _{\gamma P})&= \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{g} (-1)^{n} q^{-sn} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f)\nonumber \\&\quad +(-1)^{g} q^{-(g+1)s} \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{g}\sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) \nonumber \\&\quad + \nu (s) q^{(1-2s)g} \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{g-1} (-1)^{n} q^{(s-1)n} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f) \nonumber \\&\quad +(-1)^{g+1}\nu (s) q^{-sg} \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{g-1} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{P}(f), \end{aligned}$$
(4.45)

where \(\nu (s) = \frac{1+q^{-s}}{1+q^{s-1}}\). Following the same process as in the proof of Theorem 2.3 (2), we can show that

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L(s,\chi _{\gamma P}) = K_{g}(s) \frac{|P|}{\log _{q}|P|} + {\left\{ \begin{array}{ll} O(|P|^{1-\frac{s}{2}}) &{} \text { if} \,\,\, \text {Re}(s) < 1, \\ O\left( |P|^{\frac{1}{2}} (\log _{q}|P|)\right) &{} \text { if} \,\,\, \text {Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
(4.46)

This completes the proof of Theorem 2.3 (3). \(\square \)

4.2 Even characteristic case

In this subsection, we give a proof of Theorem 2.13. In Sect. 4.2.2, we obtain several results of the contribution of squares and of non-squares, which will be used to calculate the first moment of L-functions in Sects. 4.2.3, 4.2.4, and 4.2.5.

4.2.1 Auxiliary Lemmas

Lemma 4.3

  1. 1.

    For any positive integer n, we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{n}}\sum _{u\in \mathcal F_{P}} 1 = \frac{|P|^{2}}{\log _{q}|P|} + O\left( \frac{|P|^{\frac{3}{2}}}{\log _{q}|P|}\right) . \end{aligned}$$
    (4.47)
  2. 2.

    For any positive integer n, we have

    $$\begin{aligned} \#\mathcal H_{n+1} = 2 \frac{q^{2n+1}}{n}+ O\left( \frac{q^{2n}}{n^2}\right) . \end{aligned}$$
    (4.48)

Proof

  1. 1.

    By Theorem 1.3, we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{n}}\sum _{u\in \mathcal F_{P}} 1 = \sum _{P\in \mathbb P_{n}}\sum _{\begin{array}{c} 0\ne A \in \mathbb {A}^{+} \\ \deg (A) < n \end{array}} 1&= (|P|-1) \frac{|P|}{\log _{q}|P|} + O\left( \frac{|P|^{\frac{3}{2}}}{\log _{q}|P|}\right) \end{aligned}$$
    (4.49)
    $$\begin{aligned}&= \frac{|P|^{2}}{\log _{q}|P|} + O\left( \frac{|P|^{\frac{3}{2}}}{\log _{q}|P|}\right) . \end{aligned}$$
    (4.50)
  2. 2.

    Since \(\#\mathcal G_{n+1-r} = 2 \zeta _{\mathbb {A}}(2)^{-1} q^{n+1-r}\), by (4.47), we have

    $$\begin{aligned} \#\mathcal H_{(r,n+1-r)} = \#\mathcal F_{r} \cdot \#\mathcal G_{n+1-r} = 2 \zeta _{\mathbb {A}}(2)^{-1} q^{n+1-r} (q^{r}-1) \#\mathbb P_{r} \end{aligned}$$
    (4.51)

    and

    $$\begin{aligned} \#\mathcal H_{n+1} = \sum _{r=1}^{n} \#\mathcal H_{(r,n+1-r)} = 2 \zeta _{\mathbb {A}}(2)^{-1} q^{n+1} \sum _{r=1}^{n} (1-q^{-r}) \#\mathbb P_{r}. \end{aligned}$$
    (4.52)

    From [14, Theorem 2], we can deduce that

    $$\begin{aligned} \sum _{r=1}^{n} \#\mathbb P_{r} = \frac{q}{q-1} \frac{q^{n}}{n} + O(\frac{q^{n}}{n^2}). \end{aligned}$$
    (4.53)

    Also, since \(\#\mathbb P_{r} \le \frac{q^r}{r}\), we have

    $$\begin{aligned} \sum _{r=1}^{n} q^{-r} \#\mathbb P_{r} \le \sum _{r=1}^{n} \frac{1}{r} \ll \log n. \end{aligned}$$
    (4.54)

    Hence, we get the result. \(\square \)

For \(P\in \mathbb P\) and \(f\in \mathbb {A}^{+}\), let \(\varGamma _{f, P}\) and \(T_{f,P}\) be defined by (see [6, §3])

$$\begin{aligned} \varGamma _{f, P} = \sum _{\begin{array}{c} A\in \mathbb {A}\\ \deg (A)< \deg (P) \end{array}} \left\{ \frac{A/P}{f}\right\} \quad \text { and }\quad T_{f, P} = \sum _{\begin{array}{c} 0 \ne A\in \mathbb {A}\\ \deg (A) < \deg (P) \end{array}} \left\{ \frac{A/P}{f}\right\} . \end{aligned}$$
(4.55)

Lemma 4.4

For \(f\in \mathbb {A}^{+}\) with \(\deg (f) \le 2g+1\), which is not a perfect square, we have

$$\begin{aligned} \left| \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \chi _{u}(f) \right| \ll \frac{|P|}{\log _{q}|P|}. \end{aligned}$$
(4.56)

Proof

By [6, Lemma 3.1], we have \(\varGamma _{f, P} = 0\), so \(T_{f,P} = \varGamma _{f, P} - \{\frac{0}{f}\} = -1\). Then, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \chi _{u}(f)&= \sum _{P\in \mathbb P_{g+1}} \sum _{\begin{array}{c} 0 \ne A \in \mathbb {A}\\ \deg (A) < g+1 \end{array}} \left\{ \frac{A/P}{f}\right\} \end{aligned}$$
(4.57)
$$\begin{aligned}&= \sum _{P\in \mathbb P_{g+1}} T_{f, P} = - \sum _{\begin{array}{c} P\in \mathbb P_{g+1}\\ P\not \mid f \end{array}} 1 \ll \#\mathbb P_{g+1}. \end{aligned}$$
(4.58)

Hence, by Theorem 1.3, we get the result. \(\square \)

For \(P\in \mathbb P, f\in \mathbb {A}^{+}\) and positive integer s, let \(\varGamma _{f,P,s}\) and \(T_{f,P,s}\) be defined by

$$\begin{aligned} \varGamma _{f,P,s}&= \sum _{\begin{array}{c} A\in \mathbb {A}\\ \deg (A)< \deg (P) \end{array}} \sum _{F\in \mathcal G_{s}} \left\{ \frac{A/P+F}{f}\right\} ~~\text { and }\nonumber \\ T_{f,P,s}&= \sum _{\begin{array}{c} 0 \ne A\in \mathbb {A}\\ \deg (A) < \deg (P) \end{array}} \sum _{F\in \mathcal G_{s}} \left\{ \frac{A/P+F}{f}\right\} . \end{aligned}$$
(4.59)

Lemma 4.5

Let \(P\in \mathbb P, f\in \mathbb {A}^{+}\) and s be a positive integer with \(\deg (f) \le 2 \deg (P) + 2s - 2\). Suppose that \(P\not \mid f\) and f is not a perfect square. Then \({\varGamma }_{f, P, s} = 0\) and \(T_{f,P,s} \ll q^{s}\).

Proof

Let \(\mathcal E_{P, s}\) be the set of rational functions \(u = \frac{A}{P} + F \in k\) such that \(\deg (A) < \deg (P)\) and \(F = \sum _{n=1}^{s-1} \alpha _{n} T^{2n-1}\) with \(\alpha _{n} \in \mathbb {F}_{q}\). Then, we have

$$\begin{aligned} \varGamma _{f,P,s} = \left( 1+\left\{ \frac{\gamma }{f}\right\} \right) \left( \sum _{\alpha \in \mathbb {F}_{q}^*} \left\{ \frac{\alpha T^{2s-1}}{f}\right\} \sum _{u\in \mathcal E_{P,s}} \left\{ \frac{u}{f}\right\} \right) , \end{aligned}$$
(4.60)

where \(\gamma \) is a generator of \(\mathbb {F}_{q}^{\times }\). Since \(\mathcal E_{P, s}\) is abelian group and \(\{\frac{\cdot }{f}\}\) is a homomorphism, we have

$$\begin{aligned} \sum _{u\in \mathcal E_{P,s}} \left\{ \frac{u}{f}\right\} = 0. \end{aligned}$$
(4.61)

From (4.60) and (4.61), we have \(\varGamma _{f,P,s} = 0\) and \(T_{f,P,s} = - \sum _{F\in \mathcal G_{s}} \{\frac{F}{f}\} \ll \#\mathcal G_{s} \ll q^{s}\). \(\square \)

Lemma 4.6

For \(f\in \mathbb {A}^{+}\) with \(\deg (f)< 2g+1\), which is not a perfect square, we have

$$\begin{aligned} \left| \sum _{u\in \mathcal H_{g+1}} \chi _{u}(f)\right| \ll (\log g) q^{g}. \end{aligned}$$
(4.62)

Proof

By Lemma 4.5, we have

$$\begin{aligned} \sum _{u\in \mathcal H_{(r,g+1-r)}} \chi _{u}(f) = \sum _{P\in \mathbb P_{r}} T_{f, P, g+1-r} \ll q^{g+1-r} \#\mathbb P_{r} \ll \frac{q^{g}}{r}. \end{aligned}$$
(4.63)

Hence, we have

$$\begin{aligned} \left| \sum _{u\in \mathcal H_{g+1}} \chi _{u}(f)\right| = \left| \sum _{r=1}^{g}\sum _{u\in \mathcal H_{(r,g+1-r)}} \chi _{u}(f)\right| \ll q^{g} \sum _{r=1}^{g} \frac{1}{r} \ll (\log g) q^{g}. \end{aligned}$$
(4.64)

\(\square \)

4.2.2 Preparations for the proof

We first consider the contributions of squares.

Proposition 4.7

  1. 1.

    For \(s=\frac{1}{2}\), we have

    $$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f = \square \end{array}} \chi _{u}(f) = 2\left( \big [\tfrac{g}{2}\big ]+1\right) \frac{q^{2g+1}}{g} + O\left( \frac{q^{2g}}{g}\right) \end{aligned}$$
    (4.65)

    and, for \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2} ~(s \ne \frac{1}{2})\),

    $$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f = \square \end{array}} \chi _{u}(f) = 2 \zeta _{\mathbb {A}}(2s) \frac{q^{2g+1}}{g} + O\left( \frac{q^{2g}}{g^2}\right) . \end{aligned}$$
    (4.66)
  2. 2.

    For \(s=\frac{1}{2}\), we have

    $$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g-1} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f = \square \end{array}} \chi _{u}(f) = 2 \left( \big [\tfrac{g-1}{2}\big ]+1\right) \frac{q^{2g+1}}{g} + O\left( \frac{q^{2g}}{g}\right) \end{aligned}$$
    (4.67)

    and, for \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2} ~(s \ne \frac{1}{2})\),

    $$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g-1} q^{(s-1)n} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f = \square \end{array}} \chi _{u}(f) = O\left( \frac{q^{2g}}{g^2}\right) . \end{aligned}$$
    (4.68)

Proof

(1) We have

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f = \square \end{array}} \chi _{u}(f)&=\sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{n=0}^{g} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f = \square \end{array}} \chi _{u}(f) \end{aligned}$$
(4.69)
$$\begin{aligned}&= \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=0}^{\big [\frac{g}{2}\big ]} q^{-2sl} \sum _{L\in \mathbb {A}_{l}^{+}} \chi _{u}(L^2). \end{aligned}$$
(4.70)

For any \(u = v+F\in \mathcal H_{(r,g+1-r)}\) with \(v=\frac{A}{P}\in \mathcal F_{r}\) and \(F\in \mathcal G_{g+1-r}\), we have

$$\begin{aligned} \sum _{L\in \mathbb {A}_{l}^{+}} \chi _{u}(L^2) = \sum _{\begin{array}{c} L\in \mathbb {A}_{l}^{+}\\ (L,P)=1 \end{array}} 1 = {\left\{ \begin{array}{ll} q^{l} &{} \text { if } l < r, \\ q^{l} - q^{l-r} &{} \text { if } l \ge r. \end{array}\right. } \end{aligned}$$
(4.71)

Then we have

$$\begin{aligned} \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{n=0}^{g} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f = \square \end{array}} \chi _{u}(f) = {A}_{g}(s) \sum _{r=1}^{g} \#\mathcal H_{(r,g+1-r)} - \alpha _{g}(s), \end{aligned}$$
(4.72)

where \(A_{g}(s)\) is given in Proposition 4.1 (1) and

$$\begin{aligned} \alpha _{g}(s) = \sum _{r=1}^{\big [\frac{g}{2}\big ]} q^{-r} \#\mathcal H_{(r,g+1-r)} \sum _{l=r}^{\big [\frac{g}{2}\big ]} q^{(1-2s)l}. \end{aligned}$$
(4.73)

By (4.48), we have

$$\begin{aligned} {A}_{g}(s) \sum _{r=1}^{g} \#\mathcal H_{(r,g+1-r)} = 2 {A}_{g}(s) \frac{q^{2g+1}}{g} + O\left( A_{g}(s) \frac{q^{2g}}{g^2}\right) . \end{aligned}$$
(4.74)

For \(s=\frac{1}{2}\), we have \(A_{g}(\frac{1}{2}) \frac{q^{2g}}{g^2} \ll \frac{q^{2g}}{g}\). For \(s\ne \frac{1}{2}\), we have \(A_{g}(s) \frac{q^{2g}}{g^2} \ll \frac{q^{2g}}{g^2}\) and

$$\begin{aligned} {A}_{g}(s) \frac{q^{2g+1}}{g} = \zeta _{\mathbb {A}}(2s) \frac{q^{2g+1}}{g} + O\left( \frac{q^{2g}}{g^2}\right) . \end{aligned}$$
(4.75)

Since \(\#\mathcal H_{(r,g+1-r)} \ll q^{g} \frac{q^r}{r}\),

$$\begin{aligned} \alpha _{g}(s) \ll q^{g} \sum _{r=1}^{\big [\frac{g}{2}\big ]} \frac{1}{r} \sum _{l=r}^{\big [\frac{g}{2}\big ]} q^{(1-2s)l} \ll (\log g) g q^{g} \ll \frac{q^{2g}}{g^2}. \end{aligned}$$
(4.76)

Therefore, we get the result. Similarly, we can prove (2). \(\square \)

Proposition 4.8

  1. 1.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} (\pm 1)^{n} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{u}(f) = \tilde{A}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{\frac{3}{2}}\right) , \end{aligned}$$
    (4.77)

    where

    $$\begin{aligned} \tilde{A}_{g}(s) = {\left\{ \begin{array}{ll} \left[ \frac{g}{2}\right] +1 &{} \hbox {if}\,\,\,s = \frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s)\left( 1-q^{(1-2s)\left( \big [\frac{g}{2}\big ]+1\right) }\right) &{} \hbox {if}\,\,\, \mathrm{Re}(s) < 1 (s\ne \frac{1}{2}), \\ \zeta _{\mathbb {A}}(2s) &{} \hbox {if}\,\,\,\mathrm{Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
    (4.78)
  2. 2.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{(1-2s)g} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g-1} (\pm 1)^{n} q^{(s-1)n} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{u}(f) = \tilde{B}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{2-s}\right) ,\nonumber \\ \end{aligned}$$
    (4.79)

    where

    $$\begin{aligned} \tilde{B}_{g}(s) = {\left\{ \begin{array}{ll} [\frac{g-1}{2}] + 1 &{} \mathrm{if}\,\,\,s = \frac{1}{2}, \\ \zeta _{\mathbb {A}}(2s) q^{(g-[\frac{g-1}{2}])(1-2s)} &{} \mathrm{if}\,\,\, s \ne \frac{1}{2}. \end{array}\right. } \end{aligned}$$
    (4.80)
  3. 3.

    Let \(h \in \{g-1, g\}\). For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{-(h+1)s} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{u}(f) = \zeta _{\mathbb {A}}(2) q^{\big [\frac{h}{2}\big ]-(h+1)s} \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{2-s}\right) .\nonumber \\ \end{aligned}$$
    (4.81)
  4. 4.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} \zeta _{\mathbb {A}}(2)^{-1} q^{-g} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g-1} (g-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{u}(f) = \tilde{B}(g) \frac{|P|}{\log _{q}|P|} + O\left( |P|\right) , \end{aligned}$$
    (4.82)

    where

    $$\begin{aligned} \tilde{B}(g) = q^{\left( \big [\frac{g-1}{2}\big ]+1\right) } \left\{ 2\zeta _{\mathbb {A}}(2) - \tfrac{1}{2} (1+(-1)^{g+1})\right\} . \end{aligned}$$
    (4.83)

Proof

(1) By (4.47), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} (\pm 1)^{n} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}} \chi _{u}(f)&= \sum _{l=0}^{\big [\frac{g}{2}\big ]} q^{-2sl} \sum _{L\in \mathbb {A}_{l}^+} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \chi _{u}(L^2) \nonumber \\&= \sum _{l=0}^{\big [\frac{g}{2}\big ]} q^{(1-2s)l} \sum _{P\in \mathbb P_{g+1}} \sum _{u\in \mathcal F_{P}} 1\nonumber \\&= {A}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\left( {A}_{g}(s) \frac{|P|^{\frac{3}{2}}}{\log _{q}|P|}\right) , \end{aligned}$$
(4.84)

where \(A_{g}(s)\) is given in Proposition 4.1 (1). Since \({A}_{g}(s) \ll g+1\), the error term in (4.84) is \(\ll |P|^{\frac{3}{2}}\). Since \(q^{(1-2s)\left( \big [\frac{g}{2}\big ]+1\right) } |P|^2 \ll |P|^{\frac{3}{2}}\) for \(\mathrm{Re}(s) \ge 1\), we have

$$\begin{aligned} A_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} = \tilde{A}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{\frac{3}{2}}\right) . \end{aligned}$$
(4.85)

Hence, we get the result. Similarly, we can prove (2), (3), and (4). \(\square \)

Now we consider the contribution of non-squares.

Proposition 4.9

  1. 1.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f \ne \square \end{array}} \chi _{u}(f) = O((\log g) g q^{\frac{3g}{2}}). \end{aligned}$$
    (4.86)
  2. 2.

    For \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{(1-2s)g} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g-1} q^{(s-1)n} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f \ne \square \end{array}} \chi _{u}(f) = O((\log g) g q^{\frac{3g}{2}}). \end{aligned}$$
    (4.87)

Proof

(1) By using the fact that \(\sum _{r=1}^{g} \frac{1}{r} \ll \log g\) and Lemma 4.6, we have

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f \ne \square \end{array}} \chi _{u}(f)&\ll \sum _{n=0}^{g} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f \ne \square \end{array}} \left| \sum _{u\in \mathcal H_{g+1}} \chi _{u}(f)\right| \end{aligned}$$
(4.88)
$$\begin{aligned}&\ll (\log g) q^{g} \sum _{n=0}^{g} q^{(1-s)n} \ll (\log g) g q^{\frac{3g}{2}}. \end{aligned}$$
(4.89)

Similarly, we can prove (2). \(\square \)

Proposition 4.10

  1. 1.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} (\pm 1)^{n} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{u}(f) = {\left\{ \begin{array}{ll} O(|P|^{2-s}) &{} { if}\,\,\,\mathrm{Re}(s) < 1, \\ O(|P|) &{} {if}\,\,\,\mathrm{Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
    (4.90)
  2. 2.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{(1-2s)g} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g-1} (\pm 1)^{n} q^{(s-1)n} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{u}(f) = O\left( |P|^{2-s}\right) . \end{aligned}$$
    (4.91)
  3. 3.

    Let \(h \in \{g-1, g\}\). For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} q^{-(h+1)s} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{u}(f) = O\left( |P|^{2-s}\right) . \end{aligned}$$
    (4.92)
  4. 4.

    For \(s \in \mathbb {C}\) with \(\mathrm{Re}(s)\ge \frac{1}{2}\), we have

    $$\begin{aligned} \zeta _{\mathbb {A}}(2)^{-1} q^{-g} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g-1} (g-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{u}(f) = O\left( |P|\right) . \end{aligned}$$
    (4.93)

Proof

(1) By Lemma 4.4, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} (\pm 1)^{n} q^{-sn} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \chi _{u}(f)&\ll \sum _{n=0}^{g} q^{-ns} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}} \left| \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \chi _{u}(f)\right| \end{aligned}$$
(4.94)
$$\begin{aligned}&\ll \frac{|P|}{\log _{q}|P|} \sum _{n=0}^{g}q^{(1-s)n}. \end{aligned}$$
(4.95)

Since

$$\begin{aligned} \sum _{n=0}^{g} q^{(1-s)n} \ll {\left\{ \begin{array}{ll} |P|^{1-s} (\log _{q}|P|) &{} \text { if Re}(s)<1, \\ \log _{q}|P| &{} \text { if Re}(s) \ge 1, \end{array}\right. } \end{aligned}$$
(4.96)

we have

$$\begin{aligned} \frac{|P|}{\log _{q}|P|} \sum _{n=0}^{g}q^{(1-s)n} \ll {\left\{ \begin{array}{ll} |P|^{2-s} &{} \text { if Re}(s) < 1, \\ |P| &{} \text { if Re}(s) \ge 1. \end{array}\right. } \end{aligned}$$
(4.97)

Similarly, we can prove (2), (3), and (4). \(\square \)

4.2.3 Proof of Theorem 2.13 (1)

By Lemma 3.1 (1), we have

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L(s,\chi _{u})&= \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g} q^{-sn} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) \nonumber \\&\quad + q^{(1-2s)g}\sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{g} q^{(s-1)n} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f). \end{aligned}$$
(4.98)

By Propositions 4.7 and 4.9, for \(s=\frac{1}{2}\), we have

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) = 2 \left( \big [\tfrac{g}{2}\big ]+\big [\tfrac{g-1}{2}\big ]+2\right) \frac{q^{2g+1}}{g} + O\left( \frac{q^{2g}}{g}\right) , \end{aligned}$$
(4.99)

and, for \(s\in \mathbb C\) with \(\mathrm{Re}(s) \ge \frac{1}{2} ~(s \ne \frac{1}{2})\),

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L(s,\chi _{u}) = 2 \zeta _{\mathbb {A}}(2s) \frac{q^{2g+1}}{g} + O\left( \frac{q^{2g}}{g^2}\right) . \end{aligned}$$
(4.100)

A simple computation shows that \(\big [\frac{g}{2}\big ]+\big [\frac{g-1}{2}\big ]+2 = g+1\). This completes the proof of Theorem 2.13 (1). \(\square \)

4.2.4 Proof of Theorem 2.13 (2)

By Lemma 3.1 (2), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L(s,\chi _{u})&= \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} q^{-sn} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) \nonumber \\&\quad - q^{-(g+1)s}\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) + \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} H_{u}(s),\nonumber \\ \end{aligned}$$
(4.101)

where

$$\begin{aligned} H_{u}(1) = \zeta _{\mathbb {A}}(2)^{-1} q^{-g}\displaystyle \sum _{n=0}^{g-1} \left( g-n\right) \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) \end{aligned}$$
(4.102)

and, for \(s\ne 1\),

$$\begin{aligned} H_{u}(s) = \eta (s) q^{(1-2s)g} \sum _{n=0}^{g-1} q^{(s-1)n} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) - \eta (s) q^{-s g} \sum _{n=0}^{g-1} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) \end{aligned}$$
(4.103)

with \(\eta (s) = \frac{\zeta _{\mathbb {A}}(2-s)}{\zeta _{\mathbb {A}}(1+s)}\). First, we consider the case \(s=1\). By Propositions 4.8 and 4.10, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L(1,\chi _{u}) = \tilde{H}(g) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{\frac{3}{2}}\right) , \end{aligned}$$
(4.104)

where

$$\begin{aligned} \tilde{H}(g) := \tilde{A}_{g}(1) - \zeta _{\mathbb {A}}(2) q^{\big [\frac{g}{2}\big ]-(g+1)} + \tilde{B}(g) |P|^{-1}. \end{aligned}$$
(4.105)

It is easy to show that

$$\begin{aligned} \tilde{H}(g) \frac{|P|^{2}}{\log _{q}|P|} = \zeta _{\mathbb {A}}(2) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{\frac{3}{2}}\right) . \end{aligned}$$
(4.106)

Hence, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L(1,\chi _{u}) = \zeta _{\mathbb {A}}(2) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{\frac{3}{2}}\right) . \end{aligned}$$
(4.107)

Now, consider the case \(s\ne 1\). For \(|s-1|>\varepsilon \), \(\eta (s)\) is bounded. By Propositions 4.8 and 4.10, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L(s,\chi _{u}) = \tilde{H}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{\frac{3}{2}}\right) , \end{aligned}$$
(4.108)

where

$$\begin{aligned} \tilde{H}_{g}(s) := \tilde{A}_{g}(s) - \zeta _{\mathbb {A}}(2) q^{\big [\frac{g}{2}\big ]-(g+1)s} + \eta (s) \left\{ \tilde{B}_{g}(s) - \zeta _{\mathbb {A}}(2) q^{\big [\frac{g-1}{2}\big ]-gs}\right\} . \end{aligned}$$
(4.109)

For \(s\in \mathbb C\) with \(1 \le \mathrm{Re}(s)\) and \(|s-1|>\varepsilon \), we have

$$\begin{aligned} \zeta _{\mathbb {A}}(2) q^{\big [\frac{g}{2}\big ]-(g+1)s} \frac{|P|^{2}}{\log _{q}|P|}&\ll |P|^{\frac{3}{2}}, \end{aligned}$$
(4.110)
$$\begin{aligned} \eta (s) \left\{ \tilde{B}_{g}(s) - \zeta _{\mathbb {A}}(2) q^{\big [\frac{g-1}{2}\big ]-gs}\right\} \frac{|P|^{2}}{\log _{q}|P|}&\ll |P|^{\frac{3}{2}}. \end{aligned}$$
(4.111)

Then, by (4.110), we have

$$\begin{aligned} \tilde{H}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} = \tilde{J}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O(|P|^{\frac{3}{2}}). \end{aligned}$$
(4.112)

Hence, by (4.108) and (4.112), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L(s,\chi _{u}) = \tilde{J}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O(|P|^{\frac{3}{2}}) \end{aligned}$$
(4.113)

for \(s\in \mathbb C\) with \(\frac{1}{2} \le \mathrm{Re}(s)\) and \(|s-1|>\varepsilon \). This completes the proof of Theorem 2.13 (2). \(\square \)

4.2.5 Proof of Theorem 2.13 (3)

For any \(u = v+\xi \in \mathcal F'_{g+1}\) with \(v\in \mathcal F_{g+1}\), we have \(\chi _{u}(f) = (-1)^{\deg (f)} \chi _{v}(f)\). Then, by Lemma 3.1 (3), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F'_{P}} L(s,\chi _{u})&= \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} (-1)^{n} q^{-sn} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) \nonumber \\&\quad + (-1)^{g} q^{-(g+1)s} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) \nonumber \\&\quad + \nu (s) q^{(1-2s)g} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g-1} (-1)^{n} q^{(s-1)n} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f) \nonumber \\&\quad + (-1)^{g+1} \nu (s) q^{-sg} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{g-1} \sum _{f\in \mathbb {A}_{n}^{+}} \chi _{u}(f), \end{aligned}$$
(4.114)

where \(\nu (s) := \frac{1+q^{-s}}{1+q^{s-1}}\). Following the process as in the proof of Theorem 2.13 (2), we can show that

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F'_{P}} L(s,\chi _{u}) = \tilde{K}_{g}(s) \frac{|P|^{2}}{\log _{q}|P|} + O\left( |P|^{\frac{3}{2}}\right) \end{aligned}$$
(4.115)

for \(s\in \mathbb C\) with \(\frac{1}{2} \le \mathrm{Re}(s)\). This completes the proof of Theorem 2.13 (3). \(\square \)

5 Second moment of prime L-functions at \(s=\frac{1}{2}\)

5.1 Some lemmas on divisor function

We present now a few lemmas about the divisor function in \(\mathbb {F}_{q}[T]\).

Lemma 5.1

For any positive integer n, we have

$$\begin{aligned} \sum _{f\in \mathbb {A}_{n}^{+}}d(f) = n q^{n} + O(q^{n}) \end{aligned}$$
(5.1)

and

$$\begin{aligned} \sum _{f\in \mathbb {A}_{n}^{+}}d(f^{2}) = \frac{1}{2 \zeta _{\mathbb {A}}(2)} n^2 q^{n} + O(n q^{n}). \end{aligned}$$
(5.2)

Proof

Equations (5.1) and (5.2) are quoted from [16, Proposition 2.5] and [4, Lemma 4.4], respectively. \(\square \)

Remark 5.2

Let \(\rho (f) := d(f^2)\), which is a multiplicative function on \(\mathbb {A}^{+}\), and \(\zeta _{\rho }(s)\) be the Dirichlet series associated to \(\rho \). In the proof of [4, Lemma 4.4], it is shown that

$$\begin{aligned} \zeta _{\rho }(s) = \frac{\zeta _{\mathbb {A}}(s)^3}{\zeta _{\mathbb {A}}(2s)} = \frac{1-q^{1-2s}}{(1-q^{1-s})^3}. \end{aligned}$$
(5.3)

Putting \(z = q^{-s}\) and considering the power series expansion of \(\frac{1-qz^2}{(1-qz)^3}\) at \(z=0\), we can see that

$$\begin{aligned} \sum _{f\in \mathbb {A}_{n}^{+}} d(f^2) = \left\{ 1+\tfrac{1}{2} (3+q^{-1}) n +\tfrac{1}{2} (1-q^{-1})n^2\right\} q^{n}. \end{aligned}$$
(5.4)

Lemma 5.3

Let \(P\in \mathbb P_{r}\). Then, for any integer \(n\ge 0\), the value

$$\begin{aligned} \sum _{f\in \mathbb {A}_{n}^{+}, P\not \mid f} d(f^2) \end{aligned}$$
(5.5)

is independent of P and depends only on r. Denote this value by \(\rho ^{*}_{n}(r)\), and let \(\rho _{n} = \sum _{f\in \mathbb {A}_{n}^{+}} d(f^2)\). Then we have

$$\begin{aligned} \rho ^{*}_{n}(r) = {\left\{ \begin{array}{ll} \rho _{n} &{} \hbox {for} \,\,\,\,0 \le n \le r-1, \\ \rho _{n} - 3 \rho _{n-r} &{} \hbox {for} \,\,\, \,r \le n \le 2r-1, \\ \rho _{n}-3\rho _{n-r} + 4 \sum _{l=2}^{m} (-1)^{l} \rho _{n-lr} &{} \hbox {for} \,\,mr \le n < (m+1)r-1\, \hbox {with}\, m\ge 2. \end{array}\right. } \end{aligned}$$
(5.6)

Proof

Let \(\zeta _{\rho }(s)\) be the Dirichlet series given in Remark 5.2. Write

$$\begin{aligned} \zeta _{\rho }(s) = \sum _{n=0}^{\infty } \rho _{n} q^{-sn} ~~~\text { with }~~ \rho _{n} = \sum _{f\in \mathbb {A}_{n}^{+}} d(f^2). \end{aligned}$$
(5.7)

Let \(\zeta _{\rho }^{*}(s)\) be the power series defined by

$$\begin{aligned} \zeta _{\rho }^{*}(s) = \sum _{\begin{array}{c} f\in \mathbb {A}^{+}\\ P\not \mid f \end{array}} \rho (f) |f|^{-s} = \sum _{n=0}^{\infty } \rho ^{*}_{n} q^{-sn}, ~~~\text { where }~~ \rho ^{*}_{n} = \sum _{\begin{array}{c} f\in \mathbb {A}^{+}_{n}\\ P\not \mid f \end{array}} \rho (f). \end{aligned}$$
(5.8)

Then, we have

$$\begin{aligned} \zeta _{\rho }(s) = \zeta _{\rho }^{*}(s) \left( 1+\sum _{n=1}^{\infty } \rho (P^{n}) |P|^{-ns}\right) . \end{aligned}$$
(5.9)

Putting \(z=q^{-s}\), since \(\rho (P^n) = d(P^{2n}) = 2n+1\), we have

$$\begin{aligned} 1+\sum _{n=1}^{\infty } \rho (P^{n}) |P|^{-ns}&= 1+\sum _{n=1}^{\infty } (2n+1) |P|^{-ns} = 1+\sum _{n=1}^{\infty } (2n+1) z^{r n} = \frac{1+z^{r}}{(1-z^{r})^2}.\nonumber \\ \end{aligned}$$
(5.10)

Hence, by (5.7), (5.9), and (5.10), we have

$$\begin{aligned} (1+z^{r})\sum _{n=0}^{\infty } \rho _{n}^{*} z^{n} = (1-z^{r})^2 \sum _{n=0}^{\infty } \rho _{n} z^{n}. \end{aligned}$$
(5.11)

By comparing the coefficients, we have

$$\begin{aligned} {\left\{ \begin{array}{ll} \rho _{n}^{*} = \rho _{n} &{} \text { for }\, 0 \le n \le r-1, \\ \rho _{n}^{*} + \rho _{n-r}^{*} = \rho _{n}-2\rho _{n-r} &{} \text { for }\, r \le n \le 2r-1, \\ \rho _{n}^{*} + \rho _{n-r}^{*} = \rho _{n} - 2\rho _{n-r} + \rho _{n-2r} &{} \text { for } \,2r \le n. \end{array}\right. } \end{aligned}$$
(5.12)

From (5.12), we can obtain that \(\rho _{n}^{*} = \rho _{n}\) for \(0 \le n \le r-1\), \(\rho _{n}^{*} = \rho _{n}-3\rho _{n-r}\) for \(r \le n \le 2r-1\) and \(\rho ^{*}_{n} = \rho _{n}-3\rho _{n-r} + 4 \sum _{l=2}^{m} (-1)^{l} \rho _{n-lr}\) for \(mr \le n < (m+1)r-1\) with \(m\ge 2\). We can also see that the \(\rho _{n}^{*}\)’s are independent of P and depends only on r. \(\square \)

5.2 Odd characteristic case

In this section, we give a proof of Theorem 2.6. In Sect. 5.2.1, we obtain several results of the contribution of squares and of non-squares, which will be used to calculate the second moment of L-functions at \(s=\frac{1}{2}\) in Sects. 5.2.2 and 5.2.3.

5.2.1 Preparations for the proof

We first consider the contribution of squares.

Proposition 5.4

Let \(h \in \{2g, 2g-1\}\). We have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}}d(f) \chi _{P}(f) = \frac{1}{48 \zeta _{\mathbb {A}}(2)} |P| (\log _{q}|P|)^2 + O\big (|P|(\log _{q}|P|)\big ), \end{aligned}$$
    (5.13)
  2. 2.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}} d(f) \chi _{P}(f) = O\big (|P|(\log _{q}|P|)\big ), \end{aligned}$$
    (5.14)
  3. 3.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} (h+1-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}}d(f) \chi _{P}(f) = O\big (|P|(\log _{q}|P|)\big ). \end{aligned}$$
    (5.15)

Proof

  1. 1.

    By Theorem 1.3, we have

    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}}d(f) \chi _{P}(f) = \sum _{l=0}^{\big [\frac{h}{2}\big ]} q^{-l}\sum _{L\in \mathbb {A}_{l}^{+}} d(L^2) \sum _{P\in \mathbb P_{2g+2}} \chi _{P}(L^2) \nonumber \\&\quad = \frac{|P|}{\log _{q}|P|} \sum _{l=0}^{\big [\frac{h}{2}\big ]} q^{-l} \sum _{L\in \mathbb {A}_{l}^{+}}d(L^2) + O\left( |P|^{\frac{1}{2}}(\log _{q}|P|)^2\right) . \end{aligned}$$
    (5.16)

    By(5.2), we have

    $$\begin{aligned} \frac{|P|}{\log _{q}|P|} \sum _{l=0}^{\big [\frac{h}{2}\big ]} q^{-l} \sum _{L\in \mathbb {A}_{l}^{+}}d(L^2)&=\frac{|P|}{2\zeta _{\mathbb {A}}(2)\log _{q}|P|} \sum _{l=0}^{\big [\frac{h}{2}\big ]} l^2 + O(|P| (\log _{q}|P|)) \nonumber \\&= \frac{g^3 |P|}{6 \zeta _{\mathbb {A}}(2)\log _{q}|P|} + O(|P| (\log _{q}|P|)) \nonumber \\&= \frac{1}{48 \zeta _{\mathbb {A}}(2)} |P| (\log _{q}|P|)^2 + O(|P| (\log _{q}|P|)). \end{aligned}$$
    (5.17)

    Since \(|P|^{\frac{1}{2}}(\log _{q}|P|)^2 \ll |P| (\log _{q}|P|)\), by inserting (5.17) into (5.16), we obtain the desired result.

  2. 2.

    By Theorem 1.3 and (5.2), we have

    $$\begin{aligned} q^{-\left( h+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}}d(f) \chi _{P}(f)&= q^{-\left( h+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{l=0}^{\big [\frac{h}{2}\big ]} \sum _{L\in \mathbb {A}_{l}^{+}} \chi _{P}(L^2) d(L^2) \nonumber \\&\ll q^{-\left( h+\frac{1}{2}\right) } \frac{|P|}{\log _{q}|P|} \sum _{l=0}^{g} l^2 q^{l} \ll |P|(\log _{q}|P|). \end{aligned}$$
    (5.18)

    Similarly, we can prove (3). \(\square \)

Now, We consider the contribution of non-squares.

Proposition 5.5

Let \(h \in \{2g, 2g-1\}\). We have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f \ne \square \end{array}}d(f) \chi _{P}(f) = O(|P| (\log _{q}|P|)), \end{aligned}$$
    (5.19)
  2. 2.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f \ne \square \end{array}}d(f) \chi _{P}(f) = O(|P| (\log _{q}|P|)), \end{aligned}$$
    (5.20)
  3. 3.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} (h+1-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f \ne \square \end{array}}d(f) \chi _{P}(f) = O(|P| (\log _{q}|P|)). \end{aligned}$$
    (5.21)

Proof

(1) By Proposition 2.1 and (5.1), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f \ne \square \end{array}}d(f) \chi _{P}(f)&\ll \sum _{n=0}^{h} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f \ne \square \end{array}}d(f) \left| \sum _{P\in \mathbb P_{2g+2}} \chi _{P}(f)\right| \end{aligned}$$
(5.22)
$$\begin{aligned}&\ll \frac{|P|^{\frac{1}{2}}}{\log _{q}|P|} \sum _{n=0}^{h} n^2 q^{\frac{n}{2}} \ll |P| (\log _{q}|P|). \end{aligned}$$
(5.23)

Similarly, we can prove (2) and (3). \(\square \)

5.2.2 Proof of Theorem 2.6 (1)

By Lemma 3.2 (2), we can write

$$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L\left( \tfrac{1}{2},\chi _{P}\right) ^{2}\nonumber \\&\quad = \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f) + \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g-1} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f) \nonumber \\&\qquad - q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f)- q^{-g} \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g-1} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f) \nonumber \\&\qquad - \zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) ^{-1} q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g} (2g+1-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f) \nonumber \\&\qquad - \zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) ^{-1} q^{-g} \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g-1} (2g-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f). \end{aligned}$$
(5.24)

In the right-hand side of (5.24), we can write \(\sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f)\) as

$$\begin{aligned} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f) = \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f=\square \end{array}} d(f) \chi _{P}(f) + \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f\ne \square \end{array}} d(f) \chi _{P}(f). \end{aligned}$$
(5.25)

Then, by Propositions 5.4 and 5.5, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L\left( \tfrac{1}{2},\chi _{P}\right) ^{2} = \frac{1}{24 \zeta _{\mathbb {A}}(2)} |P| (\log _{q}|P|)^2 + O(|P| (\log _{q}|P|)). \end{aligned}$$
(5.26)

This completes the proof of Theorem 2.6 (1). \(\square \)

5.2.3 Proof of Theorem 2.6 (2)

For any \(f\in \mathbb {A}^{+}\), we have \(\chi _{\gamma P}(f) = (-1)^{\deg (f)} \chi _{P}(f)\). By Lemma 3.2 (3), we have

$$\begin{aligned}&\sum _{P\in \mathbb P_{2g+2}} L\left( \tfrac{1}{2},\chi _{\gamma P}\right) ^{2} \nonumber \\&\quad = \sum _{P\in \mathbb P_{2g+2}}\sum _{n=0}^{2g} (-1)^{n} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f)+ \sum _{P\in \mathbb P_{2g+2}}\sum _{n=0}^{2g-1} (-1)^{n} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f)\nonumber \\&\qquad + q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}}\sum _{n=0}^{2g} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f)+ q^{-g} \sum _{P\in \mathbb P_{2g+2}}\sum _{n=0}^{2g-1} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f)\nonumber \\&\qquad + \frac{\zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) }{\zeta _{\mathbb {A}}(2)} q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g} (2g+1-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f)\nonumber \\&\qquad + \frac{\zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) }{\zeta _{\mathbb {A}}(2)} q^{-g}\sum _{P\in \mathbb P_{2g+2}} \sum _{n=0}^{2g-1} (2g-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{P}(f). \end{aligned}$$
(5.27)

Then, by Propositions (5.4) and (5.5), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{2g+2}} L\left( \tfrac{1}{2},\chi _{\gamma P}\right) ^{2} = \frac{1}{24 \zeta _{\mathbb {A}}(2)} |P| (\log _{q}|P|)^2 + O(|P| (\log _{q}|P|)). \end{aligned}$$
(5.28)

This completes the proof of Theorem 2.6 (2). \(\square \)

5.3 Even characteristic case

In this section, we give a proof of Theorem 2.15. In Sect. 5.3.1, we obtain several results of the contribution of squares and of non-squares, which will be used to calculate the second moment of L-functions at \(s=\frac{1}{2}\) in Sects. 5.3.2, 5.3.3, and 5.3.4.

5.3.1 Preparations for the proof

Proposition 5.6

Let \(h\in \{2g-1, 2g\}\). We have

$$\begin{aligned} \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{n=0}^{h} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f=\square \end{array}} d(f) \chi _{u}(f) = \frac{1}{3 \zeta _{\mathbb {A}}(2)} g^2 q^{2g+1} + O\left( g q^{2g}\right) . \end{aligned}$$
(5.29)

Proof

We only prove the case \(h=2g\). By similar method, we can prove the case \(h=2g-1\). By Lemma 5.3, we have

$$\begin{aligned} \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{n=0}^{2g} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f=\square \end{array}} d(f) \chi _{u}(f)&= \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=0}^{g} q^{-l} \sum _{L\in \mathbb {A}_{l}^{+}} d(L^{2}) \chi _{u}(L^2) \nonumber \\&= \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=0}^{g} q^{-l} \rho _{l}^{*}(r). \end{aligned}$$
(5.30)

By Lemma 5.3 again, we have

$$\begin{aligned} \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=0}^{g} q^{-l} \rho _{l}^{*}(r)&= \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=0}^{g} q^{-l} \rho _{l} -3 \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=r}^{g} q^{-l} \rho _{l-r} \nonumber \\& + 4 \sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{m=2}^{[\frac{g}{r}]}(-1)^{m}\sum _{l=mr}^{g} q^{-l} \rho _{l-mr}. \end{aligned}$$
(5.31)

From (5.4), we have \(q^{-n}\rho _{n} = 1+\tfrac{1}{2} (3+q^{-1}) n +\tfrac{1}{2} (1-q^{-1}) n^2\). Hence, we have

$$\begin{aligned}&\sum _{l=0}^{g} q^{-l} \rho _{l} = \tfrac{1}{6} (1-q^{-1}) g^3 + O(g^2), \end{aligned}$$
(5.32)
$$\begin{aligned}&\sum _{l=r}^{g} q^{-l} \rho _{l-r} = q^{-r} \sum _{k=0}^{g-r} q^{-k} \rho _{k} \ll q^{-r} g^3, \end{aligned}$$
(5.33)
$$\begin{aligned}&\sum _{m=2}^{[\frac{g}{r}]}(-1)^{m}\sum _{l=mr}^{g} q^{-l} \rho _{l-mr} = \sum _{m=2}^{[\frac{g}{r}]}(-1)^{m} q^{-mr} \sum _{k=0}^{g-mr} q^{-k} \rho _{k} \ll g^3 \sum _{m=2}^{[\frac{g}{r}]} q^{-mr} \ll \frac{g^4}{r} q^{-2r}. \end{aligned}$$
(5.34)

Then, using (4.48) and the fact that \(\#\mathcal H_{(r,g+1-r)} \le q^{g+1} \frac{q^{r}}{r}\), we have

$$\begin{aligned}&\sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=0}^{g} q^{-l} \rho _{l} = \frac{1}{3} (1-q^{-1}) g^2 q^{2g+1} + O\left( g q^{2g}\right) , \end{aligned}$$
(5.35)
$$\begin{aligned}&\sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{l=r}^{g} q^{-l} \rho _{l-r} \ll g^3 q^{g} \sum _{r=1}^{g} \frac{1}{r} \ll (\log g) g^3 q^{g} \ll g q^{2g}, \quad \end{aligned}$$
(5.36)
$$\begin{aligned}&\sum _{r=1}^{g} \sum _{u\in \mathcal H_{(r,g+1-r)}} \sum _{m=2}^{[\frac{g}{r}]}(-1)^{m}\sum _{l=mr}^{g} q^{-l} \rho _{l-mr} \ll g^4 q^{g} \sum _{r=1}^{g} \frac{q^{-r}}{r^2} \ll g^5 q^g \ll g q^{2g}. \end{aligned}$$
(5.37)

By inserting (5.35), (5.36), and (5.37) into (5.31), we get the result. \(\square \)

Proposition 5.7

Let \(h\in \{2g-1, 2g\}\). We have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}}\sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}}d(f) \chi _{u}(f) \nonumber \\&\quad = \frac{1}{6\zeta _{\mathbb {A}}(2)} |P|^{2} (\log _{q}|P|)^2 + O(|P|^{2} (\log _{q}|P|)), \end{aligned}$$
    (5.38)
  2. 2.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}}d(f) \chi _{u}(f) = O(|P|^{2} (\log _{q}|P|)), \end{aligned}$$
    (5.39)
  3. 3.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{h} (h+1-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}}d(f) \chi _{u}(f) = O(|P|^{2} (\log _{q}|P|)). \end{aligned}$$
    (5.40)

Proof

  1. 1.

    By (4.47), we have

    $$\begin{aligned} &\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}}\sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f=\square \end{array}}d(f) \chi _{u}(f) = \sum _{l=0}^{\big [\frac{h}{2}\big ]} q^{-l}\sum _{L\in \mathbb {A}_{l}^{+}} d(L^2) \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\chi _{u}(L^2) \nonumber \\ &\quad = \frac{|P|^{2}}{\log _{q}|P|} \sum _{l=0}^{\big [\frac{h}{2}\big ]} q^{-l} \sum _{L\in \mathbb {A}_{l}^{+}}d(L^2) + O(|P|^{\frac{3}{2}} (\log _{q}|P|)^2). \end{aligned}$$
    (5.41)

    By (5.2), we have

    $$\begin{aligned} \frac{|P|^{2}}{\log _{q}|P|} \sum _{l=0}^{\big [\frac{h}{2}\big ]} q^{-l} \sum _{L\in \mathbb {A}_{l}^{+}}d(L^2)&= \frac{1}{2\zeta _{\mathbb {A}}(2)} \frac{|P|^{2}}{\log _{q}|P|} \sum _{l=0}^{\big [\frac{h}{2}\big ]} l^2 + O\left( |P|^{2} (\log _{q}|P|)\right) \nonumber \\&= \frac{1}{6\zeta _{\mathbb {A}}(2)} |P|^{2} (\log _{q}|P|)^2 + O(|P|^{2} (\log _{q}|P|)). \end{aligned}$$
    (5.42)

    Since \(|P|^{\frac{3}{2}} (\log _{q}|P|)^2 \ll |P|^{2} (\log _{q}|P|)\), by inserting (5.42) into (5.41), we get the result.

  2. 2.

    By (4.47) and (5.2), we have

    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f =\square \end{array}}d(f) \chi _{u}(f)\nonumber \\&\quad = q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{l=0}^{\big [\frac{h}{2}\big ]} \sum _{L\in \mathbb {A}_{l}^{+}} d(L^2) \chi _{u}(L^2) \nonumber \\&\quad \ll q^{-\left( \frac{h+1}{2}\right) } \frac{|P|^{2}}{\log _{q}|P|} \sum _{l=0}^{\big [\frac{h}{2}\big ]} l^2 q^{l} \ll |P|^{2} (\log _{q}|P|). \end{aligned}$$
    (5.43)

    Similarly, we can prove (3). \(\square \)

Now, we consider the contribution of non-squares.

Proposition 5.8

Let \(h\in \{2g-1, 2g\}\). We have

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{h} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f\ne \square \end{array}} d(f) \chi _{u}(f) = O\left( (\log g) g q^{2g}\right) . \end{aligned}$$
(5.44)

Proof

We only prove the case \(h=2g\). Similarly, we can prove the case \(h=2g-1\). By Lemma 4.6 and (5.1), we have

$$\begin{aligned}&\sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{2g} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f\ne \square \end{array}} d(f) \chi _{u}(f) \ll \sum _{n=0}^{2g} q^{-\frac{n}{2}} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+} \\ f \ne \square \end{array}} d(f) \left| \sum _{u\in \mathcal H_{g+1}} \chi _{u}(f)\right| \end{aligned}$$
(5.45)
$$\begin{aligned}&\ll (\log g) q^{g} \sum _{n=0}^{2g} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \ll (\log g) q^{g} \sum _{n=0}^{2g} n q^{\frac{n}{2}} \ll (\log g) g q^{2g}. \end{aligned}$$
(5.46)

\(\square \)

Proposition 5.9

Let \(h\in \{2g-1, 2g\}\). We have

  1. 1.
    $$\begin{aligned}&\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}}\sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}}d(f) \chi _{u}(f) = O\left( |P|^{2}\right) , \end{aligned}$$
    (5.47)
  2. 2.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{h} \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f \ne \square \end{array}}d(f) \chi _{u}(f) = O\left( |P|^{2}\right) , \end{aligned}$$
    (5.48)
  3. 3.
    $$\begin{aligned}&q^{-\left( \frac{h+1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{h} (h+1-n) \sum _{\begin{array}{c} f\in \mathbb {A}_{n}^{+}\\ f \ne \square \end{array}}d(f) \chi _{u}(f) = O\left( |P|^{2}\right) . \end{aligned}$$
    (5.49)

Proof

(1) By Lemma 4.4 and (5.1), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{h} (\pm 1)^{n} q^{-\frac{n}{2}}\sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}}d(f) \chi _{u}(f)&\ll \sum _{n=0}^{h} q^{-\frac{n}{2}}\sum _{\begin{array}{c} f\in \mathbb {A}_{n}^+\\ f\ne \square \end{array}}d(f) \left| \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \chi _{u}(f)\right| \quad \end{aligned}$$
(5.50)
$$\begin{aligned}&\ll \frac{|P|}{\log _{q}|P|} \sum _{n=0}^{h} n q^{\frac{n}{2}} \ll |P|^{2}. \end{aligned}$$
(5.51)

Similarly, we can prove (2) and (3). \(\square \)

5.3.2 Proof of Theorem 2.15 (1)

By Lemma 3.2 (1), we have

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2}&= \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{2g} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) + \sum _{u\in \mathcal H_{g+1}} \sum _{n=0}^{2g-1} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f). \end{aligned}$$
(5.52)

Then, by Propositions 5.6 and 5.8, we have

$$\begin{aligned} \sum _{u\in \mathcal H_{g+1}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2} = \frac{2}{3 \zeta _{\mathbb {A}}(2)} g^2 q^{2g+1} + O\left( (\log g) g q^{2g}\right) . \end{aligned}$$
(5.53)

This completes the proof of Theorem 2.15 (1). \(\square \)

5.3.3 Proof of Theorem 2.15 (2)

By Lemma 3.2 (2), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2} =&\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{2g} q^{-\frac{n}{2}}\sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&+ \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{2g-1} q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&- q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{2g} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&- q^{-g} \sum _{n=0}^{2g-1} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&- \zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) ^{-1} q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{2g} (2g+1-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&- \zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) ^{-1} q^{-g}\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{2g-1} (2g-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f).\nonumber \\ \end{aligned}$$
(5.54)

Then, by Propositions 5.7 and 5.9, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2} = \frac{1}{3\zeta _{\mathbb {A}}(2)} |P|^{2} (\log _{q}|P|)^2 + O\left( |P|^{2} (\log _{q}|P|)\right) . \end{aligned}$$
(5.55)

This completes the proof of Theorem 2.15 (2). \(\square \)

5.3.4 Proof of Theorem 2.15 (3)

For any \(u = v+\xi \in \mathcal F'_{g+1}\) with \(v\in \mathcal F_{g+1}\), we have \(\chi _{u}(f) = (-1)^{\deg (f)} \chi _{v}(f)\). Then, by Lemma 3.2 (3), we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F'_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2}&= \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{2g} (-1)^n q^{-\frac{n}{2}}\sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&\quad + \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{2g-1} (-1)^n q^{-\frac{n}{2}} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&\quad + q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{2g} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&\quad + q^{-g} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}}\sum _{n=0}^{2g-1} \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&\quad + \frac{\zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) }{\zeta _{\mathbb {A}}(2)} q^{-\left( g+\frac{1}{2}\right) } \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{2g} (2g+1-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f) \nonumber \\&\quad + \frac{\zeta _{\mathbb {A}}\left( \tfrac{3}{2}\right) }{\zeta _{\mathbb {A}}(2)} q^{-g}\sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F_{P}} \sum _{n=0}^{2g-1} (2g-n) \sum _{f\in \mathbb {A}_{n}^{+}} d(f) \chi _{u}(f). \end{aligned}$$
(5.56)

By Propositions 5.7 and 5.9, we have

$$\begin{aligned} \sum _{P\in \mathbb P_{g+1}}\sum _{u\in \mathcal F'_{P}} L\left( \tfrac{1}{2},\chi _{u}\right) ^{2} = \frac{1}{3\zeta _{\mathbb {A}}(2)} |P|^{2} (\log _{q}|P|)^2 + O\left( |P|^{2} (\log _{q}|P|)\right) . \end{aligned}$$
(5.57)

This completes the proof of Theorem 2.15 (3). \(\square \)