1 Introduction

Quantum error-correcting codes play a key role in quantum information processing and quantum computation [1, 2]. As we know, quantum error-correcting codes can be constructed from classical linear error-correcting codes with certain dual-containing properties [3]. In other words, a classical linear code without the dual-containing condition cannot be used to construct quantum error-correcting codes. For more details on the construction of quantum MDS codes, please refer to [4,5,6,7,8]. The development of EAQEC codes theory is a breakthrough in the area of quantum error correction. Hsieh et al. [9] proposed a more general framework called entanglement-assisted stabilizer formalism. The framework allows arbitrary classical linear error-correcting codes without the dual-containing constraint to transform into EAQEC codes if shared entanglement is available between the sender and receiver. For more details on EAQECCs, we refer the reader to [10,11,12,13,14,15,16]. Recently, using arbitrary classical linear codes without the dual-containing condition to construct EAQEC codes has become an important area of study [17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]; more and more scholars have been encouraged to construct EAQEC codes with good parameters (much larger minimum distances or code rates).

However, it is challenging to determine the number of pre-shared maximally entangled states for constructing an EAQEC code. By using algebraical methods, many EAQEC codes with good parameters have been constructed in [17,18,19]. Fan et al. provided a construction of EAQEC MDS codes with a small number of pre-shared maximally entangled states in [20]. Li et al. proposed the concept of decomposition of the defining set of cyclic codes in [21, 22]. According to the concept, they transformed the problem of calculating the number of share pairs to determine a special subset of the defining set of a cyclic code and then constructed some EAQEC codes with good parameters. Their method was generalized to apply in negacyclic codes and constacyclic codes and yielded many EAQEC codes with good parameters [23,24,25,26,27,28]. Li et al. [29] constructed some EAQEC MDS codes by using generalized Reed–Solomon codes. Guenda et al. [18] proved that the required number of shared pairs was related to the dimension of the hull of a classical linear code. Via following the fact, Luo et al. [30] and Luo and Cao [31] constructed several new infinite classes of EAQEC MDS codes by determining the Euclidean hull of (extended) GRS codes. Fang et al. [32] obtained several classes of EAQEC MDS codes by determining the Hermitian hull of (extended) GRS codes. These works showed that (extended) GRS codes are a good source for producing EAQEC MDS codes.

