1 Introduction

Throughout this paper, let p be an odd prime and let \(q=p^m\) for some positive integer m. An \([n,\, k,\,d]\) code \({C}\) over \({\mathrm {GF}}(p)\) is a k-dimensional subspace of \({\mathrm {GF}}(p)^n\) with minimum (Hamming) distance d. Let \(A_i\) denote the number of codewords with Hamming weight i in a code \({C}\) of length n. The weight enumerator of \({C}\) is defined by \( 1+A_1z+A_2z^2+ \cdots + A_nz^n. \) The weight distribution \((1,A_1,\ldots ,A_n)\) is an important research topic in coding theory, as it contains crucial information as to estimate the error correcting capability and the probability of error detection and correction with respect to some algorithms. A code \({C}\) is said to be a t-weight code if the number of nonzero \(A_i\) in the sequence \((A_1, A_2, \ldots , A_n)\) is equal to t.

The weight distribution gives the minimum distance of the code, and hence the error correcting capability. Furthermore, the weight distribution of a code allows the computation of the error probability of error detection and correction with respect to some error detection and error correction algorithms (see [14] for details). Thus the study of the weight distribution attracts much attention in coding theory and much work focuses on the determination of the weight distributions of linear codes (see [47, 9, 11] and the references therein). Linear codes can be applied in consumer electronics, communication and data storage system. Linear codes with few weights are of important in secret sharing [3], authentication codes [8, 10], association schemes [1] and strongly regular graphs [2].