In this paper, we first construct some MDS codes from GRS codes and calculate the dimension of their Hermitian hulls and then obtain three new classes of q-ary EAQEC codes and EAQEC MDS codes with these constructed MDS codes as follows:

  1. (1)

    Let q be a prime power. If \(q+1< n\le 2(q-1)\) and \(n-q < k\le \lfloor \frac{n}{2}\rfloor \), then there exist \([[n,k-l,n-k+1;n-k-l]]_q\) EAQEC codes and \([[n,n-k-l,k+1;k-l]]_q\) EAQEC MDS codes, where \(1\le l\le k+q-n\).

  2. (2)

    Let \(q=p^m\ge 3\) be a prime power and e be a positive integer with e|m. Assume that \(N=tp^{ez}\) with \(1\le t\le p^e\) and \(1\le z\le \frac{2m}{e}-1\) and n is an integer such that \(1<n<N\). If \(1< k\le \lfloor \frac{N+q-1}{q+1}\rfloor \) and \(n+k>N+1\), then there exist \([[n,k-l,n-k+1;n-k-l]]_q\) EAQEC codes and \([[n,n-k-l,k+1;k-l]]_q\) EAQEC MDS codes, where \(1\le l\le n-N+k-1\).

  3. (3)

    Let \(q=p^m\ge 3\) be a prime power and \(n^{'}=ml\) be some divisor of \(q^2-1\) with \(l|q+1\) and \(\text {gcd}(n^{'},q-1)=m\). Assume that \(N=tn^{'}\) with \(1\le t\le \frac{q-1}{m}\) and n is an integer such that \(1<n<N\). If \(1<k\le \lfloor \frac{N+q}{q+1}\rfloor \) and \(n+k>N+1\), then there exist \([[n,k-l,n-k+1;n-k-l]]_q\) EAQEC codes and \([[n,n-k-l,k+1;k-l]]_q\) EAQEC MDS codes, where \(1\le l\le n-N+k-1\).

Note that the above EAQEC codes are new in the sense that their parameters are different from all previously known ones. Moreover, the three classes of EAQEC codes and EAQEC MDS codes have more flexible parameters not only on shared pairs but also on lengths.

The manuscript is organized as follows: In Sect. 2, we review some basic notations and results on Hermitian hull, GRS codes and EAQEC codes. Section 3 constructs three new classes of EAQEC codes and EAQEC MDS codes with more flexible shared pairs and lengths by using GRS codes. Section 4 summarizes this paper.

2 Preliminaries

In this section, some basic notations and results on Hermitian hull, generalized Reed–Solomon codes and entanglement-assisted quantum error-correcting codes are reviewed, which will be frequently used later.

Let q be a prime power and \(F_{q^2}\) be the finite field with \(q^2\) elements. For any \(\alpha \in F_{q^2}\), we denote as \(\overline{\alpha }\) the conjugation of \(\alpha \). Let \(A=(a_{ij})_{k\times n}\) be some \(k\times n\) matrix, where \(a_{ij}\in F_{q^2}\). We denote the conjugation of the matrix \(A=(a_{ij})_{k\times n}\) by \(\overline{A}=(\overline{a}_{ij})_{k\times n}\) and the conjugate transpose of A over \(F_{q^2}\) by \(A^\dag =\overline{A}^\top \).

2.1 Hermitian hull

Any k-dimensional vector subspace of \(F_{q^2}^n\) with minimum Hamming distance d is said to be an \([n,k,d]_{q^2}\) linear code C. Moreover, C is called a maximum distance separable (MDS) code, if its parameters attain the Singleton bound, i.e., \(k= n-d+1\). The Euclidean dual code of C is defined as

$$\begin{aligned} C^{\perp E}=\{\mathbf{x}\in F_{q^2}^{n} : \langle \mathbf{x,y}\rangle _{E}=0, \forall ~\mathbf{y}\in C\}, \end{aligned}$$

where \(\langle \mathbf{x,y}\rangle _{E}=\sum \nolimits _{i=1}^{n}x_iy_i\) is the Euclidean inner product of \(\mathbf{x}\) and \(\mathbf{y}\). The Euclidean hull of C is defined as \(C\cap C^{\perp E}\), which was first proposed in [33]. Obviously, the Euclidean hull of a linear code C is also a linear code.

Similarly, the Hermitian dual code of C is defined as

$$\begin{aligned} C^{\perp H}=\{\mathbf{x}\in F_{q^2}^{n} : \langle \mathbf{x,y}\rangle _{H}=0, \forall ~\mathbf{y}\in C\}, \end{aligned}$$

where\(\langle \mathbf{x,y}\rangle _{H}=\sum \nolimits _{i=1}^{n}x_iy_i^q\) is the Hermitian product of \(\mathbf{x}\) and \(\mathbf{y}\). The Hermitian hull of a linear code C over \(F_{q^2}\) is \(C\cap C^{\perp H}\), denoted by \(\text {Hull}_{h}(C)\). It is obvious that \(Hull_{h}(C)\) is also a linear code over \(F_{q^2}\).

2.2 Generalized Reed–Solomon codes

Let \(F_{q^2}[x]_k=\{f(x)\in F_{q^2}[x]|\text {deg}(f(x))\le k-1\}\), \(\mathbf{a}=(\alpha _1,\alpha _2,\ldots ,\alpha _n)\in F_{q^2}^n\) and \(\mathbf{v}=(\upsilon _1,\upsilon _2,\ldots ,\upsilon _n)\in (F^{*}_{q^2})^n\), where \(\alpha _1,\alpha _2,\ldots ,\alpha _n\in F_{q^2}\) are distinct, \(\upsilon _1,\upsilon _2,\ldots ,\upsilon _n\in F_{q^2}^{*}\) may not be distinct and \(k\le n \le q^2\). Then, the GRS code over \(F_{q^2}\) associated with \(\mathbf{a}\) and \(\mathbf{v}\) can be defined as:

$$\begin{aligned} GRS_k(\mathbf{a,v})=\{(\upsilon _1f(\alpha _1),\upsilon _2f(\alpha _2),\ldots , \upsilon _nf(\alpha _n)):f(x)\in F_{q^2}[x]_k\}. \end{aligned}$$

The GRS code \(GRS_{k}(\mathbf a , \mathbf v )\) above is an \([n,k,n-k+1]\) linear MDS code over \(F_{q^2}\). The generator matrix G of \(GRS_{k}(\mathbf a , \mathbf v )\) is given as follows:

$$\begin{aligned} G=\left( \begin{array}{ccccc} \upsilon _1\alpha _1^0 &{}\upsilon _2\alpha _2^0&{} \cdots &{} \upsilon _n\alpha _n^0\\ \upsilon _1\alpha _1^1 &{} \upsilon _2\alpha _2^1 &{} \cdots &{} \upsilon _n\alpha _n^1\\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \upsilon _1\alpha _1^{k-1} &{} \upsilon _2\alpha _2^{k-1} &{} \cdots &{} \upsilon _n\alpha _n^{k-1}\\ \end{array} \right) . \end{aligned}$$

It is well known that the Euclidean dual of \(GRS_k(\mathbf{a,v})\) is also a GRS code and can be denoted as \(GRS_{n-k}(\mathbf{a,v^{'}})\) for some \(\mathbf{v^{'}}=(\upsilon _1^{'},\upsilon _2^{'},\ldots ,\upsilon _n^{'})\in (F_{q^2}^{*})^n\) (see [34]). Denote the all-one vector of length n by \(\mathbf{1}\)=\((1,1,\ldots ,1)\), then we have that \(GRS_k(\mathbf{a,1})^{\perp E}=GRS_{n-k}(\mathbf{a,u})\), where \(\mathbf{u}=(u_1,u_2,\ldots ,u_n)\) with \(u_i=\prod _{1\le j\le n, j\ne i}(\alpha _i-\alpha _j)^{-1}\) for all \(1\le i\le n\) (see [35]). Recently, Luo and Cao [31] proposed that \(GRS_k(\mathbf{a,v})^{\perp }=GRS_{n-k}(\mathbf{a,w})\), where \(\mathbf{w}=(\omega _1,\omega _2,\ldots ,\omega _n)\) with \(\omega _i=\upsilon _i^{-1}u_i\) for any \(1\le i\le n\). Notice that \(C^{\perp H}=\overline{C}^{\perp E}\) for any linear code C. For the Hermitian dual of \(GRS_k(\mathbf{a,v})\), we have the following lemma.

Lemma 2.1

Let the notations be defined as above. Then, the Hermitian dual of \(GRS_k(\mathbf{a,v})\) is \(GRS_{n-k}(\overline{\mathbf{a}},\overline{\mathbf{w}})\), where \(\overline{\mathbf{w}}=(\overline{\omega _1},\overline{\omega _2},\ldots ,\overline{\omega _n})\) with \(\omega _i=\upsilon _i^{-1}\prod _{1\le j\le n, j\ne i}(\alpha _i-\alpha _j)^{-1}\) for all \(1\le i\le n\). In particular, we have \(GRS_k(\mathbf{a,1})^{\perp H}=GRS_{n-k}(\mathbf{\overline{a},\overline{u}})\), where \(\mathbf{u}=(u_1,u_2,\ldots ,u_n)\) with \(u_i=\prod _{1\le j\le n, j\ne i}(\alpha _i-\alpha _j)^{-1}\) for all \(1\le i\le n\).

Proof

Let \(\sigma \) be the mapping \(\sigma (\alpha )=\overline{\alpha }\) for any \(\alpha \in F_{q^2}\). From [36], \(\sigma \) is an automorphism of \(F_{q^2}\). Then, we have

$$\begin{aligned} \overline{GRS_k(\mathbf{a,v})}= & {} \{(\overline{\nu _1}\overline{f}(\overline{\alpha _2}), \overline{\nu _1}\overline{f}(\overline{\alpha _2}),\ldots ,\overline{\nu _n}\overline{f} (\overline{\alpha _n})):f(x)\in F_{q^2}[x]_k\}\\= & {} \{(\overline{\nu _1} f(\overline{\alpha _2}),\overline{\nu _1}f(\overline{\alpha _2}) ,\ldots ,\overline{\nu _n}f(\overline{\alpha _n})):f(x)\in F_{q^2}[x]_k\}\\= & {} GRS_k(\overline{\mathbf{a}},\overline{\mathbf{v}}). \end{aligned}$$

Therefore, the Hermitian dual of \(GRS_k(\mathbf{a,v})\) is

$$\begin{aligned} GRS_k(\mathbf{a,v})^{\perp H}=GRS_k(\mathbf{\overline{a},\overline{v}})^{\perp E}=GRS_{n-k}(\mathbf{\overline{a},\overline{w}}), \end{aligned}$$

where \(\overline{\mathbf{w}}=(\overline{\omega _1},\overline{\omega _2},\ldots ,\overline{\omega _n})\) with \(\omega _i=\upsilon _i^{-1}\prod _{1\le j\le n, j\ne i}(\alpha _i-\alpha _j)^{-1}\) for all \(1\le i\le n\). \(\square \)

The following lemma provides a sufficient and necessary condition of \(\mathbf{c}\in GRS_k(\mathbf{a,v})\cap GRS(\mathbf{a,v})^{\perp H}\) and will be used frequently for determining the Hermitian hull of a GRS code.

Lemma 2.2

Suppose that \(GRS_k(\mathbf{a,v})\) is the GRS code associated with \(\mathbf{a}\) and \(\mathbf{v}\) defined as above. For any codeword \(\mathbf{c}=(\upsilon _1f(\alpha _1),\upsilon _2f(\alpha _2),\ldots ,\upsilon _nf(\alpha _n)) \in GRS_k(\mathbf{a,v})\), \(\mathbf{c}\in GRS(\mathbf{a,v})^{\perp H}\) if and only if there exists a polynomial g(x) with \(\text {deg}(g(x))\le n-k-1\) such that

$$\begin{aligned}&(\upsilon _1^{q+1}f(\alpha _1),\upsilon _2^{q+1}f(\alpha _2),\ldots ,\upsilon _n^{q+1}f (\alpha _n))\\&\quad =(\overline{u_1}g(\overline{\alpha _1}),\overline{u_2}g(\overline{\alpha _2}) ,\ldots ,\overline{u_n}g(\overline{\alpha _n}))\\&\quad =(\overline{u_1}g^{'q}(\alpha _1),\overline{u_2}g^{'q}(\alpha _2),\ldots , \overline{u_n}g^{'q}(\alpha _n)), \end{aligned}$$

where \(g^{'q}(\alpha _i)=g(\overline{\alpha _i})\) and \(\overline{u_i}=\prod _{1\le j\le n, j\ne i}(\overline{\alpha _i}-\overline{\alpha _j})^{-1}\) for all \(1\le i\le n\).

Proof

From Lemma 2.1, we have

$$\begin{aligned} (\upsilon _1^{q+1}f(\alpha _1),\upsilon _2^{q+1}f(\alpha _2),\ldots ,\upsilon _n^{q+1} f(\alpha _n))=(\overline{u_1}g(\overline{\alpha _1}),\overline{u_2}g(\overline{\alpha _2}) ,\ldots ,\overline{u_n}g(\overline{\alpha _n})), \end{aligned}$$

where \(\text {deg}(g(x))\le n-k-1\) and \(u_i=\prod _{1\le j\le n, j\ne i}(\alpha _i-\alpha _j)^{-1}\) for all \(1\le i\le n\). According to the definition of \(\sigma \), there exists a polynomial \(g^{'}(x)=\sigma ^{-1}(g(\overline{x}))\) such that

$$\begin{aligned} (\overline{u_1}g(\overline{\alpha _1}),\overline{u_2}g(\overline{\alpha _2}),\ldots , \overline{u_n}g(\overline{\alpha _n}))=(\overline{u_1}g^{'q}(\alpha _1), \overline{u_2}g^{'q}(\alpha _2),\ldots ,\overline{u_n}g^{'q}(\alpha _n)). \end{aligned}$$

This completes the proof. \(\square \)

Note that \(\text {deg}(g^{'}(x))=\text {deg}(g(x))\le n-k-1\) and the existence of g(x) depends on the existence of \(g^{'}(x)\).

2.3 Entanglement-assisted quantum error-correcting codes

In the following, we recall some basic notations and results of entanglement-assisted quantum error-correcting codes. EAQEC codes are a generalization of standard stabilizer quantum codes that can be constructed via arbitrary classical linear codes (not necessarily dual-containing). A \(q-ary\) EAQEC code can be denoted as \([[n,k,d;c]]_q\), which encodes k information qubits into n channel qubits with the help of c pairs of maximally entangled states and corrects up to \(\lfloor \frac{d-1}{2} \rfloor \) errors, where d is the minimum distance of the code. For an \([[n,k,d;c]]_q\) EAQEC code, the performance is determined by its rate k / n and net rate \((k-c)/n\). Brun et al. [14] proved that one can obtain catalytic codes if the net rate is positive. The parameters nkd and c of an EAQEC code have many constraints; one of the most important bounds on EAQEC codes is the EA-quantum Singleton bound as follows.

Lemma 2.3

[9, 16] For any EAQEC code \([[n,k,d;c]]_q\), if \(d\le \frac{n+2}{2}\), its parameters must satisfy

$$\begin{aligned} n+c-k\ge 2(d-1), \end{aligned}$$

where \(0\le c\le n-1\).

An EAQEC code \([[n,k,d;c]]_q\) is called an EAQEC MDS code if its parameters achieve the EA-quantum Singleton bound. In recent years, more and more EAQEC codes have been constructed by using classical linear code over finite fields. One of the most frequently used constructions is given as below.

Theorem 2.4

[11, 14] Let H be the parity check matrix of an [nkd] classical linear code over \(\mathbb {F}_{q^{2}}\). Then, there exists an EAQEC code with parameters \([[n,2k-n +c,d;c]]_q \), where \(c =\text {rank}(HH^{\dag })\) is the required number of maximally entangled states and \(H^\dag \) is the conjugate transpose of H over \(F_{q^2}\).

Let C be an [nk] classical linear code with parity check matrix H. Guenda et al. [18] proved that \(rank(HH^{\dag }) =n-k-\dim (Hull_{H}(\mathcal {C}))=n-k-\dim (Hull_{H}(\mathcal {C}^{\perp _{H}}))\), which establishes the relation between the value of \(rank(HH^{\dag })\) and the dimension of the Hermitian hull of C. Based on the fact, Guenda et al. provided the following construction, by considering linear code C and its dual code.

Lemma 2.5

[18] Let C be an \([n,k,d]_{q^2}\) classical linear code and \(C^{\perp }\) be its Euclidean dual code with parameters \([n,n-k,d^{\perp }]_{q^2}\). Then there exist \([[n,k-\text {dim}(Hull_h(C)),d;n-k-\text {dim}(Hull_h(C))]]_q\) and \([[n,n-k-\text {dim}(Hull_h(C)),d^{\perp };k-\text {dim}(Hull_h(C))]]_q \) EAQEC codes. Furthermore, if C is MDS, then one of the two EAQEC codes must be MDS.

3 Constructions of EAQEC MDS codes from GRS codes

In this section, by considering generalized Reed–Solomon codes over \(F_{q^2}\), we first construct three classes of \(q^2\)-ary MDS codes and calculate the dimension of their Hermitian hulls. Let \(\omega \) be a primitive element of \(F_{q^2}\). It is easy to know that \(F_q^{*}=\langle \omega ^{q+1}\rangle \) is a cyclic subgroup of the multiplicative group \(F_{q^2}^{*}\). This shows that \(\alpha ^{q+1}\in F_{q}\) for any \(\alpha \in F_{q^2}\), and there must exist some element \(\alpha \in F_{q^2}\) such that \(\beta =\alpha ^{q+1}\) for any \(\beta \in F_q\).

Theorem 3.1

Let q be a prime power. If \(q+1\le n\le 2(q-1)\) and \(n-q < k\le \lfloor \frac{n}{2}\rfloor \), then there exists a \(q^2\)-ary [nk] MDS code with l-dimensional Hermitian hull, where \(1\le l\le k+q-n\).

Proof

If s is even and \( n-s\le q\), we let \(\alpha _1,\alpha _1^q,\ldots ,\alpha _{\frac{s}{2}},\alpha _{\frac{s}{2}}^q\in F_{q^2}\setminus F_q\) and \(\beta _{s+1},\ldots ,\beta _n\in F_q\). Note that \((\alpha +\alpha ^q)\in F_q \) for any \(\alpha \in F_{q^2}\). For any \(\beta \in F_q\) and \(\alpha \in F_{q^2}\setminus F_q\), we have \((\beta -\alpha )(\beta -\alpha ^q)=\beta ^2-(\alpha +\alpha ^q)\beta +\alpha ^{q+1}\in F_q^{*}=\langle \omega ^{q+1}\rangle \). Let \(u_i=\prod _{s+1\le j\le n, j\ne i}(\beta _i-\beta _j)^{-1}\cdot \prod _{1\le j\le \frac{s}{2}}(\beta _i-\alpha _j)^{-1}(\beta _i-\alpha _j^q)^{-1}\) for \(s+1\le i\le n\). It is clear that \(u_i\in F_q^{*}\), i.e., \(\overline{u_i}\in F_q^{*}=\langle \omega ^{q+1}\rangle \). Then there exists a element \(\upsilon _i\in F_{q^2}\) such that \(\upsilon _i^{q+1}=\overline{u_i}\) for any \(s+1\le i\le n\). When \(1\le i\le s\), we let \(u_i=(\alpha _{\frac{i+1}{2}}-\alpha _{\frac{i+1}{2}}^q)^{-1}\prod _{1\le j\le \frac{s}{2}, j\ne \frac{i+1}{2}}(\alpha _{\frac{i+1}{2}}-\alpha _j)^{-1}(\alpha _{\frac{i+1}{2}}-\alpha _j^q)^{-1}\prod _{s+1\le j\le n}(\alpha _{\frac{i+1}{2}}-\beta _j)^{-1}\) for odd i and \(u_i=(\alpha _{\frac{i}{2}}^q-\alpha _i)^{-1}\prod _{1\le j\le \frac{s}{2}, j\ne i}(\alpha _{\frac{i}{2}}^q-\alpha _j)^{-1}(\alpha _{\frac{i}{2}}^q-\alpha _j^q)^{-1}\prod _{s+1\le j\le n}(\alpha _{\frac{i}{2}}^q-\beta _j)^{-1}\) for even i. Take \(\mathbf{a}=(\alpha _1,\alpha _1^q,\ldots ,\alpha _{\frac{s}{2}},\alpha _{\frac{s}{2}}^q,\beta _{s+1},\ldots ,\beta _n)\) and \(\mathbf{v}=(b_1,b_2,\ldots ,b_s,\upsilon _{s+1},\) \(\ldots ,\upsilon _n)\), where \(b_i\) for odd i satisfies \(b_i^{q+1}\ne \overline{u_i}\overline{u_{i+1}}\) and \(b_i=1\) for even i. Then, we have

$$\begin{aligned}&GRS_k(\mathbf{a,v})=\{(b_1f(\alpha _1),f(\alpha _1^q),\ldots ,b_{s-1}f( \alpha _{\frac{s}{2}}),f(\alpha _{\frac{s}{2}}^q), \\&\quad \upsilon _{s+1}f(\beta _{s+1}),\ldots ,\upsilon _nf(\beta _n)):f(x)\in F_{q^2}[x]_k\}. \end{aligned}$$

For any \(\mathbf{c}=(b_1f(\alpha _1),f(\alpha _1^q)\ldots ,b_{s-1}f(\alpha _{\frac{s}{2}}),f(\alpha _{\frac{s}{2}}^q),\upsilon _{s+1}f(\beta _{s+1}),\ldots ,\upsilon _nf(\beta _n))\in GRS_k(\mathbf{a,v})\) \(\cap GRS(\mathbf{a,v})^{\perp H}\), it follows from Lemma 2.2 that there exists \(g(x)\in F_{q^2}[x]_{n-k}\) such that

$$\begin{aligned} \begin{aligned}&(b_1^{q+1}f(\alpha _1),f(\alpha _1^q)\ldots ,b_{s-1}^{q+1}f(\alpha _{\frac{s}{2}}), f(\alpha _{\frac{s}{2}}^q),\upsilon _{s+1}^{q+1}f(\beta _{s+1}),\ldots , \upsilon _n^{q+1}f(\beta _n))\\&\quad =(\overline{u_1}g(\alpha _1^q),\overline{u_2}g(\alpha _1),\ldots , \overline{u_{s-1}}g(\alpha _{\frac{s}{2}}^q),\overline{u_{s}}g(\alpha _{\frac{s}{2}}), \overline{u_{s+1}}g(\overline{\beta _{s+1}}),\ldots ,\overline{u_n}g(\overline{\beta _n}))\\&\quad =(\overline{u_1}g(\alpha _1^q),\overline{u_2}g(\alpha _1),\ldots , \overline{u_{s-1}}g(\alpha _{\frac{s}{2}}^q),\overline{u_{s}}g(\alpha _{\frac{s}{2}}), \upsilon _{s+1}^{q+1}g(\beta _{s+1}),\ldots ,\upsilon _n^{q+1}g(\beta _n)). \end{aligned} \end{aligned}$$
(1)

Hence, we have \(f(\beta _i)=g(\beta _i)\) for any \(s+1\le i\le n\) and

$$\begin{aligned} \left\{ {{\begin{array}{ll} b_{2i-1}^{q+1}f(\alpha _i)=\overline{u_{2i-1}}g(\alpha _i^q), \\ \\ f(\alpha _i^q)=\overline{u_{2i}}g(\alpha _i), \\ \end{array} }} \right. \end{aligned}$$
(2)

for any \(1\le i\le \frac{s}{2}\). Note that \(\text {deg}(f(x))\le k-1\le n-k-1\) and \(\text {deg}(g(x))\le n-k-1\). Since \(n-k-1< n-s\), we have \(f(x)=g(x)\) for any \(x\in F_{q^2}\). Then (2) becomes

$$\begin{aligned} \left\{ {{\begin{array}{ll} b_{2i-1}^{q+1}g(\alpha _i)=\overline{u_{2i-1}}g(\alpha _i^q), \\ \\ g(\alpha _i^q)=\overline{u_{2i}}g(\alpha _i), \\ \end{array} }} \right. \end{aligned}$$
(3)

Combine (3) and the definition of \(b_i\), we have \(g(\alpha _i)=g(\alpha _i^q)=0\) for any \(1\le i\le \frac{s}{2}\). Thus, we can obtain \(f(x)=g(x)=h(x)\prod _{i=1}^{\frac{s}{2}}(x-\alpha _i)(x-\alpha _i^q)\), where \(\text {deg}(h(x))\le k-1-s\). In addition, if s is odd and \( n-s<q\), we take \(\mathbf{a}=(\alpha _1,\alpha _1^q,\ldots ,\alpha _{\frac{s-1}{2}},\alpha _{\frac{s-1}{2}}^q,\alpha _s,\beta _{s+1},\ldots ,\beta _n)\) and \(\mathbf{v}=(b_1,b_2,\ldots ,b_{s-1},b_s\nu _s,\nu _{s+1},\ldots ,\) \(\nu _n)\), where \(b_i\) for odd i satisfies \(b_i^{q+1}\ne \overline{u_i}\overline{u_{i+1}}\) and \(b_i=1\) for even i. Similarly, we can obtain \(f(x)=g(x)=xh(x)\prod _{i=1}^{\frac{s-1}{2}}(x-\alpha _i)(x-\alpha _i^q)\), where \(\text {deg}(h(x))\le k-1-s\). These demonstrate the results. \(\square \)

Let \(q=p^m\) and e be a positive integer such that e|m. Notice that \(F_{q^2}\) can be regarded as a \(\frac{2m}{e}\)-dimensional vector space over \(F_{p^e}\). For any integer z with \(1\le z<\frac{2m}{e}-1\), let A be an z-dimensional vector subspace over \(F_{p^e}\) of \(F_{q^2}\). We denote the elements of \(F_{p^e}\) by \(\alpha _1=0,\alpha _2,\ldots ,\alpha _{p^e}\). For \(1\le t\le p^e\) and \(1\le j\le t\), we denote \(A_j=\{x+\alpha _j\eta :x\in A\}\), where \(\eta \in F_{q^2}\setminus F_{p^e}\) is some fixed element. Let \(N=tp^{ez}\) be an integer with \(1\le t\le p^e\) and \(1\le z<\frac{2m}{e}-1\). Assume that \(\cup _{i=1}^{t}A_i=\{\alpha _1,\alpha _2,\ldots ,\alpha _N\}\) and \(U_i=\prod _{1\le j\le N, j\ne i}(\alpha _i-\alpha _j)^{-1}\) for any \(1\le i\le N\). If \(\alpha _i\in A_h\) for some \(1\le h\le t\), it follows from Lemma 5 in [32] that

$$\begin{aligned} U_i=\left( \prod _{\alpha \ne 0\in A}\alpha ^{-1}\right) \left( \prod _{\beta \in A}(\eta -\beta )\right) ^{1-t}\left( \prod _{1\le j\le t,j\ne h}(\alpha _h-\alpha _j)^{-1}\right) . \end{aligned}$$

Moreover, let \(\delta =(\prod _{\alpha \ne 0\in A}\alpha )(\prod _{\beta \in A}(\eta -\beta ))^{t-1}\), we have \(\delta U_i\in F_{p^e}\subset F_{q}\) as \(\alpha _1,\alpha _2,\ldots ,\alpha _t\in F_{p^e}\). By using GRS codes, we construct the following MDS codes of length n over \(F_{q^2}\) and determine their Hermitian hulls.

Theorem 3.2

Let \(q=p^m\ge 3\) be a prime power and e be a positive integer with e|m. Let \(N=tp^{ez}\) be an integer, where \(1\le t\le p^e\) and \(1\le z\le \frac{2m}{e}-1\). Assume that n is an integer such that \(1<n<N\). For any \(1<k\le \lfloor \frac{N+q-1}{q+1}\rfloor \) and \(n+k>N+1\), then there exists a \(q^2\)-ary [nk] MDS code with l-dimensional Hermitian hull for any \(1\le l\le n-N+k-1\).

Proof

Let the notations be defined as above. Take \(\mathbf{a}=(\alpha _1,\alpha _2,\ldots ,\alpha _{n})\). Since \(1\le t\le p^e\le q\) and \(N=tp^{ez}\), we have \(1<k\le \lfloor \frac{N+q-1}{q+1}\rfloor \le p^{ez}=|A|\). It follows from \(n+k>N+1\) that \(N-n<k-1\le p^{ez}-1<|A|\). Then for any \(1\le i\le n\), we have

$$\begin{aligned} u_i= & {} \prod _{1\le j\le n, j\ne i}(\alpha _i-\alpha _j)^{-1}\\= & {} \prod _{1\le j\le N, j\ne i}(\alpha _i-\alpha _j)^{-1})\prod _{j=n+1}^{N}(\alpha _i-\alpha _j)\\= & {} U_i\prod _{j=n+1}^{N}(\alpha _i-\alpha _j). \end{aligned}$$

Since \(\delta U_i\in F_{q}\), there exist \(\upsilon _1,\upsilon _2,\ldots ,\upsilon _n\in F_{q^2}\) such that \(\upsilon _i^{q+1}=\delta U_i\) for any \(1\le i\le n\). Furthermore, we take \(\mathbf{v}=(b\upsilon _1,b\upsilon _2,\ldots ,b\upsilon _s,\upsilon _{s+1},\ldots ,\upsilon _n)\) with \(1\le s\le n+k-N-1\), where \(b^{q+1}\ne 1\) and \(\upsilon _i\in F_{q^2}^{*}\) with \(\upsilon _i^{q+1}=\delta U_i\) for all \(1\le i\le n\). We consider the following \(q^2\)-ary GRS code of length n,

$$\begin{aligned}&GRS_k(\mathbf{a,v})=\{(b\upsilon _1f(\alpha _1),\ldots ,b\upsilon _sf(\alpha _s), \upsilon _{s+1}f(\alpha _{s+1}), \\&\quad \ldots ,\upsilon _nf(\alpha _n)):f(x)\in F_{q^2}[x]_k\}. \end{aligned}$$

For any \(\mathbf{c}=(b\upsilon _1f(\alpha _1),\ldots ,b\upsilon _sf(\alpha _s),\upsilon _{s+1}f(\alpha _{s+1}),\ldots ,\upsilon _nf(\alpha _n))\in GRS_k(\mathbf{a,v})\) \(\cap GRS(\mathbf{a,v})^{\perp H}\). It follows from Lemma 2.2 that

$$\begin{aligned} \begin{aligned}&(b^{q+1}\upsilon _1^{q+1}f(\alpha _1),\ldots ,b^{q+1}\upsilon _s^{q+1}f(\alpha _s), \upsilon _{s+1}^{q+1}f(\alpha _{s+1}),\ldots ,\upsilon _n^{q+1}f(\alpha _n))\\&\quad =(\overline{u_1}g(\alpha _1^q),\ldots ,\overline{u_{s}}g(\alpha _{s}^q), \overline{u_{s+1}}g(\alpha _{s+1}^q),\ldots ,\overline{u_n}g(\alpha _n^q))\\&\quad =(\overline{u_1}g^{'q}(\alpha _1),\ldots ,\overline{u_{s}}g^{'q}(\alpha _{s}), \overline{u_{s+1}}g^{'q}(\alpha _{s+1}),\ldots ,\overline{u_n}g^{'q}(\alpha _n)), \end{aligned} \end{aligned}$$
(4)

where \(g^{'}(x)\in F_{q^2}[x]_{n-k}\). For any \(s+1\le i\le n\), it follows from the last \(n-s\) coordinates of (4) that \(\upsilon _i^{q+1}f(\alpha _i)=\overline{u_i}g^{'q}(\alpha _i)\), i.e.,

$$\begin{aligned} \delta U_if^q(\alpha _i)=u_i g^{'}(\alpha _i)=\left( U_i\prod _{n+1\le j\le N}(\alpha _i-\alpha _j)\right) g^{'}(\alpha _i). \end{aligned}$$

This shows that \(\delta f^q(x)=(\prod _{n+1\le j\le N}(x-\alpha _j))g^{'}(x)\) has at least \(n-s\) distinct roots. It is clear that \(\text {deg}((\prod _{n+1\le j\le N}(x-\alpha _j))g^{'}(x))\le N-n+n-k-1\le N-k-1\). Besides, it is easy to know that \(\text {deg}(\delta f^q(x))\le q(k-1)\le N-k-1\), due to \(1\le k\le \lfloor \frac{N+q-1}{q+1}\rfloor \). It follows from \(1\le s\le n+k-N-1\) that \(N-k-1<n-s\). Therefore, we have \(\delta f^q(x)=(\prod _{n+1\le j\le N}(x-\alpha _j))g^{'}(x)\) for any \(x\in F_{q^2}\). According to the first s coordinates of (4), we have that \(b^{q+1}\upsilon _i^{q+1}f(\alpha _i)=\overline{u_i}g^{'q}(\alpha _i)\), i.e.,

$$\begin{aligned} b^{q+1}\delta U_if^q(\alpha _i)=u_i g^{'}(\alpha _i)=\left( U_i\prod _{n+1\le j\le N}(\alpha _i-\alpha _j)\right) g^{'}(\alpha _i)=\delta U_if^q(\alpha _i), \end{aligned}$$

for any \(1\le i\le s\). As \(b_i^{q+1}\ne 1\) for any \(1\le i\le s\), we can obtain \(f(\alpha _i)=0\) for any \(1\le i\le s\). Moreover, it follows from \(\delta f^q(x)=(\prod _{n+1\le j\le N}(x-\alpha _j))g^{'}(x)\) that \(f(\alpha _i)=0\) for any \(n+1\le i\le N\). Then we have that \(f(x)=h(x)(\prod _{i=1}^s(x-\alpha _i))(\prod _{i=n+1}^{N}(x-\alpha _i))\), where \(\text {deg}(h(x))\le n-N+k-1-s\). Put \(g^{'}(x)=\delta f^q(x)\prod _{i=n+1}^{N}(x-\alpha _i)^{-1}= \delta h^{q}(x)(\prod _{i=1}^{s}(x^q-\overline{\alpha _i}))(\prod _{i=n+1}^{N}(x-\alpha _i)^{q-1})\) and \(g(x)=\delta ^q h(x^q)(\prod _{i=1}^{s}(x^q-\alpha _i))(\prod _{i=n+1}^{N}(x-\alpha _i^{q})^{q-1})\). For any \(g(x),g^{'}(x)\in F_{q^2}[x]\) of the forms above, there is a \(f(x)=h(x)(\prod _{i=1}^s(x-\alpha _i))(\prod _{i=n+1}^{N}(x-\alpha _i))\) such that

$$\begin{aligned} \begin{aligned}&(b^{q+1}\upsilon _1^{q+1}f(\alpha _1),\ldots ,b^{q+1}\upsilon _s^{q+1}f(\alpha _s), \upsilon _{s+1}^{q+1}f(\alpha _{s+1}),\ldots ,\upsilon _n^{q+1}f(\alpha _{n}))\\&\quad =(\overline{u_1}g(\alpha _1^q),\ldots ,\overline{u_{s}}g(\alpha _{s}^q), \overline{u_{s+1}}g(\alpha _{s+1}^q),\ldots ,\overline{u_n}g(\alpha _n^q))\\&\quad =(\overline{u_1}g^{'q}(\alpha _1),\ldots ,\overline{u_{s}}g^{'q}(\alpha _{s}), \overline{u_{s+1}}g^{'q}(\alpha _{s+1}),\ldots ,\overline{u_n}g^{'q}(\alpha _n)), \end{aligned} \end{aligned}$$

which implies that

$$\begin{aligned}&(b\upsilon f(\alpha _1),\ldots ,b\upsilon _sf(\alpha _s),\upsilon _{s+1}f(\alpha _{s+1}), \ldots ,\upsilon _nf(\alpha _{n}))\\&\quad \in GRS_k(\mathbf{a,v})\cap GRS_k(\mathbf{a,v})^{\perp H}. \end{aligned}$$

Therefore, \(\text {dim}(\text {Hull}(GRS_k(\mathbf{a,v,\infty }))) =n-N+k-s\), where \(1\le s\le n+k-N-1\). This completes the proof. \(\square \)

Let \(n^{'}\) be some divisor of \(q^2-1\). Denote \(n_1=\dfrac{n^{'}}{\text {gcd}(n^{'},q+1)}\) and \(n_2=\text {gcd}(n^{'},q+1)\). Then \(\text {gcd}(n_1,q+1)=1\) and \(n_1|q-1\). Let \(G=\langle \omega ^{\frac{q^2-1}{n^{'}}}\rangle \) and \(D=\langle \omega ^{\frac{q+1}{n_2}}\rangle \). It is obvious that G and D are the multiplicative subgroups of \(F_{q^{2}}^{*}\) of order \(|G|=n^{'}\) and \(|D|=n_2(q-1)\), respectively. Due to \(\frac{q+1}{n_2}|\frac{q^2-1}{n^{'}}\), we have G as a subgroup of D. Then there are \(\beta _{1}, \ldots , \beta _{\frac{q-1}{n_{1}}} \in D\) such that \(D=\beta _1G\cup \beta _2G\cup \ldots \cup \beta _{(\frac{q-1}{n_1}-1)}G\). Let \(1\le t\le \frac{q-1}{n_1}\) and \(N=tn^{'}\). For convenience, we denote \(\cup _{i=1}^{t}\beta _iG=\{\alpha _1,\alpha _2,\ldots ,\alpha _{N}\}\) and \(U_i=\prod _{1\le j\le N, j\ne i}(\alpha _i-\alpha _j)^{-1}\) for any \(1\le i\le N\). If \(\alpha _i\in \beta _sG\) for some \(1\le s\le t\), it follows from Lemma 7 of [32] that

$$\begin{aligned} U_{i} =\alpha _in^{'-1}\beta _s^{-n^{'}}\prod _{0\le h\le t-1,h\ne s}(\beta _s^{n^{'}}-\beta _h^{n^{'}})^{-1}, \end{aligned}$$

and \(\varepsilon U_i=n^{'-1}\beta _s^{-n^{'}}\prod _{0\le h\le t-1,h\ne s}(\beta _s^{n^{'}}-\beta _h^{n^{'}})^{-1}\in F_q^{*}\), where \(\varepsilon =\alpha _i^{-1}\). Furthermore, we construct the following MDS codes and determine their Hermitian hulls.

Theorem 3.3

Let \(q=p^m\ge 3\) be a prime power and \(n^{'}=n_1n_2\) be some divisor of \(q^2-1\) with \(n_1=\frac{n^{'}}{\text {gcd}(n^{'},q+1)}\) and \(n_2=\text {gcd}(n^{'},q+1)\). Suppose that \(N=tn^{'}\) with \(1\le t\le \frac{q-1}{n_1}\) and n is an integer such that \(1<n<N\). For any \(1<k\le \lfloor \frac{N+q}{q+1}\rfloor \) and \(n+k>N+1\), then there exists a \(q^2\)-ary [nk] MDS code with l-dimensional Hermitian hull for any \(1\le l\le n-N+k-1\).

Proof

With the notations above, we take \(\mathbf{a}=(\alpha _1,\alpha _2,\ldots ,\alpha _{n})\). Then we have

$$\begin{aligned} u_i= & {} \prod _{1\le j\le n, j\ne i}(\alpha _i-\alpha _j)^{-1}\\= & {} U_i\prod _{j=n+1}^{N}(\alpha _i-\alpha _j), \end{aligned}$$

for any \(1\le i\le n\). Since \(\varepsilon U_i\in F_{q}^{*}\), there must exist \(\upsilon _1,\upsilon _2,\ldots ,\upsilon _n\in F_{q^2}\) such that \(\upsilon _i^{q+1}=\varepsilon U_i\) for any \(1\le i\le n\). Let \(b\in F_{q^2}^{*}\) and \(b^{q+1}\ne 1\). Take \(\mathbf{v}=(b\upsilon _1,b\upsilon _2,\ldots ,b\upsilon _s,\upsilon _{s+1},\ldots ,\upsilon _n)\), where \(1\le s\le n+k-N-1\). Then we obtain the following \(q^2\)-ary GRS code of length n associated with \(\mathbf{a}\) and \(\mathbf{v} \),

$$\begin{aligned}&GRS_k(\mathbf{a,v})=\{(b\upsilon _1f(\alpha _1),\ldots ,b\upsilon _sf(\alpha _s), \upsilon _{s+1}f(\alpha _{s+1}), \\&\quad \ldots ,\upsilon _nf(\alpha _n)):f(x)\in F_{q^2}[x]_k\}. \end{aligned}$$

For any \(\mathbf{c}=(b\upsilon _1f(\alpha _1),\ldots ,b\upsilon _sf(\alpha _s),\upsilon _{s+1}f(\alpha _{s+1}),\ldots ,\upsilon _nf(\alpha _n))\in GRS_k(\mathbf{a,v})\) \(\cap GRS(\mathbf{a,v})^{\perp H}\). According to Lemma 2.2, we have

$$\begin{aligned} \begin{aligned}&(b^{q+1}\upsilon _1^{q+1}f(\alpha _1),\ldots ,b^{q+1}\upsilon _s^{q+1}f(\alpha _s), \upsilon _{s+1}^{q+1}f(\alpha _{s+1}),\ldots ,\upsilon _n^{q+1}f(\alpha _n))\\&\quad =(\overline{u_1}g(\alpha _1^q),\ldots ,\overline{u_{s}}g(\alpha _{s}^q), \overline{u_{s+1}}g(\alpha _{s+1}^q),\ldots ,\overline{u_n}g(\alpha _n^q))\\&\quad =(\overline{u_1}g^{'q}(\alpha _1),\ldots ,\overline{u_{s}}g^{'q}(\alpha _{s}), \overline{u_{s+1}}g^{'q}(\alpha _{s+1}),\ldots ,\overline{u_n}g^{'q}(\alpha _n)), \end{aligned} \end{aligned}$$
(5)

where \(g^{'}(x)\in F_{q^2}[x]_{n-k}\). For any \(s+1\le i\le n\), it follows from the last \(n-s\) coordinates of (6) that \(\upsilon _i^{q+1}f(\alpha _i)=\overline{u_i}g^{'q}(\alpha _i)\), i.e.,

$$\begin{aligned} \alpha _i^{-1} U_if^q(\alpha _i)=u_i g^{'}(\alpha _i)=\left( U_i\prod _{j=n+1}^{N}(\alpha _i-\alpha _j)\right) g^{'}(\alpha _i). \end{aligned}$$

Then the polynomial \( f^q(x)=x(\prod _{j=n+1}^{N}(x-\alpha _j))g^{'}(x)\) has at least \(n-s\) distinct roots. It is clear that \(\text {deg}(x(\prod _{j=n+1}^{N}(x-\alpha _j))g^{'}(x))\le N-n+1+n-k-1\le N-k\). Since \(1<k\le \lfloor \frac{N+q}{q+1}\rfloor \), \(\text {deg}(f^q(x))\le q(k-1)\le N-k\). It follows from \(1\le s\le n+k-N-1\) that \(N-k<n-s\). Therefore, we have \(f^q(x)=x(\prod _{j=n+1}^{N}(x-\alpha _j))g^{'}(x)\) for any \(x\in F_{q^2}\). From the first s coordinates of (6), we have that \(b^{q+1}\upsilon _i^{q+1}f(\alpha _i)=\overline{u_i}g^{'q}(\alpha _i)\), i.e.,

$$\begin{aligned} b^{q+1}\alpha _i^{-1} U_if^q(\alpha _i)=u_i g^{'}(\alpha _i)=\left( U_i\prod _{j=n+1}^{N}(\alpha _i-\alpha _j)\right) g^{'}(\alpha _i), \end{aligned}$$

for any \(1\le i\le s\). Then \(b^{q+1}f^q(\alpha _i)=\alpha _i(\prod _{j=n+1}^{N}(\alpha _i-\alpha _j))g^{'}(\alpha _i)=f^q(\alpha _i)\) for any \(1\le i\le s\). As \(b_i^{q+1}\ne 1\) for any \(1\le i\le s\), we obtain \(f(\alpha _i)=0\) for any \(1\le i\le s\). In addition, it follows from \( f^q(x)=x(\prod _{j=n+1}^{N}(x-\alpha _j))g^{'}(x)\) that \(f(0)=0\) and \(f(\alpha _i)=0\) for any \(n+1\le i\le N\). Thus, we have that \(f(x)=xh(x)(\prod _{i=1}^s(x-\alpha _i))(\prod _{i=n+1}^{N}(x-\alpha _i))\), where \(\text {deg}(h(x))\le n-N+k-2-s\). Put \(g^{'}(x)=x^{-1} f^q(x)\prod _{i=n+1}^{N}(x-\alpha _i)^{-1}= x^{q-1} h^{q}(x)(\prod _{i=1}^{s}(x^q-\overline{\alpha _i}))(\prod _{i=n+1}^{N}(x-\alpha _i)^{q-1})\) and \(g(x)=x^{q-1} h(x^q)(\prod _{i=1}^{s}(x^q-\alpha _i))(\prod _{i=n+1}^{N}(x-\alpha _i^{q})^{q-1})\). For any \(g(x),g^{'}(x)\in F_{q^2}[x]\) of the forms above, there exists a \(f(x)=xh(x)(\prod _{i=1}^s(x-\alpha _i))(\prod _{i=n+1}^{N}(x-\alpha _i))\) such that

$$\begin{aligned} \begin{aligned}&(b^{q+1}\upsilon _1^{q+1}f(\alpha _1),\ldots ,b^{q+1}\upsilon _s^{q+1}f(\alpha _s), \upsilon _{s+1}^{q+1}f(\alpha _{s+1}),\ldots ,\upsilon _n^{q+1}f(\alpha _{n}))\\&\quad =(\overline{u_1}g(\alpha _1^q),\ldots ,\overline{u_{s}}g(\alpha _{s}^q), \overline{u_{s+1}}g(\alpha _{s+1}^q),\ldots ,\overline{u_n}g(\alpha _n^q))\\&\quad =(\overline{u_1}g^{'q}(\alpha _1),\ldots ,\overline{u_{s}}g^{'q}(\alpha _{s}), \overline{u_{s+1}}g^{'q}(\alpha _{s+1}),\ldots ,\overline{u_n}g^{'q}(\alpha _n)), \end{aligned} \end{aligned}$$

which implies that

$$\begin{aligned}&(b\upsilon f(\alpha _1),\ldots ,b\upsilon _sf(\alpha _s),\upsilon _{s+1}f(\alpha _{s+1}), \ldots ,\upsilon _nf(\alpha _{n})) \\&\quad \in GRS_k(\mathbf{a,v})\cap GRS_k(\mathbf{a,v})^{\perp H}. \end{aligned}$$

Therefore, \(\text {dim}(\text {Hull}(GRS_k(\mathbf{a,v,\infty }))) =n-N+k-1-s\), where \(1\le s\le n+k-N-1\). This completes the proof. \(\square \)

In Theorems 3.1, 3.2 and 3.3, we constructed three classes of MDS codes by using GRS codes and completely determined their Hermitian hulls. Based on the results and Lemma 2.5, three classes of q-ary EAQEC codes and EAQEC MDS codes can be easily obtained as follows.

Theorem 3.4

Let q be a prime power. If \(q+1< n\le 2(q-1)\) and \(n-q < k\le \lfloor \frac{n}{2}\rfloor \), then there exist \([[n,k-l,n-k+1;n-k-l]]_q\) EAQEC codes and \([[n,n-k-l,k+1;k-l]]_q\) EAQEC MDS codes, where \(1\le l\le k+q-n\).

Example 1

Let \(q=9\) and \(n=11,12\) in Theorem 3.4. Then we can obtain some new EAQEC codes and EAQEC MDS codes, whose parameters are listed in Table 1.

Table 1 Sample parameters of EAQEC codes from Theorem 3.4 for \(q=9\) and \(n=11,12\)

Theorem 3.5

Let \(q=p^m\ge 3\) be a prime power and e be a positive integer with e|m. Assume that \(N=tp^{ez}\) with \(1\le t\le p^e\) and \(1\le z\le \frac{2m}{e}-1\) and n is an integer such that \(1<n<N\). If \(1< k\le \lfloor \frac{N+q-1}{q+1}\rfloor \) and \(n+k>N+1\), then there exist \([[n,k-l,n-k+1;n-k-l]]_q\) EAQEC codes and \([[n,n-k-l,k+1;k-l]]_q\) EAQEC MDS codes, where \(1\le l\le n-N+k-1\).

Example 2

Let \(p=3\), \(m=2\) and \(e=2\) in Theorem 3.5, then \(z=1\). Take \(N=54\) and \(n=53\), then we can obtain some new EAQEC codes and EAQEC MDS codes, whose parameters are listed in Table 2.

Theorem 3.6

Let \(q=p^m\ge 3\) be a prime power and \(n^{'}=n_1n_2\) be some divisor of \(q^2-1\) with \(n_1=\frac{n^{'}}{\text {gcd}(n^{'},q+1)}\) and \(n_2=\text {gcd}(n^{'},q+1)\). Suppose that \(N=tn^{'}\) with \(1\le t\le \frac{q-1}{n_1}\) and n is an integer such that \(1<n<N\). If \(1<k\le \lfloor \frac{N+q}{q+1}\rfloor \) and \(n+k>N+1\), then there exist \([[n,k-l,n-k+1;n-k-l]]_q\) EAQEC codes and \([[n,n-k-l,k+1;k-l]]_q\) EAQEC MDS codes, where \(1\le l\le n-N+k-1\).

Example 3

Let \(p=5\) and \(m=2\) in Theorem 3.6. Take \(N=tn^{'}=2\cdot 78=156\) and \(n=155\), then we can obtain some new EAQEC codes and EAQEC MDS codes, whose parameters are listed in Table 3.

Remark 1

  1. (1)

    In [30, 31], the authors constructed some EAQEC (MDS) codes of lengths \(n\le q\) and all EAQEC MDS codes of lengths \(q+1\). In [32], all q-ary EAQEC MDS codes of lengths \(n\le q\) are completely determined. So, we mainly consider the construction of EAQEC codes of length \(n > q+1\).

  2. (2)

    Let \(q>3\) be a prime power. From Theorem 3.1, we know that Theorem 3.4 holds even for \(n=q+1\), i.e., we have EAQEC codes with parameters \([[q+1,k-l,q-k+2;q-k-l+1]]_q\) and EAQEC MDS codes with parameters \([[q+1,q-k-l+1,k+1;k-l]]_q\), where \(1<k\le \lfloor \frac{q+1}{2}\rfloor \) and \(1\le l\le k-1\). However, the EAQEC codes have been constructed in [30]. We do not consider the case with \(n=q+1\) in Theorem 3.4. Now, all the EAQEC codes in Theorem 3.4 are new in the sense that our parameters are not covered by the codes available in the literature.

  3. (3)

    Notice that the required number of maximally entangled states and lengths of the EAQEC codes constructed by us can take various values. Comparing the parameters with all known ones in the literature, one can find that our EAQEC codes in Theorems 3.5 and 3.6 are new. Some examples are given in Tables 1, 2 and 3, which can be obtained by Theorems 3.4, 3.5 and 3.6, respectively. The parameters of our EAQEC codes are flexible not only on c but also on n.

Table 2 Sample parameters of EAQEC codes from Theorem 3.5 for \(p=9\), \(N=54\) and \(n=53\)
Table 3 Sample parameters of EAQEC codes from Theorem 3.6 for \(q=25\), \(N=156\) and \(n=155\)

4 Conclusions

In this paper, we first constructed three classes of MDS codes by considering GRS codes and determined their Hermitian hulls. Based on the constructed MDS codes, we obtained three new classes of q-ary EAQEC codes and EAQEC MDS codes, whose maximally entangled states are closely related to the Hermitian hull and are flexible. Also, the three new classes of EAQEC codes and EAQEC MDS codes have more flexible lengths. Comparing with the parameters of all known EAQEC codes, all EAQEC codes obtained in this paper are new. The Hermitian hull of a linear code is a worthwhile problem for further study. It would be interesting to construct more EAQEC MDS codes by determining the Hermitian hulls of linear codes.