Let \({\mathrm {Tr}}\) denote the trace function from \({\mathrm {GF}}(q)\) onto \({\mathrm {GF}}(p)\) throughout this paper. Let \(F(x)\in {\mathrm {GF}}(q)[x]\), \(D=\{x\in {\mathrm {GF}}(q)^*: {\mathrm {Tr}}(F(x))=0\}=\{d_1, \,d_2, \,\ldots , \,d_n\} \subseteq {\mathrm {GF}}(q)\) and \(n=\#D\). We define a linear code of length n over \({\mathrm {GF}}(p)\) by

$$\begin{aligned} {C}_{D}=\{({\mathrm {Tr}}(xd_1), {\mathrm {Tr}}(xd_2), \ldots , {\mathrm {Tr}}(xd_n)): x \in {\mathrm {GF}}(q)\}, \end{aligned}$$
(1)

and call D the defining set of this code \({C}_{D}\). By definition, the dimension of the code \({C}_D\) is at most m.

This construction is generic in the sense that many classes of known codes could be produced by properly selecting the defining set \(D \subseteq {\mathrm {GF}}(q)\). If the defining set D is well chosen, some optimal linear codes with few weights can be obtained. Based on this construction, many linear codes have been constructed since Ding et al. published their paper in 2014 [6]. We refer interested readers to [4, 5, 7, 1720, 22] and the references therein. Particularly, Ding et al. [7] presented the weight distribution of \(C_D\) for the case \(F(x)= x^2\) and proposed an open problem on how to determine the weight distribution of \(C_{D}\) for general planar functions F(x). Subsequently, Zhou et al. [22] and Tang et al. [19] solved this open problem and gave the weight distribution of \(C_D\) from homogeneous quadratic bent functions and weakly regular bent functions with some homogeneous conditions, respectively.

In this paper, we consider linear codes with few weights from inhomogeneous quadratic functions \({\mathrm {Tr}}(F(x))=f(x)-{\mathrm {Tr}}(\alpha x)\) and determine the weight distributions of these linear codes , where \(\alpha \in {\mathrm {GF}}(q)^*\), f(x) is a homogeneous quadratic function from \({\mathrm {GF}}(q)\) onto \({\mathrm {GF}}(p)\) and defined by

$$\begin{aligned} f(x)=\sum _{i=0}^{m-1}{\mathrm {Tr}}(a_i x^{p^i+1})~~~(a_i\in {\mathrm {GF}}(q)). \end{aligned}$$
(2)

They include some earlier linear codes as special cases [16, 21].

The rest of this paper is organized as follows. Section 2 introduces some basic notations and results of group characters, Gauss sums, cyclotomic fields and quadratic forms which will be needed in subsequent sections. Section 3 constructs linear codes with a few weights from inhomogeneous quadratic functions and settles the weight distributions of these linear codes. Section 4 summarizes this paper.

2 Preliminaries

In this section, we state some notations and basic facts on group characters, Gauss sums, cyclotomic fields and quadratic forms. These results will be used in the rest of the paper.

2.1 Some notations fixed throughout this paper

For convenience, we adopt the following notations unless otherwise stated in this paper.

  • \(p^*=(-1)^{(p-1)/2}p\).

  • \(\zeta _p=e^{\frac{2\pi \sqrt{-1}}{p}}\) is the primitive p-th root of unity.

  • \(SQ \) and \(NSQ \) denote the set of all squares and nonsquares in \({\mathrm {GF}}(p)^{*}\), respectively.

  • \(\upeta \) and \(\bar{\upeta }\) are the quadratic characters of \({\mathrm {GF}}(q)^{*}\) and \({\mathrm {GF}}(p)^{*}\), repsectively. We extend these quadratic characters by letting \(\upeta (0)=0\) and \(\bar{\upeta }(0)=0\).

2.2 Group characters and Gauss sums

An additive character of \({\mathrm {GF}}(q)\) is a nonzero function \(\chi \) from \({\mathrm {GF}}(q)\) to the set of nonzero complex numbers such that \(\chi (x+y)=\chi (x) \chi (y)\) for any pair \((x, y) \in {\mathrm {GF}}(q)^2\). For each \(b\in {\mathrm {GF}}(q)\), the function

$$\begin{aligned} \chi _b(c)=\zeta _p^{{\mathrm {Tr}}(bc)} \ \ \hbox { for all } c\in {\mathrm {GF}}(q) \end{aligned}$$
(3)

defines an additive character of \({\mathrm {GF}}(q)\). When \(b=0\), \(\chi _0(c)=1 \hbox { for all } c\in {\mathrm {GF}}(q), \) and is called the trivial additive character of \({\mathrm {GF}}(q)\). The character \(\chi _1\) in (3) is called the canonical additive character of \({\mathrm {GF}}(q)\). It is well known that every additive character of \({\mathrm {GF}}(q)\) can be written as \(\chi _b(x)=\chi _1(bx)\) [15, Theorem 5.7].

The Gauss sum \(G(\upeta , \chi _1)\) over \({\mathrm {GF}}(q)\) is defined by

$$\begin{aligned} G(\upeta , \chi _1)=\sum _{c \in {\mathrm {GF}}(q)^*} \upeta (c) \chi _1(c) = \sum _{c \in {\mathrm {GF}}(q)} \upeta (c) \chi _1(c) \end{aligned}$$
(4)

and the Gauss sum \(G(\bar{\upeta }, \bar{\chi }_1)\) over \({\mathrm {GF}}(p)\) is defined by

$$\begin{aligned} G(\bar{\upeta }, \bar{\chi }_1)=\sum _{c \in {\mathrm {GF}}(p)^*} \bar{\upeta }(c) \bar{\chi }_1(c) = \sum _{c \in {\mathrm {GF}}(p)} \bar{\upeta }(c) \bar{\chi }_1(c), \end{aligned}$$
(5)

where \(\bar{\chi }_1\) is the canonical additive characters of \({\mathrm {GF}}(p)\).

The following three lemmas are proved in [15, Theorems 5.15 and 5.33] and [7, Lemma 7], respectively.

Lemma 1

With the symbols and notations above, we have

$$\begin{aligned} G(\upeta , \chi _1)=(-1)^{m-1} \sqrt{-1}^{(\frac{p-1}{2})^2 m} \sqrt{q} \end{aligned}$$

and

$$\begin{aligned} G(\bar{\upeta }, \bar{\chi }_1)= \sqrt{-1}^{(\frac{p-1}{2})^2 } \sqrt{p}=\sqrt{p*}. \end{aligned}$$

Lemma 2

Let \(\chi \) be a nontrivial additive character of \({\mathrm {GF}}(q)\) with q odd, and let \(f(x)=a_2x^2+a_1x+a_0 \in {\mathrm {GF}}(q)[x]\) with \(a_2 \ne 0\). Then

$$\begin{aligned} \sum _{c \in {\mathrm {GF}}(q)} \chi (f(c)) = \chi (a_0-a_1^2(4a_2)^{-1}) \upeta (a_2) G(\upeta , \chi ). \end{aligned}$$

2.3 Cyclotomic fields

In this subsection, we state some basic facts on cyclotomic fields. These results will be used in the rest of this paper.

Let \(\mathbb {Z}\) be the rational integer ring and Q be the rational field. Some results on cyclotomic field \(Q(\zeta _p)\) [13] are given in the following lemma.

Lemma 3

We have the following basic facts.

  1. (1)

    The ring of integers in \(K=Q(\zeta _p)\) is \(O_K= \mathbb {Z}(\zeta _p)\) and \(\{ \zeta _p^{~i}: 1\le i\le p-1\}\) is an integral basis of \(O_K\).

  2. (2)

    The field extension K / Q is Galois of degree \(p-1\) and the Galois group \(Gal(K/Q)=\{\sigma _a: a\in (\mathbb {Z}/p\mathbb {Z})^{*}\}\), where the automorphism \(\sigma _a\) of K is defined by \(\sigma _a(\zeta _p)=\zeta _p^a\).

  3. (3)

    The field K has a unique quadratic subfield \(L=Q(\sqrt{p^*})\). For \(1\le a\le p-1\), \(\sigma _a(\sqrt{p^*}) = \bar{\upeta }(a)\sqrt{p^*}\). Therefore, the Galois group Gal(L / Q) is \(\{1,\sigma _{\gamma }\}\), where \(\gamma \) is any quadratic nonresidue in \({\mathrm {GF}}(p)\).

From Lemma 3, the conclusion of the following lemma is straightforward and we omit their proofs.

Lemma 4

With the symbols and notations above, we have the following.

  1. (I)

    \( \sum _{y \in {\mathrm {GF}}(p)^*}\sigma _y((p^*)^{-\frac{r}{2}}) = \left\{ \begin{array}{ll} 0 &{} \hbox {if r is odd}, \\ (p^*)^{-\frac{r}{2}}(p-1) &{} \textit{if r is even}. \end{array} \right. \)

  2. (II)

    For any \(z\in {\mathrm {GF}}(p)^*\), then

    $$\begin{aligned} \sum _{y \in {\mathrm {GF}}(p)^*}\sigma _y((p^*)^{-\frac{r}{2}}~\zeta _p^{~z})= & {} \left\{ \begin{array}{ll} \bar{\upeta }(z)(p^*)^{-\frac{r-1}{2}} &{} \hbox {if r is odd,}\\ -(p^*)^{-\frac{r}{2}} &{} \hbox {if r is even}. \end{array} \right. \end{aligned}$$

2.4 Quadratic forms

The field \({\mathrm {GF}}(q)\) is a vector space over \({\mathrm {GF}}(p)\) with dimension m. We fix a basis \(v_0, v_1,\ldots , v_{m-1}\) of \({\mathrm {GF}}(q)\) over \({\mathrm {GF}}(p)\). Then each \(x\in {\mathrm {GF}}(q)\) can be uniquely expressed as

$$\begin{aligned} x=x_0v_0+x_1v_1+\cdots +x_{m-1}v_{m-1}~~~(x_i\in {\mathrm {GF}}(p)). \end{aligned}$$

Thus we have the following \({\mathrm {GF}}(p)\)-linear isomorphism \({\mathrm {GF}}(q)\xrightarrow {\thicksim }{\mathrm {GF}}(p)^m\):

$$\begin{aligned} x=x_0v_0+x_1v_1+\cdots +x_{m-1}v_{m-1} \mapsto X=(x_0,x_1,\ldots ,x_{m-1}). \end{aligned}$$

With this isomorphism, a function \(f:{\mathrm {GF}}(q) \rightarrow {\mathrm {GF}}(p)\) induces a function \(F:{\mathrm {GF}}(p)^m \rightarrow {\mathrm {GF}}(p)\) where for all \(X=(x_0,x_1,\ldots ,x_{m-1})\in {\mathrm {GF}}(p)^m\), \(F(X) = f (x)\) where \(x=x_0v_0+x_1v_1+\cdots +x_{m-1}v_{m-1}\). In this way, the function f defined in (2) induces a quadratic form

$$\begin{aligned} F(X)= & {} \sum _{i=0}^{m-1}{\mathrm {Tr}}\left( a_i\left( \sum _{j=0}^{m-1}x_jv_j\right) ^{p^i+1}\right) \nonumber \\= & {} \sum _{i=0}^{m-1}{\mathrm {Tr}}\left( a_i\left( \sum _{j=0}^{m-1}x_jv_j^{p^i}\right) \left( \sum _{k=0}^{m-1}x_kv_k\right) \right) \nonumber \\= & {} \sum _{j=0}^{m-1}\sum _{k=0}^{m-1}\left( \sum _{i=0}^{m-1}{\mathrm {Tr}}\left( a_iv_j^{p^i}v_k\right) \right) x_jx_k \nonumber \\= & {} XHX^{T}, \end{aligned}$$
(6)

where \(X^{T}\) is the transposition of X, \(H=(h_{j,k})\),

$$\begin{aligned} h_{j,k}=\frac{1}{2}\sum _{i=0}^{m-1}\left( {\mathrm {Tr}}\left( a_i\left( v_j^{p^i}v_k+v_jv_k^{p^i}\right) \right) \right) ~~\mathrm {~for~} 0\le j,k\le m-1, \end{aligned}$$

and the rank of H is called the rank of the function f defined in (2). We denote the rank of f by \(r_f\). Particularly, \(r_f=m\) if and only if f is a bent function.

Since H defined in (6) is an \(m \times m\) symmetric matrix over \({\mathrm {GF}}(p)\) and \(r_f = {\mathrm {rank}}~H\), there exists \(M\in {\mathrm {GL}}_m({\mathrm {GF}}(p))\) such that \(H'=MHM^{T}\) is a diagonal matrix and

$$\begin{aligned} H'= diag(\lambda _1,\ldots , \lambda _{r_f}, 0, \ldots , 0) \end{aligned}$$

where \(\lambda _i\in {\mathrm {GF}}(p)^*\)(\(1\le i\le r_f\)). Let \(\Delta =\lambda _1,\ldots ,\lambda _{r_f}\). Then the value of \(\bar{\upeta }(\Delta )\) is an invariant of H under the action of \(H\mapsto MHM^{T}\) where \(M\in {\mathrm {GL}}_m({\mathrm {GF}}(p))\). We call \(\bar{\upeta }(\Delta )\) the sign of the quadratic function f of (2) and is defined by \(\varepsilon _f\).

It is clear that the value of \(r_f\) is closely related to the value of \(\#Z_f\), where the set

$$\begin{aligned} Z_f~=\{x\in {\mathrm {GF}}(q):f(x+y)=f(x)+f(y),\forall y\in {\mathrm {GF}}(q)\}. \end{aligned}$$

It is well known that \(\#Z_f=p^{m-r_f}\). Note that from Eq. (2) we have

$$\begin{aligned} f(x+y)=f(x)+f(y)+2{\mathrm {Tr}}(L_f(x)y)=f(x)+f(y)+2{\mathrm {Tr}}(xL_f(y)), \end{aligned}$$
(7)

where \(L_f\) is a linearized polynominal over \({\mathrm {GF}}(q)\) defined by

$$\begin{aligned} L_f(x)=\frac{1}{2}\sum _{i=0}^{m-1}\left( a_i+a_{m-i}^{p^i}\right) x^{p^i}. \end{aligned}$$

From now on we define \(Im (L_f)=\{L_f(x):x\in {\mathrm {GF}}(q)\}\) and \(Ker (L_f)=\{x\in {\mathrm {GF}}(q): L_f(x)=0\}.\) If \(b\in Im (L_f)\), we denote \(x_b\in {\mathrm {GF}}(q)\) with satisfying \(L_f(x_b)=-\frac{b}{2}\).

From Eq. (7), we have

$$\begin{aligned} \hbox {ker}(L_f)=\{x\in {\mathrm {GF}}(q): f(x+y)=f(x)+f(y)~~\hbox {for all } y\in {\mathrm {GF}}(q)\}. \end{aligned}$$

Thus \(p^{m-r_f}=\# Z_f=\#{\mathrm {Ker}}(L_f)\), that is, \({\mathrm {rank~}} L_f=r_f\). It is obvious that \(0\le r_f\le m\).

3 Linear codes from inhomogeneous quadratic functions

We construct linear codes over \({\mathrm {GF}}(p)\) by using inhomogeneous quadratic functions and determine their parameters in this section.

In this paper, the defining set D of the code \({C}_D\) of (1) is given by

$$\begin{aligned} D=\{x \in {\mathrm {GF}}(q)^*: f(x)-{\mathrm {Tr}}(\alpha x)=0\}, \end{aligned}$$
(8)

where \(\alpha \in {\mathrm {GF}}(q)^*\) and f is defined in (2). It is clear that the function \(f(x)-{\mathrm {Tr}}(\alpha x)\) used in the defining set D is a inhomogeneous quadratic functions.

Before giving and proving the main results of this paper, we firstly prove a few more auxiliary results which will be needed in proving the main results.

3.1 Some auxiliary results

To prove our main results in this paper, we need the help of a number of lemmas that are described and proved in this subsection.

Lemma 5

Let the symbols and notations be as above. Let f be a homogeneous quadratic function and \(b\in {\mathrm {GF}}(q)\). Then

  1. (I)

    \(\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)}=\varepsilon _f p^m(p^*)^{-\frac{r_f}{2}}\) and

  2. (II)

    \(\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}(bx)} =\left\{ \begin{array}{ll} 0 &{} \hbox { if } b \not \in Im (L_f) \\ \varepsilon _f p^m(p^*)^{-\frac{r_f}{2}}\zeta _p^{-f(x_b)} &{} \hbox { if } b \in Im (L_f) \end{array} \right. \),

where \(x_b\) satisfies \(L_f(x_b)=-\frac{b}{2}\).

Proof

  1. (I)

    The desired conclusion (I) of this lemma then follows from [12, Lemma 1].

  2. (II)

    If \(b \not \in {\mathrm {Im}}(L_f)\), then we have

    $$\begin{aligned}&\left( \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{-f(x)}\right) \left( \sum _{y\in {\mathrm {GF}}(q)}\zeta _p^{f(y)-{\mathrm {Tr}}(by)} \right) \\&\quad =\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{-f(x)} \sum _{y\in {\mathrm {GF}}(q)}\zeta _p^{f(x+y)-{\mathrm {Tr}}(b(x+y))} \\&\quad = \sum _{x,y\in {\mathrm {GF}}(q)}\zeta _p^{f(x+y)-f(x)-{\mathrm {Tr}}(b(x+y))} \\&\quad =\sum _{x,y\in {\mathrm {GF}}(q)}\zeta _p^{f(y)+2{\mathrm {Tr}}(L_f(y)x)-{\mathrm {Tr}}(b(x+y))} ~~~~~~~~~~(\hbox {By Eq. 7}) \\&\quad = \sum _{y\in {\mathrm {GF}}(q)}\zeta _p^{f(y)-{\mathrm {Tr}}(by)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{{\mathrm {Tr}}((L_f(2y)-b)x)} \\&\quad = 0.\qquad (\hbox {Since } b \not \in {\mathrm {Im}}(L_f)) \end{aligned}$$

    From the conclusion (I) of this lemma, we have \(\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{-f(x)}\ne 0\). Therefore, \(\sum _{y\in {\mathrm {GF}}(q)}\zeta _p^{f(y)-{\mathrm {Tr}}(by)}=0\).

If \(b \in {\mathrm {Im}}(L_f)\), then there exists \(x_b\in {\mathrm {GF}}(q)\) such that \(L_f(x_b)=-\frac{b}{2}\). Thus, we have

$$\begin{aligned} \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}(bx)}= & {} \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)+2{\mathrm {Tr}}(L_f(x_b)x)} \\= & {} \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)+f(x_b)+2{\mathrm {Tr}}(L_f(x_b)x)-f(x_b)} \\= & {} \zeta _p^{-f(x_b)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x+x_b)} ~~~~~~~~~~(\hbox {By Eq. 7}) \\= & {} \zeta _p^{-f(x_b)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)} \\= & {} \varepsilon _f p^m(p^*)^{-\frac{r_f}{2}}\zeta _p^{-f(x_b)}. ~~~~~~~~~~~(\hbox {By the conclusion (I) of this lemma}) \end{aligned}$$

Summarizing all the conclusions above completes the proof of this lemma. \(\square \)

Lemma 6

Let \(a,b,c\in {\mathrm {GF}}(p)\) and

$$\begin{aligned} S=\sum _{z,w\in {\mathrm {GF}}(p)}\zeta _p^{az^2+2bzw+cw^2}. \end{aligned}$$

Then we have the following.

  1. (I)

    If \(ac-b^2\ne 0\), then \(S=\bar{\upeta }(ac-b^2)p^2(p^*)^{-1}\).

  2. (II)

    If \(ac-b^2= 0\) and \(a\ne 0\), then \(S=\bar{\upeta }(a)p\sqrt{p^*}\).

Proof

  1. (I)

    The desired conclusion (I) of this lemma then follows from [12, Lemma 1].

  2. (II)

    If \(ac-b^2= 0\) and \(a\ne 0\), then

$$\begin{aligned} S = \sum _{z,w\in {\mathrm {GF}}(p)}\zeta _p^{\frac{1}{a}(az+bw)^2} = \sum _{w\in {\mathrm {GF}}(p)}\sum _{z\in {\mathrm {GF}}(p)}\zeta _p^{\frac{1}{a}(az+bw)^2} = \sum _{w\in {\mathrm {GF}}(p)}\sum _{z\in {\mathrm {GF}}(p)}\zeta _p^{z^2} = \bar{\upeta }(a)p\sqrt{p^*}, \end{aligned}$$

where the last identity follows from Lemmas 1 and 2. This completes the proof of this lemma. \(\square \)

We require the following lemma which is the standard result on quadratic forms [15, Sect. 6.2].

Lemma 7

Let g be a homogeneous quadratic function from \({\mathrm {GF}}(q)\) onto \({\mathrm {GF}}(p)\) with the rank \(r_g\) and the sign \(\varepsilon _g\). For any \(t\in {\mathrm {GF}}(p)^*\), let

$$\begin{aligned} N(g=t)=\#\{x\in {\mathrm {GF}}(q):g(x)=t \}. \end{aligned}$$

Then

$$\begin{aligned} N(g=t)= \left\{ \begin{array}{ll} p^{m-1}-\varepsilon _g p^{m-1}(p^*)^{-\frac{r_g}{2}} &{} \hbox {if}\,r_g\,{is\,even},\\ p^{m-1}+\varepsilon _g \bar{\upeta }(-t)p^{m-1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox {if}\,r_g\,{is\,odd}. \end{array} \right. \end{aligned}$$

Lemma 8

Let f be a homogeneous quadratic function with the rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in Im (L_f)\) and \(x_\alpha \in {\mathrm {GF}}(q)\) with satisfying \(L_f(x_\alpha )=-\frac{\alpha }{2}\). Let \(f(x_\alpha )=0\) and

$$\begin{aligned} A=\#\{x\in {\mathrm {GF}}(q): f(x)=a ~and~ {\mathrm {Tr}}(\alpha x)=0\} \end{aligned}$$

for any \(a\in {\mathrm {GF}}(p)^*\). Then

$$\begin{aligned} A=p^{m-2}+\varepsilon _f \bar{\upeta }(-a)p^{m-1}(p^*)^{-\frac{r_f-1}{2}}. \end{aligned}$$

Proof

By definition, we have

$$\begin{aligned} A= & {} p^{-2} \sum _{x\in {\mathrm {GF}}(q)}\left( \sum _{y\in {\mathrm {GF}}(p)}\zeta _p^{y(f(x)-a)}\right) \left( \sum _{z\in {\mathrm {GF}}(p)}\zeta _p^{z{\mathrm {Tr}}(\alpha x)}\right) \\= & {} p^{-2} \sum _{x\in {\mathrm {GF}}(q)}\left( \sum _{z\in {\mathrm {GF}}(p)}\zeta _p^{z{\mathrm {Tr}}\left( \alpha x\right) }\right) +p^{-2} \sum _{y\in {\mathrm {GF}}(p)^*}\left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{y(f(x)-a)+z{\mathrm {Tr}}(\alpha x)}\right) \\= & {} p^{m-2} + p^{-2} \sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\left( \sum _{z\in {\mathrm {GF}}(p)}\zeta _p^{-a}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)+z{\mathrm {Tr}}(\alpha x)}\right) \\= & {} p^{m-2} + p^{-2} \sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\left( \zeta _p^{-a}\sum _{z\in {\mathrm {GF}}(p)} \zeta _p^{-f(x_\alpha )z^2}\varepsilon _fp^m(p^*)^{-\frac{r_f}{2}}\right) ~~~~~~~~~~(\hbox {By Lemma 5})\\= & {} p^{m-2} + p^{-2} \sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\left( \zeta _p^{-a}\varepsilon _fp^{m+1}(p^*)^{-\frac{r_f}{2}}\right) ~~~~~~~~~~~~~~~~~~~~~~~~~(\hbox {Since } f(x_\alpha )=0)\\= & {} p^{m-2} + p^{-2} \bar{\upeta }(-a)\varepsilon _fp^{m+1}(p^*)^{-\frac{r_f-1}{2}}) \\= & {} p^{m-2}+\varepsilon _f \bar{\upeta }(-a)p^{m-1}(p^*)^{-\frac{r_f-1}{2}}. \end{aligned}$$

This completes the proof. \(\square \)

Lemma 9

Let the symbols and notations be as above. Let f be a homogeneous quadratic function, \(\alpha \in {\mathrm {GF}}(q)\) and

$$\begin{aligned} N_f(\alpha )=\#\{x\in {\mathrm {GF}}(q):f(x)-{\mathrm {Tr}}(\alpha x)=0\}. \end{aligned}$$

Then we have the following.

  1. (I)

    If \(\alpha \not \in Im (L_f)\), then \(N_f(\alpha )=p^{m-1}\).

  2. (II)

    If \(\alpha \in Im (L_f)\), then

$$\begin{aligned} N_f(\alpha )= \left\{ \begin{array}{ll} p^{m-1}+\varepsilon _f (p-1)p^{m-1}(p^*)^{-\frac{r_f}{2}} &{} \hbox {if}\,r_f\,{is\,even\,and}\,f(x_\alpha )=0, \\ p^{m-1}-\varepsilon _f p^{m-1}(p^*)^{-\frac{r_f}{2}} &{} \hbox {if}\,r_f\,{is\,even\,and} f(x_\alpha )\ne 0, \\ p^{m-1} &{} \hbox {if}\,r_f\,{is\,odd\,and\,}\,f(x_\alpha )=0, \\ p^{m-1}+1+\varepsilon _f\bar{\upeta }(-f(x_\alpha )) p^{m-1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox {if}\,r_f\,{is\,odd\,and}\,f(x_\alpha )\ne 0, \end{array} \right. \end{aligned}$$

where \(x_\alpha \) satisfies \(L_f(x_\alpha )=-\frac{\alpha }{2}\), \(r_f\) is the rank of f and \(\varepsilon _f\) is the sign of f.

Proof

By definition, we have

$$\begin{aligned} N_f(\alpha )= & {} p^{-1} \sum _{x\in {\mathrm {GF}}(q)}\sum _{y\in {\mathrm {GF}}(p)}\zeta _p^{y(f(x)-{\mathrm {Tr}}(\alpha x))} \\= & {} p^{m-1}+p^{-1}\sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\left( \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}(\alpha x)} \right) . \end{aligned}$$

The desired conclusions then follow from Lemma 4 and the result (II) of Lemma 5. \(\square \)

Lemma 10

Let the symbols and notations be as above. Let f be a homogeneous quadratic function with the rank \(r_f\) and the sign \(\varepsilon _f\), \(\beta \in {\mathrm {GF}}(q)^*\) and

$$\begin{aligned} S_1= & {} \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{-z{\mathrm {Tr}}(\beta x)}, \\ S_2= & {} \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-z{\mathrm {Tr}}(\beta x)}, \\ S_3= & {} \sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-z{\mathrm {Tr}}(\beta x)}\right) . \end{aligned}$$

Then we have the following:

  1. (I)

    \(S_1=q\),

  2. (II)

    \(S_2 =\left\{ \begin{array}{ll} \varepsilon _f p^{m+1}(p^*)^{-\frac{r_f}{2}}&{}\mathrm{if} \beta \in \mathrm{Im}(L_f) and f(x_\beta )=0 \\ \varepsilon _f \bar{\upeta }(-f(x_\beta ))p^{m}(p^*)^{-\frac{r_f-1}{2}}&{}\mathrm{if} \beta \in \mathrm{Im}(L_f) and f(x_\beta )\ne 0 \\ \varepsilon _f p^m(p^{*})^{-\frac{r_f}{2}}&{}\mathrm{if} \beta \not \in \mathrm{Im}(L_f) \end{array}\right. ,\)

  3. (III)

    if \(r_f\) is even, then

    $$\begin{aligned} S_3 =\left\{ \begin{array}{ll} \varepsilon _f (p-1)p^{m+1}(p^*)^{-\frac{r_f}{2}} &{} \hbox {if}\,\beta \,\in \,Im (L_f)\,{and}\,f(x_\beta )=0, \\ 0 &{} \hbox { if }\,\beta \,\in \,Im (L_f)\,{and}\,f(x_\beta )\ne 0, \\ \varepsilon _f (p-1)p^m(p^*)^{-\frac{r_f}{2}} &{} \hbox { if } \beta \not \in Im (L_f), \end{array} \right. \end{aligned}$$

if \(r_f\) is odd, then

$$\begin{aligned} S_3 =\left\{ \begin{array}{ll} 0 &{} \hbox {if}\,\, \beta \,\in \,Im (L_f)\,{and}\,f(x_\beta )=0, { or } \beta \not \in Im (L_f), \\ \varepsilon _f \bar{\upeta }(-f(x_\beta ))(p-1)p^{m}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }\beta \,\,\in \,Im (L_f)\,{and }\,f(x_\beta )\ne 0. \end{array} \right. \end{aligned}$$

where \(x_\beta \in {\mathrm {GF}}(q)\) satisfies \(L_f(x_\beta )=-\frac{\beta }{2}\) when \(\beta \in Im (L_f)\).

Proof

  1. (I)

    Note that

    $$\begin{aligned} \sum _{z\in {\mathrm {GF}}(p)^*}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{{\mathrm {Tr}}(-z\beta x)}=0, \end{aligned}$$

    as \(\beta \in {\mathrm {GF}}(q)^*\). Therefore, we have

    $$\begin{aligned} S_1= & {} \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{0}+\sum _{z\in {\mathrm {GF}}(p)^*}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{-z{\mathrm {Tr}}(\beta x)}\\= & {} q. \end{aligned}$$
  2. (II)

    By definitions and Part (II) of Lemma 5, we have

    $$\begin{aligned} S_2 =\left\{ \begin{array}{ll} \sum _{z\in {\mathrm {GF}}(p)} \varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} \zeta _p^{-f(x_\beta )z^2} &{} \hbox { if }\beta \in {\mathrm {Im}}(L_f), \\ \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)} &{} \hbox { if }\beta \not \in {\mathrm {Im}}(L_f). \end{array} \right. \end{aligned}$$

    The desired conclusion (II) of this lemma then follows from Lemmas 1 and 2 and Part (I) of Lemma 5.

  3. (III)

    The desired conclusion then follows directly from Lemma 4 and the result (II) of this lemma. This completes the proof.

\(\square \)

Lemma 11

Let the symbols and notations be as above. Let f be a homogeneous quadratic function with rank \(r_f\) and the sign \(\varepsilon _f\), \(\beta \in {\mathrm {GF}}(q)^*\) and

$$\begin{aligned} N_{f,\beta }=\#\{x\in {\mathrm {GF}}(q):f(x)=0 ~and~ {\mathrm {Tr}}(\beta x)=0\}. \end{aligned}$$

Then, for the case \(r_f\) being even, we have

$$\begin{aligned} N_{f,\beta } =\left\{ \begin{array}{ll} p^{m-2}+\varepsilon _f (p-1)p^{m-1}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \in Im (L_f)\,{and }\,f(x_\beta )=0, \\ p^{m-2} &{} \hbox { if }\beta \in Im (L_f)\,{and }\,f(x_\beta )\ne 0, \\ p^{m-2}+\varepsilon _f (p-1)p^{m-2}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \not \in Im (L_f), \end{array} \right. \end{aligned}$$

and for the case \(r_f\) being odd, we have

$$\begin{aligned} N_{f,\beta } =\left\{ \begin{array}{ll} p^{m-2} &{} \hbox { if }\beta \in Im (L_f) \,{ and }\,f(x_\beta )=0, {or }\beta \not \in Im (L_f), \\ p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x_\beta ))(p-1)p^{m-2}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }\beta \in Im (L_f)\,{ and }\,f(x_\beta )\ne 0, \end{array} \right. \end{aligned}$$

where \(x_\beta \in {\mathrm {GF}}(q)\) satisfies \(L_f(x_\beta )=-\frac{\beta }{2}\) when \(\beta \in Im (L_f)\).

Proof

By definition, we have

$$\begin{aligned} N_{f,\beta }= & {} p^{-2} \sum _{x\in {\mathrm {GF}}(q)}\left( \sum _{y\in {\mathrm {GF}}(p)}\zeta _p^{yf(x)}\right) \left( \sum _{z\in {\mathrm {GF}}(p)}\zeta _p^{-z{\mathrm {Tr}}(\beta x)}\right) \\= & {} p^{-2}\left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{-z{\mathrm {Tr}}(\beta x)}+\sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\ \left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-z{\mathrm {Tr}}(\beta x)}\right) \right) . \end{aligned}$$

The desired conclusion then follows from Lemma 10. \(\square \)

Lemma 12

Let f be a homogeneous quadratic function with the rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in {\mathrm {GF}}(q) \backslash Im (L_f)\) and \(\beta \in {\mathrm {GF}}(q)^*\). Then we have the following.

  • There exists \(z_0\in {\mathrm {GF}}(p)^*\) such that \(\alpha -z_0\beta \in Im (L_f)\) if and only if \(\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +{\mathrm {Im}}(L_f))\).

  • Let \(z'\in {\mathrm {GF}}(p)^*\) and \(\beta \in z'\alpha +Im (L_f)\). Then \( \{z\in {\mathrm {GF}}(p)^*:\alpha - z \beta \in Im (L_f)\}=\{\frac{1}{z'}\}. \)

Proof

The desired conclusion is straightforward. \(\square \)

Lemma 13

Let f be a homogeneous quadratic function with the rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in {\mathrm {GF}}(q)\), \(\beta \in {\mathrm {GF}}(q)^*\) and

$$\begin{aligned} S_4=\sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}((\alpha -\beta z) x)}. \end{aligned}$$

Then we have the following.

  1. (I)

    If \(\alpha \in Im (L_f)\), then

    $$\begin{aligned} S_4= \left\{ \begin{array}{ll} \varepsilon _f p^{m+1}(p^*)^{-\frac{r_f}{2}} \zeta _p^{-f(x_\alpha )} &{} \hbox { if }\beta \in Im (L_f), f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )=0, \\ 0 &{} \hbox { if }\beta \in Im (L_f), f(x_\beta )=0\,{ and}\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0, \\ \varepsilon _f \bar{\upeta }(-f(x_\beta ))p^{m}(p^*)^{-\frac{r_f-1}{2}} \zeta _p^{-f(x_\alpha )+\frac{({\mathrm {Tr}}(\alpha x_\beta ))^2}{4f(x_\beta )}} &{} \hbox { if }\beta \in Im (L_f)\, { and}\,f(x_\beta ) \ne 0, \\ \varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} \zeta _p^{-f(x_\alpha )} &{} \hbox { if } \beta \not \in Im (L_f), \end{array} \right. \end{aligned}$$

    where \(x_\alpha \in {\mathrm {GF}}(q)\) satisfies \(L_f(x_\alpha )=-\frac{\alpha }{2}\) and \(x_\beta \in {\mathrm {GF}}(q)\) satisfies \(L_f(x_\beta )=-\frac{\beta }{2}\).

  2. (II)

    If \(\alpha \not \in Im (L_f)\), then

    $$\begin{aligned} S_4= \left\{ \begin{array}{ll} \varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} \zeta _p^{-f(x')} &{} \hbox { if }\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +Im (L_f)), \\ 0 &{} \hbox { otherwise }, \end{array} \right. \end{aligned}$$

    where \(f(x')=-\frac{\alpha -\beta z_0}{2}\) with \(\beta \in \frac{1}{z_0}\alpha +Im (L_f)\) and \(z_0\in {\mathrm {GF}}(p)^*\).

Proof

  1. (I)

    It is obvious that there exists \(x_\alpha \in {\mathrm {GF}}(q)\) such that \(L_f(x_\alpha )=-\frac{\alpha }{2}\) when \(\alpha \in Im (L_f)\). Let us distinguish the following two cases when \(\alpha \in Im (L_f)\).

    • Case \(\beta \in Im (L_f)\). It is obvious that there exists \(x_\beta \in {\mathrm {GF}}(q)\) such that \(L_f(x_\beta )=-\frac{\beta }{2}\). Thus, \(L_f(x_\alpha -zx_\beta )=-\frac{\alpha -z\beta }{2}\). From Lemma 5, we have

      $$\begin{aligned} S_4= & {} \sum _{z\in {\mathrm {GF}}(p)}\varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} \zeta _p^{-f(x_\alpha -zx_\beta )} \nonumber \\= & {} \varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} \sum _{z\in {\mathrm {GF}}(p)} \zeta _p^{-f(x_\alpha )-f(x_\beta )z^2+2{\mathrm {Tr}}(L_f(x_\alpha )x_\beta )z} \nonumber \\= & {} \varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} \sum _{z\in {\mathrm {GF}}(p)} \zeta _p^{-f(x_\beta )z^2-{\mathrm {Tr}}(\alpha x_\beta )z-f(x_\alpha )} \nonumber \\= & {} \left\{ \begin{array}{ll} \varepsilon _f p^{m+1}(p^*)^{-\frac{r_f}{2}} \zeta _p^{-f(x_\alpha )} &{} \hbox { if }f(x_\beta )=0\,{ and}\,{\mathrm {Tr}}(\alpha x_\beta )=0, \\ 0 &{} \hbox { if }f(x_\beta )=0 \,{ and}\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0, \\ \varepsilon _f \bar{\upeta }(-f(x_\beta ))p^{m}(p^*)^{-\frac{r_f-1}{2}} \zeta _p^{-f(x_\alpha )+\frac{({\mathrm {Tr}}(\alpha x_\beta ))^2}{4f(x_\beta )}} &{} \hbox { if }f(x_\beta ) \ne 0, \end{array} \right. \end{aligned}$$
      (9)

      where the last identity follows by using Lemmas 1 and 2.

    • Case \(\beta \not \in Im(L_f)\). It is clear that \(\alpha -\beta z \not \in Im(L_f)\) for any \(z\in {\mathrm {GF}}(p)^*\). Therefore, from Lemma 5 we have

      $$\begin{aligned} S_4 = \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}(\alpha x))} = \varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} \zeta _p^{-f(x_\alpha )}. \end{aligned}$$
      (10)

    Combining (9) and (10), the result (I) of this lemma follows. (II) The proof is similar to that of Case (I). The desired conclusion then follows from Lemmas 5 and 12.

\(\square \)

Lemma 14

Let the symbols and notations be defined in Lemma 13, and let

$$\begin{aligned} S_5=\sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}((\alpha -\beta z) x)}\right) . \end{aligned}$$

Then we have the following.

  1. (I)

    When \(\alpha \in Im (L_f)\), we have the following four cases.

    • If \(r_f\) is even and \(f(x_\alpha )=0\), then

      $$\begin{aligned} S_5= \left\{ \begin{array}{ll} \varepsilon _f (p-1)p^{m+1}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )=0, \\ 0 &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0 \\ &{} \hbox { or }f(x_\beta )\ne 0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )= 0, \\ \varepsilon _f \bar{\upeta }(-1)p^{m}(p^*)^{-\frac{r_f-2}{2}} &{} \hbox { if } f(x_\beta ) \ne 0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0,\\ \varepsilon _f (p-1)p^{m}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if } \beta \not \in Im(L_f). \end{array} \right. \end{aligned}$$
    • If \(r_f\) is even and \(f(x_\alpha ) \ne 0\), then

      $$\begin{aligned} S_5= \left\{ \begin{array}{ll} -\varepsilon _f p^{m+1}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }f(x_\beta )=0\,{and }\,{\mathrm {Tr}}(\alpha x_\beta )=0, \\ 0 &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0 \\ &{} \hbox { or }f(x_\beta )\ne 0\,{ and }\,E= 0, \\ \varepsilon _f \bar{\upeta }(-f(x_\beta )E)p^{m}(p^*)^{-\frac{r_f-2}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{and}\,E \ne 0,\\ -\varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \not \in Im(L_f), \end{array} \right. \end{aligned}$$

      where \(E=-f(x_\alpha )+\frac{({\mathrm {Tr}}(\alpha x_\beta ))^2}{4f(x_\beta )}\).

    • If \(r_f\) is odd and \(f(x_\alpha )=0\), then

      $$\begin{aligned} S_5= \left\{ \begin{array}{ll} 0 &{} \hbox { if }f(x_\beta )=0\,{ or }\,\beta \not \in Im (L_f), \\ \varepsilon _f \bar{\upeta }(-f(x_\beta ))(p-1)p^{m}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )= 0,\\ -\varepsilon _f \bar{\upeta }(-f(x_\beta ))p^{m}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0. \end{array} \right. \end{aligned}$$
    • If \(r_f\) is odd and \(f(x_\alpha ) \ne 0\), then

      $$\begin{aligned} S_5= \left\{ \begin{array}{ll} \varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^{m+1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta )={\mathrm {Tr}}(\alpha x_\beta )=0, \\ 0 &{} \hbox { if }f(x_\beta )=0\,{and}\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0 \\ \varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1)p^{m}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if } f(x_\beta )\ne 0\,{ and }\,E= 0, \\ -\varepsilon _f \bar{\upeta }(-f(x_\beta ))p^{m}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if } f(x_\beta ) \ne 0\,{ and }\,E \ne 0,\\ \varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^{m}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if } \beta \not \in Im(L_f). \end{array} \right. \end{aligned}$$

      where \(E=-f(x_\alpha )+\frac{({\mathrm {Tr}}(\alpha x_\beta ))^2}{4f(x_\beta )}\).

  2. (II)

    When \(\alpha \not \in Im (L_f)\), we have the following two cases.

    • If \(r_f\) is even, then

      $$\begin{aligned} S_5= \left\{ \begin{array}{ll} -\varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +Im (L_f))\,{ and }\,f(x') \ne 0, \\ (p-1)\varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +Im (L_f))\,{ and }\,f(x') = 0, \\ 0 &{} \hbox { otherwise }, \end{array} \right. \end{aligned}$$

      where \(f(x')=-\frac{\alpha -\beta z_0}{2}\) with \(z_0\in {\mathrm {GF}}(p)^*\) and \(\beta \in \frac{1}{z_0}\alpha +Im (L_f)\).

    • If \(r_f\) is odd, then

      $$\begin{aligned} S_5= \left\{ \begin{array}{ll} \varepsilon _f \bar{\upeta }(-f(x'))p^{m}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +Im (L_f))\,{ and }\,f(x') \ne 0, \\ 0 &{} \hbox { otherwise }, \end{array} \right. \end{aligned}$$

      where \(f(x')=-\frac{\alpha -\beta z_0}{2}\) with \(\beta \in \frac{1}{z_0}\alpha +Im (L_f)\) and \(z_0\in {\mathrm {GF}}(p)^*\).

Proof

The desired conclusions then follow from Lemmas 13 and 4. \(\square \)

Lemma 15

Let f be a homogeneous quadratic function with the rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in {\mathrm {GF}}(q)\), \(\beta \in {\mathrm {GF}}(q)^*\) and

$$\begin{aligned} N_{f,\beta }(\alpha )=\{x\in {\mathrm {GF}}(q):f(x)-{\mathrm {Tr}}(\alpha x)=0 ~and~ {\mathrm {Tr}}(\beta x)=0\}. \end{aligned}$$

Then we have the following.

  1. (i)

    When \(\alpha \in Im (L_f)\), we have the following four cases.

    • If \(r_f\) is even and \(f(x_\alpha )=0\), then

      $$\begin{aligned} N_{f,\beta }(\alpha )= \left\{ \begin{array}{ll} p^{m-2}+\varepsilon _f (p-1)p^{m-1}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )=0, \\ p^{m-2} &{} \hbox { if }f(x_\beta )=0 \,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0 \\ &{} \hbox { or }f(x_\beta )\ne 0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )= 0, \\ p^{m-2}+\varepsilon _f \bar{\upeta }(-1)p^{m-2}(p^*)^{-\frac{r_f-2}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{and}\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0,\\ p^{m-2}+\varepsilon _f (p-1)p^{m-2}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if } \beta \not \in Im (L_f). \end{array} \right. \end{aligned}$$
    • If \(r_f\) is even and \(f(x_\alpha ) \ne 0\), then

      $$\begin{aligned} N_{f,\beta }(\alpha )= \left\{ \begin{array}{ll} p^{m-2}-\varepsilon _f p^{m-1}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )=0, \\ p^{m-2} &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0 \\ &{} \hbox { or }f(x_\beta )\ne 0\,{ and }\,E= 0, \\ p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x_\beta )E)p^{m-2}(p^*)^{-\frac{r_f-2}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{ and }\,E \ne 0,\\ p^{m-2}-\varepsilon _f p^{m-2}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \not \in Im (L_f), \end{array} \right. \end{aligned}$$

      where \(E=-f(x_\alpha )+\frac{({\mathrm {Tr}}(\alpha x_\beta ))^2}{4f(x_\beta )}\).

    • If \(r_f\) is odd and \(f(x_\alpha )=0\), then

      $$\begin{aligned} N_{f,\beta }(\alpha )= \left\{ \begin{array}{ll} p^{m-2} &{} \hbox { if }f(x_\beta )=0\,{ or }\,\beta \not \in Im (L_f), \\ p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x_\beta ))(p-1)p^{m-2}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )= 0,\\ p^{m-2}-\varepsilon _f \bar{\upeta }(-f(x_\beta ))p^{m-2}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0. \end{array} \right. \end{aligned}$$
    • If \(r_f\) is odd and \(f(x_\alpha ) \ne 0\), then

      $$\begin{aligned} N_{f,\beta }(\alpha )= \left\{ \begin{array}{ll} p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^{m-1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta )={\mathrm {Tr}}(\alpha x_\beta )=0, \\ p^{m-2} &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta )\ne 0 \\ p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1)p^{m-2}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta )\ne 0\,{ and}\,E= 0, \\ p^{m-2}-\varepsilon _f \bar{\upeta }(-f(x_\beta ))p^{m-2}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }f(x_\beta ) \ne 0\,{ and}\,E \ne 0,\\ p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^{m-2}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }\beta \not \in Im (L_f). \end{array} \right. \end{aligned}$$

      where \(E=-f(x_\alpha )+\frac{({\mathrm {Tr}}(\alpha x_\beta ))^2}{4f(x_\beta )}\).

  2. (II)

    When \(\alpha \not \in Im(L_f)\), we have the following two cases.

    • If \(r_f\) is even, then

      $$\begin{aligned} N_{f,\beta }(\alpha )= \left\{ \begin{array}{ll} p^{m-2}-\varepsilon _f p^{m-2}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +Im (L_f))\,{ and }\,f(x') \ne 0, \\ p^{m-2}+(p-1)\varepsilon _f p^{m-2}(p^*)^{-\frac{r_f}{2}} &{} \hbox { if }\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +Im (L_f))\,{ and }\,f(x') = 0, \\ p^{m-2} &{} \hbox { otherwise }, \end{array} \right. \end{aligned}$$

      where \(f(x')=-\frac{\alpha -\beta z_0}{2}\) with \(\beta \in \frac{1}{z_0}\alpha +Im(L_f)\) and \(z_0\in {\mathrm {GF}}(p)^*\).

    • If \(r_f\) is odd, then

      $$\begin{aligned} N_{f,\beta }(\alpha )= \left\{ \begin{array}{ll} p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x'))p^{m-2}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }\beta \in \bigcup _{z\in {\mathrm {GF}}(p)^*}(z\alpha +Im (L_f))\,{ and }\,f(x') \ne 0, \\ p^{m-2} &{} \hbox { otherwise }, \end{array} \right. \end{aligned}$$

      where \(f(x')=-\frac{\alpha -\beta z_0}{2}\) with \(\beta \in \frac{1}{z_0}\alpha +Im (L_f)\) and \(z_0\in {\mathrm {GF}}(p)^*\).

Proof

By definition, we have

$$\begin{aligned} N_{f,\beta }(\alpha )= & {} p^{-2} \sum _{x\in {\mathrm {GF}}(q)}\left( \sum _{y\in {\mathrm {GF}}(p)}\zeta _p^{y(f(x)-{\mathrm {Tr}}(\alpha x))}\right) \left( \sum _{z\in {\mathrm {GF}}(p)}\zeta _p^{z{\mathrm {Tr}}(\beta x)}\right) \\= & {} p^{-2}\left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{z{\mathrm {Tr}}(\beta x)}+\sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\ \left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}((\alpha -\beta z)x)}\right) \right) . \end{aligned}$$

The desired conclusion then follows from Lemma 14 and Part (I) of Lemma 10.

This completes the proof. \(\square \)

Lemma 16

Let f be a homogeneous quadratic function with rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in Im(L_f)\) and \(x_\alpha \in {\mathrm {GF}}(q)\) with satisfying \(L_f(x_\alpha )=-\frac{\alpha }{2}\). Suppose that \(f(x_\alpha )\ne 0\), we define

$$\begin{aligned} S_6=\sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-\frac{1}{4f(x_\alpha )}z^2+w(z-{\mathrm {Tr}}(\alpha x))} \end{aligned}$$

and

$$\begin{aligned} N_{E}=\# \left\{ x\in {\mathrm {GF}}(q):f(x)-\frac{1}{4f(x_\alpha )}({\mathrm {Tr}}(\alpha x))^2=0\right\} . \end{aligned}$$

Then we have the following:

  1. (I)

    \(S_6=\varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^{m+1}(p^*)^{-\frac{r_f-1}{2}}\),

  2. (II)

    \(\sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y(S_6) =\left\{ \begin{array}{ll} 0 &{} \hbox { if }\,r_f\,{is\,even,} \\ \varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1)p^{m+1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox {if}\,r_f\,{is\,odd,} \end{array} \right. \)

  3. (III)

    \(N_{E} =\left\{ \begin{array}{ll} p^{m-1} &{} \hbox { if } r_f {is\,even,} \\ p^{m-1} + \varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1)p^{m-1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if } r_f {is\,odd.} \end{array} \right. \)

Proof

  1. (I)

    By definition, we have

    $$\begin{aligned} S_6= & {} \sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\zeta _p^{-\frac{1}{4f(x_\alpha )}z^2+wz} \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-{\mathrm {Tr}}(w \alpha x)}\\= & {} \varepsilon _f p^{m}(p^*)^{-\frac{r_f}{2}}\sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\zeta _p^{-\frac{1}{4f(x_\alpha )}z^2+wz-f(x_\alpha )w^2} ~~~~~~(\hbox {By the result (II) of Lemma 5})\\= & {} \varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^{m+1}(p^*)^{-\frac{r_f-1}{2}}.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(\hbox {By Lemma 6}) \end{aligned}$$
  2. (II)

    The desired conclusion then follows from Lemma 4 and Part (I) of this Lemma.

  3. (III)

    For any \(x\in {\mathrm {GF}}(q)\), we have

$$\begin{aligned}&p^{-2}\sum _{z\in {\mathrm {GF}}(p)}\left( \sum _{w\in {\mathrm {GF}}(p)}\zeta _p^{w(z-{\mathrm {Tr}}(\alpha x))}\right) \left( \sum _{y\in {\mathrm {GF}}(p)}\zeta _p^{y(f(x)-\frac{1}{4f(x_\alpha )}z^2)}\right) \\&= \left\{ \begin{array}{ll} 1 &{} ~~~~~~~ ~~~~~~~ ~~~~~~~\hbox { if }f(x)-\frac{1}{4f(x_\alpha )}({\mathrm {Tr}}(\alpha x))^2=0, \\ 0 &{} ~~~~~~~ ~~~~~~~ ~~~~~~~\hbox { otherwise.} \end{array} \right. \end{aligned}$$

Therefore,

$$\begin{aligned} N_{E}= & {} p^{-2}\sum _{x\in {\mathrm {GF}}(q)}\sum _{z\in {\mathrm {GF}}(p)}\left( \sum _{w\in {\mathrm {GF}}(p)}\zeta _p^{w(z-{\mathrm {Tr}}(\alpha x))}\right) \left( \sum _{y\in {\mathrm {GF}}(p)}\zeta _p^{y(f(x)-\frac{1}{4f(x_\alpha )}z^2)}\right) \\= & {} p^{-2}\sum _{y\in {\mathrm {GF}}(p)}\sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)} \zeta _p^{y(f(x)-\frac{1}{4f(x_\alpha )}z^2)+w(z-{\mathrm {Tr}}(\alpha x))} \\= & {} p^{-2}\sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)} \zeta _p^{w(z-{\mathrm {Tr}}(\alpha x))} \\&+ p^{-2}\sum _{y\in {\mathrm {GF}}(p)^*}\sigma _y\left( \sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)} \zeta _p^{f(x)-\frac{1}{4f(x_\alpha )}z^2+w(z-{\mathrm {Tr}}(\alpha x))}\right) . \end{aligned}$$

Note that

$$\begin{aligned} \sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)} \zeta _p^{w(z-{\mathrm {Tr}}(\alpha x))}=p^{m+1}. \end{aligned}$$

The desired conclusion then follows from the result (II) of this lemma.

This completes the proof. \(\square \)

Lemma 17

Let f be a homogeneous quadratic function with rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in Im(L_f)\) and \(x_\alpha \in {\mathrm {GF}}(q)\) with satisfying \(L_f(x_\alpha )=-\frac{\alpha }{2}\). Let \(f(x_\alpha ) \ne 0\),

$$\begin{aligned} g(x)=f(x)-\frac{({\mathrm {Tr}}(\alpha x))^2}{4f(x_\alpha )} \end{aligned}$$

and \( N(g=t)=\#\{x\in {\mathrm {GF}}(q):g(x)=t \} \) for any \(t\in {\mathrm {GF}}(p)\). Then we have the following results.

  1. (I)

    \(\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{g(x)}=\varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^m(p^*)^{-\frac{r_f-1}{2}}\).

  2. (II)

    \( N(g=t)= \left\{ \begin{array}{ll} p^{m-1} &{} \hbox { if }r_f \, { is \, even \, and } \, t=0,\\ p^{m-1}+\varepsilon _f \bar{\upeta }(-t) \bar{\upeta }(-f(x_\alpha )) p^{m-1}(p^*)^{-\frac{r_f-2}{2}} &{} \hbox { if } r_f \, {is \, even \, and} \, t\ne 0,\\ p^{m-1}+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1) p^{m-1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }r_f \, { is \, odd \, and }\, t=0,\\ p^{m-1}-\varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^{m-1}(p^*)^{-\frac{r_f-1}{2}} &{} \hbox { if }r_f \, { is \, odd \, and } \, t\ne 0. \end{array} \right. \)

Proof

  1. (I)

    By definition, we have

    $$\begin{aligned} \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{g(x)}= & {} \sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-\frac{({\mathrm {Tr}}(\alpha x))^2}{4f(x_\alpha )}}\\= & {} \sum _{z\in {\mathrm {GF}}(p)}\left( \sum _{x\in {\mathrm {GF}}(q),{\mathrm {Tr}}(x)=z}\zeta _p^{f(x)-\frac{z^2}{4f(x_\alpha )}}\right) \\= & {} \sum _{z\in {\mathrm {GF}}(p)}\left( \sum _{x\in {\mathrm {GF}}(q),{\mathrm {Tr}}(x)=z}\zeta _p^{f(x)-\frac{z^2}{4f(x_\alpha )}}\Big (p^{-1}\sum _{w\in {\mathrm {GF}}(p)}\zeta _p^{w(z-{\mathrm {Tr}}(\alpha x))}\Big )\right) \\= & {} p^{-1}\sum _{z\in {\mathrm {GF}}(p)}\sum _{w\in {\mathrm {GF}}(p)}\sum _{x\in {\mathrm {GF}}(q)}\zeta _p^{f(x)-\frac{z^2}{4f(x_\alpha )}+w(z-{\mathrm {Tr}}(\alpha x))} \\= & {} \varepsilon _f \bar{\upeta }(-f(x_\alpha ))p^m(p^*)^{-\frac{r_f-1}{2}}, \end{aligned}$$

    where the last identity follows from Part (I) of Lemma 16.

  2. (II)

    By Part (I) of this lemma, it is clear that the rank of g(x) is \(r_g=r_f-1\) and the sign of g(x) is \(\varepsilon _g=\varepsilon _f \bar{\upeta }(-f(x_\alpha ))\). Thus the desired conclusion (II) then follows from Lemmas 7 and 16. This completes the proof.

\(\square \)

Lemma 18

Let f be a homogeneous quadratic function with the rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in Im (L_f)\) and \(x_\alpha \in {\mathrm {GF}}(q)\) with satisfying \(L_f(x_\alpha )=-\frac{\alpha }{2}\). Let \(f(x_\alpha ) \ne 0\),

$$\begin{aligned} g(x)=f(x)-\frac{({\mathrm {Tr}}(\alpha x))^2}{4f(x_\alpha )} \end{aligned}$$

and

$$\begin{aligned} E=-f(x_\alpha )-\frac{({\mathrm {Tr}}(\alpha x))^2}{4f(x)}. \end{aligned}$$

When \(r_f\) is even, we define

$$\begin{aligned}&I_1=\#\{x\in {\mathrm {GF}}(q):f(x)={\mathrm {Tr}}(\alpha x)=0 \},\\&I_2=\#\left\{ \{x\in {\mathrm {GF}}(q):f(x)=0 ~and~ {\mathrm {Tr}}(\alpha x)\ne 0 \} \bigcup \{x\in {\mathrm {GF}}(q):f(x)\ne 0 ~and~ E=0 \}\right\} , \\&I_3=\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0, E\ne 0 ~and~ f(x)\cdot E \in \mathrm {NSQ} \},\\&I_4=\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0, E\ne 0 ~and~ f(x)\cdot E \in \mathrm {SQ} \}. \end{aligned}$$

When \(r_f\) is odd, we define

$$\begin{aligned}&J_1=\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0,\bar{\upeta }(f(x))=\bar{\upeta }(f(x_\alpha )) ~and~ E=0 \},\\&J_2=\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0~and~\bar{\upeta }(f(x))=\bar{\upeta }(f(x_\alpha ))\},\\&J_3=\#\{x\in {\mathrm {GF}}(q):f(x)={\mathrm {Tr}}(\alpha x)=0 \},\\&J_4=\#\{x\in {\mathrm {GF}}(q):f(x)=0 ~and~{\mathrm {Tr}}(\alpha x)\ne 0 \},\\&J_5=\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0 ~and~ E=0 \},\\&J_6=\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0, E\ne 0 ~and~\bar{\upeta }(f(x))=-\bar{\upeta }(f(x_\alpha ))\}. \end{aligned}$$

Then we have the following results.

  1. (I)

    If \(r_f\) is even, then

    $$\begin{aligned}&I_1=p^{m-2}, \end{aligned}$$
    (11)
    $$\begin{aligned}&I_2=(p-1)p^{m-2}(2+\varepsilon _f \cdot p(p^*)^{-\frac{r_f}{2}}), \end{aligned}$$
    (12)
    $$\begin{aligned}&I_3= \frac{p-1}{2}p^{m-1}(1-\varepsilon _f \cdot p(p^*)^{-\frac{r_f}{2}}), \end{aligned}$$
    (13)
    $$\begin{aligned}&I_4= \frac{(p-1)(p-2)}{2}p^{m-2}\left( 1+\varepsilon _f \cdot p(p^*)^{-\frac{r_f}{2}}\right) . \end{aligned}$$
    (14)
  2. (II)

    If \(r_f\) is odd, then

    $$\begin{aligned}&J_1=(p-1)p^{m-2}\left( 1+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1)(p^*)^{-\frac{r_f-1}{2}}\right) , \end{aligned}$$
    (15)
    $$\begin{aligned}&J_2=\frac{(p-1)(p-2)}{2}p^{m-2}\left( 1-\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p^*)^{-\frac{r_f-1}{2}}\right) , \end{aligned}$$
    (16)
    $$\begin{aligned}&J_3= p^{m-2}+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1) p^{m-2}(p^*)^{-\frac{r_f-1}{2}}, \end{aligned}$$
    (17)
    $$\begin{aligned}&J_4=(p-1)p^{m-2}\left( 1-\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p^*)^{-\frac{r_f-1}{2}}\right) , \end{aligned}$$
    (18)
    $$\begin{aligned}&J_5= (p-1)p^{m-2}\left( 1+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1)(p^*)^{-\frac{r_f-1}{2}}\right) , \end{aligned}$$
    (19)
    $$\begin{aligned}&J_6=\frac{p-1}{2}p^{m-1}\left( 1-\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p^*)^{-\frac{r_f-1}{2}}\right) . \end{aligned}$$
    (20)

Proof

  1. (I)

    If \(r_f\) is even, then we have the following.

    • It is clear that Eq. (11) follows directly from Lemma 11.

    • By definition, we have

      $$\begin{aligned} I_2= & {} \# \{x\in {\mathrm {GF}}(q):f(x)\ne 0 ~and~ g(x)=0 \}\\&+ \# \{x\in {\mathrm {GF}}(q):f(x)=0 ~and~ {\mathrm {Tr}}(\alpha x)\ne 0 \} \\= & {} \# \{x\in {\mathrm {GF}}(q):g(x)=0 \}-\# \{x\in {\mathrm {GF}}(q):f(x)=0 ~and~ {\mathrm {Tr}}(\alpha x)=0 \}\\&+ \# \{x\in {\mathrm {GF}}(q):f(x)=0 ~and~ {\mathrm {Tr}}(\alpha x)\ne 0 \} \\= & {} \# \{x\in {\mathrm {GF}}(q):g(x)=0 \}+\# \{x\in {\mathrm {GF}}(q):f(x)=0 \}-2\# \{x\in {\mathrm {GF}}(q):f(x)\\= & {} {\mathrm {Tr}}(\alpha x)=0 \}. \end{aligned}$$

      Then Eq. (12) follows from Lemmas 17, 9 and 11.

    • In Eqs. (13) and (14), we only give the proof for the case \(-f(x_\alpha )\in \mathrm {SQ}\) and omit the proof for the case \(-f(x_\alpha )\in \mathrm {NSQ}\) whose proof is similar. Suppose that \(-f(x_\alpha )\in \mathrm {SQ}\), by definition and

      $$\begin{aligned} -\frac{f(x)E}{f(x_\alpha )}=f(x)-\frac{({\mathrm {Tr}}(\alpha x))^2}{4f(x_\alpha )}=g(x) \end{aligned}$$

      we get

      $$\begin{aligned} I_3= & {} \#\{x\in {\mathrm {GF}}(q):f(x)\ne 0~and~ g(x)\in \mathrm {NSQ} \} \\= & {} \#\{x\in {\mathrm {GF}}(q):g(x)\in \mathrm {NSQ} \}-\#\{x\in {\mathrm {GF}}(q):f(x)=0~and~ g(x)\in \mathrm {NSQ} \} \\= & {} \#\{x\in {\mathrm {GF}}(q):g(x)\in \mathrm {NSQ} \}-\#\{x\in {\mathrm {GF}}(q):f(x)=0~and~ ({\mathrm {Tr}}(\alpha x))^2 \in \mathrm {NSQ} \} \\= & {} \#\{x\in {\mathrm {GF}}(q):g(x)\in \mathrm {NSQ} \} \\= & {} \frac{p-1}{2}p^{m-1}(1-\varepsilon _f \cdot p(p^*)^{-\frac{r_f}{2}}), \end{aligned}$$

      where the last equation follows from Lemma 17. This means that Eq. (13) follows. Similarly, when \(-f(x_\alpha )\in \mathrm {SQ}\), Eq. (14) follows from (11) and (12).

  2. (II)

    If \(r_f\) is odd, then we give the proofs of the desired conclusions as follows.

    • Since

      $$\begin{aligned} -\frac{E}{4f(x_\alpha )}=\frac{g(x)}{4f(x)}, \end{aligned}$$

      we have

      $$\begin{aligned} J_1= & {} \#\{x\in {\mathrm {GF}}(q):f(x)\ne 0,\bar{\upeta }(f(x))=\bar{\upeta }(f(x_\alpha )) ~and~ E=0 \} \\= & {} \#\{x\in {\mathrm {GF}}(q):g(x)=0 ~and~f(x)\ne 0 \} \\= & {} \#\{x\in {\mathrm {GF}}(q):g(x)=0 \}- \#\{x\in {\mathrm {GF}}(q):g(x)=f(x)=0 \} \\= & {} (p-1)p^{m-2}(1+\varepsilon _f \bar{\upeta }(-f(x_\alpha ))(p-1)(p^*)^{-\frac{r_f-1}{2}}), \end{aligned}$$

      where the last equation follows from Lemmas 17 and 11. This means that Eq. (15) follows.

    • By definition, we have

      $$\begin{aligned} J_2= & {} \#\{x\in {\mathrm {GF}}(q):f(x)\ne 0 ~and~\bar{\upeta }(f(x))=\bar{\upeta }(f(x_\alpha )) \} \\&-\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0,\bar{\upeta }(f(x))=\bar{\upeta }(f(x_\alpha )) ~and~ E=0 \} \\= & {} \#\{x\in {\mathrm {GF}}(q):f(x)\ne 0 ~and~\bar{\upeta }(f(x))=\bar{\upeta }(f(x_\alpha )) \}\\&-\#\{x\in {\mathrm {GF}}(q):E=0 ~and~f(x)\ne 0 \}. \end{aligned}$$

      Then Eq. (16) follows from Lemma 7 and (15).

    • Equation (17) follows directly from Lemma 11.

    • By definition, we have

      $$\begin{aligned} J_4=\#\{x\in {\mathrm {GF}}(q):f(x)=0 \}- \#\{x\in {\mathrm {GF}}(q):f(x)={\mathrm {Tr}}(\alpha x)=0 \}. \end{aligned}$$

      The desired conclusion in (18) then follows from Lemma 9 and Eq. (17).

    • Note that

      $$\begin{aligned} -\frac{E}{4f(x_\alpha )}=\frac{g(x)}{4f(x)}. \end{aligned}$$

      Therefore, we have

      $$\begin{aligned} J_5= & {} \#\{x\in {\mathrm {GF}}(q):f(x)\ne 0 ~and~ g(x)=0 \}\\= & {} \#\{x\in {\mathrm {GF}}(q):g(x)=0 \}-\#\{x\in {\mathrm {GF}}(q):f(x)={\mathrm {Tr}}(\alpha x)=0 \}. \end{aligned}$$

      The desired conclusion in (19) then follows from Lemma 17 and Eq. (17).

    • The desired conclusion in (20) then follows directly from (16), (17), (18) and (19).

    This completes the proof of this lemma.

\(\square \)

Lemma 19

Let f be a homogeneous quadratic function with the rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in Im (L_f)\) and \(x_\alpha \in {\mathrm {GF}}(q)\) satisfying \(L_f(x_\alpha )=-\frac{\alpha }{2}\) and \(f(x_\alpha )=0\). Then

  • \(\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0, {\mathrm {Tr}}(\alpha x)=0 ~and~ -f(x)\in \mathrm {SQ} \}=\frac{p-1}{2}p^{m-2}\big (1+\varepsilon _f \cdot p(p^*)^{-\frac{r_f-1}{2}}\big )\),

  • \(\#\{x\in {\mathrm {GF}}(q):f(x)\ne 0, {\mathrm {Tr}}(\alpha x)=0 ~and~ -f(x)\in \mathrm {NSQ} \}=\frac{p-1}{2}p^{m-2}\big (1-\varepsilon _f \cdot p(p^*)^{-\frac{r_f-1}{2}}\big )\),

  • \(\#\{x\in {\mathrm {GF}}(q):f(x){\mathrm {Tr}}(\alpha x)\ne 0 ~and~ -f(x)\in \mathrm {SQ} \}=\frac{(p-1)^2}{2}p^{m-2}\),

  • \(\#\{x\in {\mathrm {GF}}(q):f(x){\mathrm {Tr}}(\alpha x)\ne 0 ~and~ -f(x)\in \mathrm {NSQ} \}=\frac{(p-1)^2}{2}p^{m-2}\).

Proof

The desired conclusions then follow from Lemma 8. \(\square \)

3.2 Main results and their proofs

The following two theorems are the main results of this paper.

Theorem 1

Let f be a homogeneous quadratic function with rank \(r_f\) and the sign \(\varepsilon _f\), \(\alpha \in Im (L_f)\) and \(x_\alpha \in {\mathrm {GF}}(q)\) satisfying \(L_f(x_\alpha )=-\frac{\alpha }{2}\). Let D be defined in (8). Then the set \({C}_D\) of (1) is an [nm] linear code over \({\mathrm {GF}}(p)\) with the weight distribution in Tables 1, 2, 3 and 4, where

$$\begin{aligned} n= \left\{ \begin{array}{ll} p^{m-1}(1-\varepsilon _f(p^*)^{-\frac{r_f}{2}})-1 &{} \hbox { if }r_f\,{is\,even\,and}\,f(x_\alpha ) \ne 0, \\ p^{m-1}(1+\varepsilon _f(p-1)(p^*)^{-\frac{r_f}{2}})-1 &{} \hbox { if }\,r_f\,{is\,even\,and}\,f(x_\alpha )=0, \\ p^{m-1}(1+\varepsilon _f \bar{\upeta }\Big (-f(x_\alpha ))(p^*)^{-\frac{r_f-1}{2}}\Big )-1 &{} \hbox {if}\,r_f\,{is\,odd\,and}\,f(x_\alpha ) \ne 0, \\ p^{m-1}-1 &{} \hbox {if}\,r_f\,{is\,odd\,and}\,f(x_\alpha ) = 0. \end{array} \right. \end{aligned}$$
(21)
Table 1 The weight distribution of \({C}_D\) of Theorem 1 when \(r_f\) is even and \(f(x_\alpha )\ne 0\)
Table 2 The weight distribution of \({C}_D\) of Theorem 1 when \(r_f\) is even and \(f(x_\alpha )=0\)
Table 3 The weight distribution of \({C}_D\) of Theorem 1 when \(r_f\) is odd and \(f(x_\alpha )\ne 0\)
Table 4 The weight distribution of \({C}_D\) of Theorem 1 when \(r_f\) is odd and \(f(x_\alpha )= 0\)

Proof

By definition, the code length of \({C}_D\) is \(n = |D|=N_f(\alpha )-1\), where \(N_f(\alpha )\) was defined by Lemma 9. This means that Eq. (21) follows.

For each \(\beta \in {\mathrm {GF}}(q)^*\), define

$$\begin{aligned} {\mathbf {c}}_{\beta }=({\mathrm {Tr}}(\beta d_1), \,{\mathrm {Tr}}(\beta d_2), \,\ldots , \,{\mathrm {Tr}}(\beta d_n)), \end{aligned}$$
(22)

where \(d_1, d_2, \ldots , d_n\) are the elements of D. Then the Hamming weight \({\mathrm {wt}}({\mathbf {c}}_\beta )\) of \({\mathbf {c}}_\beta \) is

$$\begin{aligned} {\mathrm {wt}}({\mathbf {c}}_\beta )=N_f(\alpha )-N_{f,\beta }(\alpha ), \end{aligned}$$
(23)

where \(N_f(\alpha )\) and \(N_{f,\beta }(\alpha )\) were defined before. By Lemmas 9 and 15, we have \({\mathrm {wt}}({\mathbf {c}}_\beta )=N_f(\alpha )-N_{f,\beta }(\alpha )>0\) for each \(\beta \in {\mathrm {GF}}(q)^*\). This means that the code \({C}_D\) has q distinct codewords. Hence, the dimension of the code \({C}_D\) is m.

Next we shall prove the the multiplicities \(A_{w_i}\) of codewords with weight \(w_i\) in \({C}_D\). Let us give the proofs of four cases, respectively.

  1. (1)

    The case that \(r_f\) is even and \(f(x_\alpha ) \ne 0\). We only give the proof for the case \(-f(x_\alpha ) \in \mathrm {SQ}\) and omit the proof for the case \(-f(x_\alpha ) \in \mathrm {NSQ}\) whose proof is similar. Suppose that \(-f(x_\alpha ) \in \mathrm {SQ}\). For each \(\beta \in {\mathrm {GF}}(q)^*\), then from Lemmas 9 and 15 we obtain the Hamming weight

    $$\begin{aligned} {\mathrm {wt}}({\mathbf {c}}_\beta )= & {} N_f(\alpha )-N_{f,\beta }(\alpha ) \\= & {} \left\{ \begin{array}{ll} B_1 &{} \hbox { if }f(x_\beta )={\mathrm {Tr}}(\alpha x_\beta )=0\,{ or }\,f(x_\beta ) \cdot E\in \mathrm {NSQ}, \\ B_1 -Bp &{} \hbox { if }f(x_\beta )=0\,{ and }\,{\mathrm {Tr}}(\alpha x_\beta ) \ne 0\,{ or }\,f(x_\beta )\ne 0 \,{ and }\, E=0, \\ B_1 -2Bp &{} \hbox { if }f(x_\beta ) \cdot E\in \mathrm {SQ},\\ B_1 -B(p-1) &{} \hbox { if }\beta \not \in Im(L_f), \end{array} \right. \end{aligned}$$

    where \(B_1={p}^{m-2}(p-1)\) and \(B=p^{m-2}\varepsilon _f(p^*)^{-\frac{r_f}{2}}\). Define

    $$\begin{aligned} w_1=B_1,w_2=B_1 -Bp, w_3=B_1 -2Bp, w_4=B_1 -2B(p-1). \end{aligned}$$

    Let

    $$\begin{aligned} M_1= & {} \#\{\beta \in {\mathrm {GF}}(q): f(x_\beta )={\mathrm {Tr}}(\alpha x_\beta )=0\}+\#\{\beta \in {\mathrm {GF}}(q): f(x_\beta ) \cdot E\in \mathrm {NSQ} \} \end{aligned}$$

    Since the rank of the linear mapping \({\mathrm {GF}}(q) \rightarrow {\mathrm {GF}}(q)\) (\(x_\beta \mapsto -2L_f(x_\beta )\)) is \(r_f\), the dimension of their kernel is \(m-r_f\). Therefore,

    $$\begin{aligned} M_1= & {} p^{r_f-m} \#\{x\in {\mathrm {GF}}(q): f(x)={\mathrm {Tr}}(\alpha x)=0\}\\&+p^{r_f-m} \#\{x \in {\mathrm {GF}}(q): f(x) \cdot E\in \mathrm {NSQ} \}\\= & {} p^{r_f-2}+\frac{p-1}{2}p^{r_f-1}(1-\varepsilon _f\cdot p (p^*)^{-\frac{r_f}{2}}).~~~~~~(\hbox {By Lemma 18}) \end{aligned}$$

    Note that \(f(0)={\mathrm {Tr}}(\alpha \cdot 0)=0\). Then

    $$\begin{aligned} A_{w_1}= & {} \#\{\beta \in {\mathrm {GF}}(q): {\mathrm {wt}}({\mathbf {c}}_\beta )=(p-1)p^{m-2}\}\\= & {} M_1-1\\= & {} p^{r_f-2}+\frac{p-1}{2}p^{r_f-1}(1-\varepsilon _f\cdot p (p^*)^{-\frac{r_f}{2}})-1. \end{aligned}$$

    Similarly, the values of \(A_{w_2}\), \(A_{w_3}\) and \(A_{w_4}\) can be calculated. This completes the proof of the weight distribution of Table 1.

  2. (2)

    The case that \(r_f\) is even and \(f(x_\alpha ) = 0\). The proof is similar to Case 1) and we omit it here. The desired conclusion then follows from Lemmas 9 and 11.

  3. (3)

    The case that \(r_f\) is odd and \(f(x_\alpha ) \ne 0\). The proof is similar to Case 1) and we omit it here. The desired conclusion then follows from Lemmas 9 and 18.

  4. (4)

    The case that \(r_f\) is odd and \(f(x_\alpha ) = 0\). The proof is similar to case 1) and we omit it here. The desired conclusion then follows from Lemmas 9 and 19.

\(\square \)

For special cases of Theorem 1, the following two corollaries are direct consequences of Theorem 1.

Corollary 1

Let \(u\in {\mathrm {GF}}(q)^*\), \(f(x)={\mathrm {Tr}}(ux^2)\) and \(\alpha \in {\mathrm {GF}}(q)^*\). Then

  • \(\alpha \in Im (L_{f})\),

  • \(\varepsilon _f=(-1)^{m-1}\upeta (-u)\),

  • \(r_{f}=m\),

  • \(L_{f}(x)=ux\),

  • \(x_\alpha =-\frac{\alpha }{2u}\) and \(f(x_\alpha )=\frac{1}{4}{\mathrm {Tr}}(\frac{\alpha ^2}{u})\).

Thus, using this function f, we can construct linear code \({C}_D\) with the parameter and weight distribution given by Theorem 1.

Corollary 2

Let \(v\in {\mathrm {GF}}(q)^*\), \({\mathrm {Tr}}(v^2)\ne 0\), \(f(x)={\mathrm {Tr}}(x^2)-\frac{1}{{\mathrm {Tr}}(v^2)}({\mathrm {Tr}}(vx))^2\), \(\alpha \in {\mathrm {GF}}(q)^*\) and \({\mathrm {Tr}}(v \alpha )= 0\). Then

  • \(\alpha \in Im (L_{f})\),

  • \(\varepsilon _{f}=(-1)^{m-1}\upeta (-1)\bar{\upeta }(-{\mathrm {Tr}}(v^2))\),

  • \(r_{f}=m-1\),

  • \(L_{f}(x)=x-\frac{v}{{\mathrm {Tr}}(v^2)}{\mathrm {Tr}}(vx)\).

Thus, we can construct linear code \({C}_D\) with the parameter and weight distribution given by Theorem 1.

For special cases of Corollary 1, we give the following two examples.

Example 1

Let \((u,p,m)=(1,3,4)\), \(\alpha \in {\mathrm {GF}}(q)^*\) and \({\mathrm {Tr}}(\alpha )\ne 0\). Then the code \({C}_D\) has parameters [29, 4, 18] and weight enumerator \(1+44z^{18}+30z^{21}+6z^{24}\), which is verified by the Magma program.

Example 2

Let \((u,p,m)=(1,3,5)\) and \(\alpha \in {\mathrm {GF}}(p)^*\). Then the code \({C}_D\) has parameters [71, 5, 42] and weight enumerator \(1+30z^{42}+60z^{45}+90z^{48}+42z^{51}+20z^{54}\), which is verified by the Magma program.

For special cases of Corollary 2, we give the following two examples.

Example 3

Let \((v,p,m)=(1,3,5)\), g be a generator of \({\mathrm {GF}}(q)^*\) with the minimal polynomial \(x^5+2x+1\). Let \(\alpha =g^2\). Then the code \({C}_D\) has parameters [89, 5, 54 ] and weight enumerator \(1+44z^{54}+162z^{60}+30z^{63}+6z^{72}\), which is verified by the Magma program.

Example 4

Let \((v,p,m)=(1,3,4)\), g be a generator of \({\mathrm {GF}}(q)^*\) with the minimal polynomial \(x^4+2x^3+2\). Let \(\alpha =g^5\). Then the code \({C}_D\) has parameters [17, 4, 6 ] and weight enumerator \(1+4z^{4}+8z^{9}+66z^{12}+2z^{15}\), which is verified by the Magma program.

Theorem 2

Let f be a homogeneous quadratic function with rank \(r_f\) and the sign \(\varepsilon _f\). let \(\alpha \not \in Im (L_f)\) and D be defined in (8). Then the set \({C}_D\) of (1) is an [nm] linear code over \({\mathrm {GF}}(p)\) with the weight distribution in Tables 5 and 6, where \(n=p^{m-1}-1\).

Table 5 The weight distribution of \({C}_D\) of Theorem 2 when \(r_f\) is even
Table 6 The weight distribution of \({C}_D\) of Theorem 2 when \(r_f\) is odd

Proof

The proof is similar to Case (1) of Theorem 1 and we omit it here. We point out that:

  • when \(r_f\) is even, the desired conclusion then follows from Lemma 14,

  • when \(r_f\) is odd, the desired conclusion then follows from Lemmas 14 and 7.

This completes the proof. \(\square \)

As special cases of Theorem 2, the following corollary is a direct consequence of Theorem 2.

Corollary 3

Let \(v\in {\mathrm {GF}}(q)^*\), \({\mathrm {Tr}}(v^2)\ne 0\), \(f(x)={\mathrm {Tr}}(x^2)-\frac{1}{{\mathrm {Tr}}(v^2)}({\mathrm {Tr}}(vx))^2\), \(\alpha \in {\mathrm {GF}}(q)^*\) and \({\mathrm {Tr}}(v \alpha )\ne 0\). Then

  • \(\alpha \not \in Im (L_{f})\),

  • \(\varepsilon _{f}=(-1)^{m-1}\upeta (-1)\bar{\upeta }(-{\mathrm {Tr}}(v^2))\),

  • \(r_{f}=m-1\),

  • \(L_{f}(x)=x-\frac{v}{{\mathrm {Tr}}(v^2)}{\mathrm {Tr}}(vx)\).

Thus, we can construct linear code \({C}_D\) with the parameter and weight distribution given by Theorem 2.

As special cases of Corollary 3, we give the following two examples.

Example 5

Let \((v,p,m)=(1,3,5)\) and \(\alpha \in {\mathrm {GF}}(p)^*\). Then the code \({C}_D\) has parameters [26, 5, 15] and weight enumerator \(1+24z^{15}+44z^{18}+12z^{21}\), which is verified by the Magma program.

Example 6

Let \((v,p,m)=(1,3,4)\) and \(\alpha \in {\mathrm {GF}}(p)^*\). Then the code \({C}_D\) has parameters [80, 4, 51] and weight enumerator \(1+120z^{51}+80z^{54}+42z^{60}\), which is verified by the Magma program.

4 Concluding remarks

In this paper, inspired by the works of [7, 22], inhomogeneous quadratic functions were used to construct linear codes with few nonzero weights over finite fields. It was shown that the presented linear codes have at most five nonzero weights. The weight distributions of the codes were also determined and some of constructed linear codes are optimal in the sense that their parameters meet certain bound on linear codes. The work of this paper extended the main results in [7, 22].